[Haskell] GHC inferred type different for pointed/point-free defs?

Bulat Ziganshin bulat.ziganshin at gmail.com
Fri Nov 3 18:45:30 EST 2006


Hello Dan,

Saturday, November 4, 2006, 12:56:31 AM, you wrote:

> 1) I don't understand what I'm doing
> 2) GHC is inferring different types for pointed and
>     point-free function definition.

this is because of famous monomorphism restriction

just two days ago i've published in haskell-cafe code that do that you
want and mich more. for example:

print (True &&& 1 ||| 0)  -- prints 1
print ("" &&& "Yes" ||| "No")  -- prints "No", empty line considered as false condition
print (0 &&& "Non-zero" ||| "Zero") -- integer values treated in C style

-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell mailing list