Re: Another hat-trans bug?

Malcolm Wallace <[email protected]> Tue, 1 Nov 2005 14:46:54 +0000
Newsgroups gmane.comp.lang.haskell.hat
Organization Dept of Computer Science, University of York
Message-ID <[email protected]>
Thomas Davie <[email protected]> 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