[Yhc] Re: Issue 122 in project yhc

Thorkil Naur naur at post11.tele.dk
Sat Feb 24 09:37:04 EST 2007


Hello,

On Saturday 24 February 2007 15:02, Neil Mitchell wrote:
> Hi Thorkil,
> 
> I looked at this code a few days ago, and I really couldn't figure out
> what was going on! As far as I can tell:
> 
> Package.hs, line 64:
> 
> case (local,res) of
>     ([x], _) -> return x
>     (_, [x]) -> return x
>     ([], []) -> raiseError $ ErrorFileNone noErrPos askMsg file rs
>     (as, bs) -> raiseError $ ErrorFileMany noErrPos askMsg file (map
> anyOne (as ++ bs))
> ...
> Your patch makes the last case demand (:) for both arguments - since
> case statements in Haskell match top to bottom, that means you'll just
> end up with a crash otherwise. The actual property is that one must be
> non-empty, not both. I really couldn't see what this is failing, but
> I'll have a quick Debug.Trace fest later.
> ...

You are right, my patch is wrong. Here are some additional notes: At some 
point, I had getModule reporting additional information using:

... raiseError $ ErrorFileMany noErrPos (askMsg++" (as,bs)=<"++show 
(as,bs)++">") file (map anyOne (as ++ bs))

This resulted in the following:

Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$ yhc T1.hs
yhc: Error: Found file multiple times, T2
Reason: imported from Main (as,bs)=<([],[])>
Found in:

Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$

This indicates that the ghc-6.6 pattern matching is not working as we expect.

Best regards
Thorkil


More information about the Yhc mailing list