[Haskell-cafe] Trouble with function with two clauses

Fernando Rodriguez frr149 at easyjob.net
Wed Jan 9 13:15:33 EST 2008


Hi,

I have the following type and function:

data ConsCell a = Nil | Cons a (ConsCell a) deriving Show
head' Nil = Nothing
head' (Cons a _) = Just a

Works fine, however, what's wrong with the following function?

head'' 
	| Nil = Nothing
	| Cons a _ = Just a

Thanks!





More information about the Haskell-Cafe mailing list