Skip to content

Instantly share code, notes, and snippets.

@5outh
Created January 7, 2013 21:36
Show Gist options
  • Save 5outh/4478700 to your computer and use it in GitHub Desktop.
Save 5outh/4478700 to your computer and use it in GitHub Desktop.
data Tree a = Node a [Tree a] | Leaf a deriving (Show, Eq)
instance Functor Tree where
fmap f (Leaf a) = Leaf $ f a
fmap f (Node a b) = Node (f a) (map (fmap f) b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment