Skip to content

Instantly share code, notes, and snippets.

@MgaMPKAy
Created April 11, 2012 03:10
Show Gist options
  • Save MgaMPKAy/2356600 to your computer and use it in GitHub Desktop.
Save MgaMPKAy/2356600 to your computer and use it in GitHub Desktop.
module Path where
data Tree a = Empty
| Node a (Tree a) (Tree a)
deriving (Eq, Show)
paths Empty = []
paths (Node x Empty Empty) = [[x]]
paths (Node x l r) = concat [ map (x:) (paths l), map (x:) (paths r)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment