[Haskell-beginners] function parameter types after flip

Robert Ziemba rziemba at gmail.com
Thu Aug 13 11:25:07 EDT 2009


Can anyone help me understand the behavior of the following
expressions in ghci?  I was trying to construct a flipped function
'elem' that would accept a list of characters first but I ran into
this problem with the type signature. Thank you.

Prelude Data.List Data.Char> :t elem
elem :: (Eq a) => a -> [a] -> Bool              -- OK
Prelude Data.List Data.Char> :t (flip elem)
(flip elem) :: (Eq a) => [a] -> a -> Bool       -- OK this is what I want
Prelude Data.List Data.Char> let fElem = (flip elem)
Prelude Data.List Data.Char> :t fElem
fElem :: [()] -> () -> Bool                           -- ?? Function
will not accept a [Char]


More information about the Beginners mailing list