Created
March 6, 2013 20:56
-
-
Save exterm/5102979 to your computer and use it in GitHub Desktop.
Example for Phantom Types in Haskell
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
data PList a b = Nil | |
| Cons a (PList a b) | |
test :: PList Int String | |
test = Cons 3 $ Cons 2 $ Cons 1 Nil | |
data Foo = Foo | |
test2 :: PList Int Foo | |
test2 = Cons 3 $ Cons 2 $ Cons 1 Nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment