[Haskell-cafe] pattern matching on date type

2009-01-01 Thread Max.cs
code seems not working.. foo (Leaf a) = a foo a = Leaf a saying 'Couldn't match expected type `a' against inferred type `Btree a'' any idea? Thanks, Max From: Brandon S. Allbery KF8NH Sent: Thursday, January 01, 2009 7:35 AM To: Max.cs Cc: Brandon S. Allbery KF8NH ; beginn...@haskell.org

[Haskell-cafe] definition of data

2008-12-31 Thread Max.cs
hi all, I want to define a data type Tree a that can either be a or Branch (Tree a) (Tree a)? I tried data Tree a = a | Branch (Tree a) (Tree a) deriving Show but it seems not accpetable in haskell ? any way I could achieve this ? Thanks