Skip to content

Instantly share code, notes, and snippets.

@kazu-yamamoto
Created October 30, 2012 02:11
Show Gist options
  • Save kazu-yamamoto/3977911 to your computer and use it in GitHub Desktop.
Save kazu-yamamoto/3977911 to your computer and use it in GitHub Desktop.
多相再帰
data Bin a = Bin a a deriving Show
data List a = Nil | Cons a (List (Bin a)) deriving Show
len :: List a -> Int
len Nil = 0
len (Cons _ t) = 1 + 2 * len t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment