Open jtanguy opened 12 years ago
Instead of defining a Tree as a data, we could define it as a typeclass:
class Tree a where eval :: Tree -> a derive :: Tree -> Tree replace :: Tree -> a -> Tree clean :: Tree -> Tree
And then define leaves, unary and binary operators as instances of Tree Float
Tree Float
Good idea. I'll do that this evening. I'll try to make tree an instance of Foldable as well.
Instead of defining a Tree as a data, we could define it as a typeclass:
And then define leaves, unary and binary operators as instances of
Tree Float