Skip to content

Instantly share code, notes, and snippets.

@mxswd
Created October 30, 2013 06:35
Show Gist options
  • Select an option

  • Save mxswd/7228041 to your computer and use it in GitHub Desktop.

Select an option

Save mxswd/7228041 to your computer and use it in GitHub Desktop.
{-# 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