/a.hs
Last active
August 29, 2015 14:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ok | |
main :: IO () | |
main = do | |
let x = Nothing | |
case x of | |
Just 0 -> return 0 | |
Nothing -> return 1 | |
case x of | |
Just "a" -> return 2 | |
Nothing -> return 3 | |
return () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- b.hs:5:10: | |
-- No instance for (Num [Char]) arising from the literal ‘0’ | |
-- In the pattern: 0 | |
-- In the pattern: Just 0 | |
-- In a case alternative: Just 0 -> return 0 | |
main :: IO () | |
main = do | |
x <- return Nothing | |
case x of | |
Just 0 -> return 0 | |
Nothing -> return 1 | |
case x of | |
Just "a" -> return 2 | |
Nothing -> return 3 | |
return () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE Rank2Types #-} | |
-- ok | |
f :: (forall a. Maybe a) -> IO () | |
f x = do | |
case x of | |
Just 0 -> return 0 | |
Nothing -> return 1 | |
case x of | |
Just "a" -> return 2 | |
Nothing -> return 3 | |
return () | |
main :: IO () | |
main = f Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment