-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branch for review #1
base: review-branch
Are you sure you want to change the base?
Conversation
back behaviour for search menu
Ah, I see this is intended behaviour |
getLaWordList = getWordList "res/la-dict.txt" | ||
|
||
|
||
getTaWordList :: IO [String] | ||
getTaWordList = getWordList "res/ta-dict.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in other languages, it's better to store the names of the files in a config
show (WordParseError err word) = "Word '" <> word <> "'. " <> show err | ||
show (UnknownCommand cmd) = "Unsupported command: '" <> cmd <> "'." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and everywhere else you want to concatenate strings, it's better to use prinf
from Text.Printf
. And in general, it's better to use Text
findBestWord searchDict inputDict = | ||
let transformedWords = map (\candidate -> (candidate, getColorCountForDict candidate inputDict)) searchDict | ||
h = head transformedWords | ||
in if not $ null inputDict then Just $ fst $ foldl (\x y -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny enough, there is a notNull
function
let transformedWords = map (\candidate -> (candidate, getColorCountForDict candidate inputDict)) searchDict | ||
h = head transformedWords | ||
in if not $ null inputDict then Just $ fst $ foldl (\x y -> | ||
if compareWords x y == LT then y else x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you provided an instance of Ord
for the data type that represents the dictionaries, you could have then used minimum/maximum/sort and other useful standard library functions
let cnt = fst env | ||
let lst = snd env | ||
if ah == eh | ||
then modify $ const (cnt, (Green, eh) : lst) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modify . const
is equivalent to put
No description provided.