Skip to content

Instantly share code, notes, and snippets.

@jagajaga
Created November 7, 2014 23:28
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 jagajaga/7f494f57ee0fe42363eb to your computer and use it in GitHub Desktop.
Save jagajaga/7f494f57ee0fe42363eb to your computer and use it in GitHub Desktop.
class HasHeight a where
height :: a -> Int
data Tree = Leaf | Node {_height :: Int}
instance HasHeight Tree where
height Leaf = 0
height a = _height a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment