Skip to content

Instantly share code, notes, and snippets.

@wavewave
Created May 20, 2014 03:39
Show Gist options
  • Save wavewave/ade81b7576c3765eb1db to your computer and use it in GitHub Desktop.
Save wavewave/ade81b7576c3765eb1db to your computer and use it in GitHub Desktop.
Type level tree
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE GADTs #-}
import GHC.TypeLits
data Tree :: * -> * where
Leaf :: a -> Tree a
Node :: Tree a -> Tree a -> Tree a
data TestType :: Tree Nat -> * where
TestTyp1 :: TestType (Leaf 1)
TestTyp2 :: TestType (Node (Leaf 2) (Leaf 1))
main = return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment