Here's a tip: leave off the type signature, and ask ghci what it is.

$ ghci
Prelude> let contain x [] = False ; contain x (y:ys) = if x == y then
True else contain x ys
Prelude> :t contain
contain :: (Eq a) => a -> [a] -> Bool

  -- ryan

2008/12/22 Raeck Zhao <[email protected]>:
> I am trying to define a containing function to see if a value is one of the
> elements within a list which is polymorphic, but failed with the following
> codes:
>> contain :: a -> [a] -> Bool
>> contain x [] = False
>> contain x (y:ys) = if x == y then True else contain x ys it seems that the
>> problem is the 'operator' == does not support a polymorphic check?
> Any way can solve the problem? or any alternative solution to achieve the
> purpose?
> Thanks!
> Raeck
>
> ________________________________
> It's the same Hotmail(R). If by "same" you mean up to 70% faster. Get your
> account now.
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to