Anupam Jain <ajn...@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.


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife >>= sex)
http://ertes.de/



_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to