|
|
|
|
|
by tromp
4196 days ago
|
|
Minor nitpick: the first real line of code alphabet = "abcdefghijklmnopqrstuvwxyz"
is better written as alphabet = ['a'..'z']
This is really syntactic sugar for enumFromTo 'a' 'z'
using the function enumFromTo :: Enum a => a -> a -> [a]
from the typeclass Enum for enumerable types,
and the fact that a string (type String) is just
a list of characters (type [Char]). |
|
> I wrote this code putting brevity over readability
Overall, this is not particularly terse, for Haskell code. With all the lambdas, it looks like OCaml! For example, these are equivalent, and I find the latter clearer:
Now, it’s not necessarily a bad thing to be explicit, but in cases such as these, it’s less repetitious to just use the standard library functions.