Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- instance Num a => Num (BinTree a) where
- (+) (Leaf a) x = x
- (+) (Branch l r) x = Branch (l + x) r -- (+) l x
- (*) (Leaf a) (Leaf b) = Leaf (a * b)
- (*) (Branch l r) (Branch l1 r1) = Branch (l * l1) (r * r1)
- (*) _ _ = error "neponyal"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement