<commit_before>{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE InstanceSigs #-}


module Rooms where

import Data.List

data Room = R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 | R9 deriving (Show, Eq, Ord)

newtype RoomDesc = RoomDesc String deriving Show
newtype RoomName = RoomName String deriving Show

data RoomInfo = RoomInfo {
  getRoom :: Room,
  getName :: RoomName,
  getDesc :: RoomDesc
} deriving Show

class DetailedInfo i k where
  sfindInfo :: [i] -> k -> Maybe i
  sgetDetailOf :: i -> [String]
  sgetDetail :: [i] -> k -> [String]
  stoString :: i -> [String]

findInfo :: [RoomInfo] -> Room -> Maybe RoomInfo
findInfo rooms room = find (\info -> (getRoom info) == room) rooms

getDetailOf :: RoomInfo -> [String]
getDetailOf info =
  let (RoomName name) = getName info
      (RoomDesc desc) = getDesc info
  in ["You are in the " ++ name ++ ". " ++ desc]

getDetail :: [RoomInfo] -> Room -> [String]
getDetail rooms room =<commit_msg>no we are getting somewhere<commit_after>{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE InstanceSigs #-}


module Rooms where

import Data.List

data Room = R1 | R2 | R3 | R4 | R5 | R6 | R7 | R8 | R9 deriving (Show, Eq, Ord)

newtype RoomDesc = RoomDesc String deriving Show
newtype RoomName = RoomName String deriving Show

data RoomInfo = RoomInfo {
  getRoom :: Room,
  getName :: RoomName,
  getDesc :: RoomDesc
} deriving Show

class Eq k => DetailedInfo i k where
  sfindInfo :: [i] -> k -> Maybe i
  sfindInfo infos key = find (\info -> (sgetKey info) == key) infos
  sgetKey :: i -> k
  sgetDetailOf :: i -> [String]
  sgetDetail :: [i] -> k -> [String]
  stoString :: i -> [String]

findInfo :: [RoomInfo] -> Room -> Maybe RoomInfo
findInfo rooms room = find (\info -> (getRoom info) == room) rooms

getDetailOf :: RoomInfo -> [String]
getDetailOf info =
  let (RoomName name) = getName info
      (RoomDesc desc) = getDesc info
  in ["You are in the " ++ name ++ ". " ++ desc]

getDetail :: [RoomInfo] -> Room -> [String]
getDetail rooms room =
{'fraction_non_alphanumeric': 0.13771377137713772, 'fraction_numerical': 0.008100810081008101, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4172885', 'n_tokens_mistral': 773, 'n_tokens_neox': 756, 'n_words': 250}