Reputation: 2290
I tried running this code, and it ended up making GHCi unusable. Meaning, the command line (Windows) ended up not responding to any input and simply displaying an empty line.
Prelude> b = ["Empty", "Discrete", "Distinct", "Defiant", "Useful", "Good",
"Imperative", "Safe", "Lawful", "Unpresidented", "Decadent", "Rich",
"Strong", "Marvelous", "Volatile", "Obtuse", "Acute", "Revolutionary",
"Frank", "Regular"]
Prelude> length b
20
Prelude> import Data.Char
Prelude Data.Char> a = [ map toLower x | x <- a ]
Prelude Data.Char> a
......
Upvotes: 0
Views: 122
Reputation: 119847
This is fully expected and normal behaviour.
a = [ map toLower x | x <- a ]
is a recursive definition of a
, where the recursion never ends. Note a
at both sides of the equals sign. GHCi is not crashing, it just runs this code for always and always, until you interrupt it by pressing Ctrl-C.
Upvotes: 4