Skip to content

Instantly share code, notes, and snippets.

@kseo
Created February 11, 2016 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kseo/cdcca62aaf4623a57d8b to your computer and use it in GitHub Desktop.
Save kseo/cdcca62aaf4623a57d8b to your computer and use it in GitHub Desktop.
Nested types
{-# LANGUAGE FlexibleContexts #-}
data BinaryTree a = Leaf
| InternalNode (BinaryTree a) a (BinaryTree a) deriving Show
data CompleteBinaryTree a = Leaves
| NonLeaves a (CompleteBinaryTree (a,a)) deriving Show
data AList a b = Nil
| Cons a (AList b a) deriving Show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment