[Haskell-beginners] Defining a containing function on polymorphic list

Raeck Zhao raeck at msn.com
Mon Dec 22 08:51:15 EST 2008





 
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®. If by “same” you mean up to 70% faster.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20081222/b366e3c3/attachment.htm


More information about the Beginners mailing list