Created
May 20, 2014 03:39
-
-
Save wavewave/ade81b7576c3765eb1db to your computer and use it in GitHub Desktop.
Type level tree
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 #-} | |
| {-# 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