|
|
|
|
|
by majewsky
3432 days ago
|
|
This only works because you're working with number literals here, which have the very liberal type "Num a => a". If I replace your main function by check :: Int -> Bool
check x = x == (Just x)
main = print (check 5)
I get a compile error: Main.hs:7:17: error:
• Couldn't match expected type ‘Int’ with actual type ‘Maybe Int’
• In the second argument of ‘(==)’, namely ‘(Just x)’
In the expression: x == (Just x)
In an equation for ‘check’: check x = x == (Just x)
|
|
http://tirania.org/blog/archive/2011/Feb-17.html