[Hat] Another hat-trans bug?

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Tue Nov 1 09:46:54 EST 2005


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

> Note in the case statement that the variable fv59v12v59v12n is bound  
> in the second case, but used in the first... As is the variable  
> ftyp.

Well, strictly speaking, those variables are used in the case
discriminant, rather than the first case alternative, but your
point stands.  The variables are not bound until the pattern-match
that follows evaluation of the discriminant.

  i.e. case foo bar of
         (R (foo,bar) baz -> ...

As far as I can see, the fault in hat-trans is due to the combination of
a local pattern deconstruction (the pair), with a numeric pattern (0).

>     where (0, typ) = Map.findWithDefault (0, TLit x) x table

The numeric pattern is translated to a cguard, but the tuple pattern
is translated to a case.  So the numeric pattern cguard tries to use
the value from the tuple case pattern match, whilst itself being the
discriminant of the case.

Olaf's department.  :-)

Regards,
    Malcolm


More information about the Hat mailing list