Skip to content

Instantly share code, notes, and snippets.

@mauriciofierrom
Created July 4, 2018 01:00
Show Gist options
  • Save mauriciofierrom/061f185aed0dd763647ff140b5878cd9 to your computer and use it in GitHub Desktop.
Save mauriciofierrom/061f185aed0dd763647ff140b5878cd9 to your computer and use it in GitHub Desktop.
Playing with GADTs and destructuring them.
{-# 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