[Haskell-cafe] Problem with types
es at ertes.de
Fri Aug 19 14:59:57 CEST 2011
Anupam Jain <ajnsit at gmail.com> wrote:
> However, if I try to parameterise over the function 'f' it does not
> work! -
> p f = (m1',m2') where
> m1 = M ("1", ())
> m2 = M ("2", True)
> m1' = f m1
> m2' = f m2
> It doesn't even typecheck, producing the error - "Couldn't match
> expected type 'Bool' with actual type '()'"
> Is there a particular reason for this? How can I define a function
> like 'p' within Haskell?
Try to write the type signature for 'p'.
And as a general advice: Always write type signatures.
nightmare = unsafePerformIO (getWrongWife >>= sex)
More information about the Haskell-Cafe