Created
October 30, 2013 06:35
-
-
Save mxswd/7228041 to your computer and use it in GitHub Desktop.
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 DataKinds, KindSignatures, GADTs, RankNTypes #-} | |
| data K = X | Y | |
| data Box (a :: K) where | |
| Box :: Box a | |
| class Foo (a :: K) where | |
| name :: Box a -> String | |
| instance Foo X where | |
| name _ = "X" | |
| instance Foo Y where | |
| name _ = "Y" | |
| main = do | |
| putStrLn $ aName (Box :: Box X) | |
| aName :: Box a -> String | |
| -- shouldn't need the Foo since K is closed | |
| -- aName :: Foo a => Box a -> String | |
| aName = name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment