[Haskell-cafe] Re: Rank-2-polymorphism problem

Martin Huschenbett huschi at gmx.org
Sat Mar 24 07:15:37 EDT 2007


apfelmus schrieb:
> For me, the fourth trial works, at least on
> 
>     f :: (forall s . Num s => Maybe s) -> Int
>     f y = case y of
>         Just x  -> x
>         Nothing -> 0

This works, because the compiler knows that x has to have type Int. But 
if you want to apply a function g :: (forall a. Num a => a) -> Int to x 
before returning, it doesn't work any more. But I need this function 
application.

However, thanks for your help.

Regards,

Martin.



More information about the Haskell-Cafe mailing list