Created
July 4, 2018 01:00
-
-
Save mauriciofierrom/061f185aed0dd763647ff140b5878cd9 to your computer and use it in GitHub Desktop.
Playing with GADTs and destructuring them.
This file contains 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 StandaloneDeriving #-} | |
{-# LANGUAGE GADTs #-} | |
data D a where | |
M :: D Bool | |
F :: Int -> D Int | |
deriving instance Show (D a) | |
main :: IO () | |
main = | |
let a = M | |
f = F 3 | |
in case a of | |
M -> putStrLn "Moriarty" | |
(F 3) -> putStrLn "F x 3" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment