Skip to content

Instantly share code, notes, and snippets.

@dmwit
Last active December 14, 2018 15:02
Show Gist options
  • Save dmwit/d9ddce9f90f67e86bba6a8d028789c7e to your computer and use it in GitHub Desktop.
Save dmwit/d9ddce9f90f67e86bba6a8d028789c7e to your computer and use it in GitHub Desktop.
data Zero = Zero deriving Show
data Succ n = Succ deriving Show
class Foo a where foo :: a
instance Foo Zero where foo = Zero
instance Foo n => Foo (Succ n) where foo = Succ
type Two zero = Succ (Succ zero)
type Four zero = Two (Two zero)
type Eight zero = Four (Four zero)
type Sixteen zero = Eight (Eight zero)
type ThirtyTwo zero = Sixteen (Sixteen zero)
type SixtyFour zero = ThirtyTwo (ThirtyTwo zero)
type OneTwentyEight zero = SixtyFour (SixtyFour zero)
type TwoFiftySix zero = OneTwentyEight (OneTwentyEight zero)
main = print (foo :: TwoFiftySix Zero)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment