Working in haskell, found odd behavior, stripped it down to bare bones
This Works
a :: Bool
a = case True of
True -> True
False -> False
But when I try
b :: IO Bool
b = do
let b' = case True of
True -> True
False -> False
return b'
I get
ghci>:l test.hs
[1 of 1] Compiling Main ( test.hs, interpreted )
test.hs:16:14: parse error on input ‘->’
Failed, modules loaded: none.
So I try
c :: IO Bool
c = do
let c' = case True of
True -> True
False -> False
return c'
And this works.
What? Why? Why do I need an extra indent in this case? I can't find anything on this, probably because these keyword are so short and common in everyday language. Is there some spec that explains this behavior?