Re: [Haskell-beginners] Type Tree variables

(Replying to the list again)
On 11 March 2012 14:15, bahadýr altan
Hi, Thanks for your reply. I tried your solution but my function becomes like this and it gives an error on the right side :
function (Node a (Node b _ _) (Node c _ _)) = (Node c (Node a _ _) (Node b
_ _))
This is not what you originally said though. If you need to refer to the subtrees, you just need to name them. (Instead of using _) [ not a very useful function, but still: ] f :: Tree a -> Tree a f (Node x (Node y y1 y2) (Node z z1 z2)) = Node x (Node y y1 y2) (Node z z1 z2) -- also think about the types: (x, y, z :: a) (y1, y2, z1, z2 :: Tree a)
The thing is I don't need to process the subtrees but I still have to return them as an output. I still can't do that. And I read a few chapters in LYAH, it was pretty good, I learned haskell from there. However, I think the answer of this question isn't in LYAH. Thanks.. Bahadir
-- Ozgur Akgun
participants (1)
-
Ozgur Akgun