AW: AW: simulating dynamic dispatch

Markus.Schnell@infineon.com Markus.Schnell@infineon.com
Mon, 24 Mar 2003 11:08:29 +0100


Thanks! These examples and counterexamples help a lot
in understanding.

Markus


> The reason is that sum only works on integer lists, whereas the given
> type for fun requires that the first argument be a function that works
> on lists of any type, such as length.
> If sum were allowed as argument to fun, then we would also have to be
> allowed to say:
> 
>     fun sum [True, False] [1,2]
> 
> which clearly makes no sense.
> 
> That Hugs refuses to report the type of fun has to with the fact that
> such (rank-2) types cannot be inferred. GHC generally has 
> better support
> for higher-ranked types (no general inference, of course).
> 
> Hope that helped,
> Janis.
> 
> --
> Janis Voigtlaender
> http://wwwtcs.inf.tu-dresden.de/~voigt/
> mailto:voigt@tcs.inf.tu-dresden.de
>