[Hat] Any guesses?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Sun Oct 30 04:23:23 EST 2005


Thomas Davie <tom.davie at gmail.com> writes:

> Hat/MySet.hs:636:60:
>      Couldn't match `Hat.Hat.R (Hat.Hat.List a)' against `Hat.Hat.RefExp'
>        Expected type: Hat.Hat.R (Hat.Hat.Fun a b2)
>                       -> Hat.Hat.RefExp
>                       -> Hat.Hat.R (Hat.Hat.Fun b1 (Hat.Hat.List b))
>        Inferred type: Hat.Hat.R (Hat.Hat.Fun a b2)
>                       -> Hat.Hat.R (Hat.Hat.List a)
>                       -> Hat.Hat.RefExp
>                       -> Hat.Hat.R (Hat.Hat.List b2)
>      In the fifth argument of `Hat.Hat.app1', namely `Hat.PreludeBasic.hmap'
>      In the fourth argument of `Hat.Hat.ap2', namely
>          `(Hat.Hat.app1 p391v20v391v29
>                         p391v20v391v27
>                         p
>                         Hat.PreludeBasic.amap
>                         Hat.PreludeBasic.hmap
>                         ff)'

Simplifying, this means it was expecting to be given a function
    R (a->b) -> R (c->[d])
but was actually supplied with hmap of type
    R (a->b) -> R [a] -> R [b]

Now clearly the latter looks more or less correct for map, whilst the
former does not.  For one thing, it has too few arguments.  Judging by
the name, 'hmap' is the worker part of the worker/wrapper split in the
traced map.  So the fault would appear to be that hat-trans is doing an
optimisation incorrectly.  It has called the worker function directly,
believing the call to be saturated, when in fact it is only partially
applied, and it should have called the wrapper instead.  Hence the
differing arities in the error message.

Olaf is the person who will be able to confirm whether this is a correct
diagnosis, and if so, to provide the solution.

Regards,
    Malcolm


More information about the Hat mailing list