[Haskell-cafe] pattern matching on date type

2009-01-01 Thread Max.cs
thanks! suppose we have data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving Show and how I could define a function foo :: a - Tree a that foo a = Leaf a where a is not a type of Tree foo b = b where b is one of the type of Tree (Leaf or Branch) ? The following

Re: [Haskell-cafe] pattern matching on date type

2009-01-01 Thread Bulat Ziganshin
Hello Max.cs, Thursday, January 1, 2009, 11:36:24 AM, you wrote: seems that you come from dynamic languages :) Haskell has static typing meaning that your function can accept either Tree or a as arguments. so you should convert a to Tree explicitly, using Leaf thanks!