[Yhc] Re: Issue 122 in project yhc

Neil Mitchell ndmitchell at gmail.com
Sat Feb 24 09:02:45 EST 2007


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))

The basic idea is that local and res are the local findings of a
module, and res are the remote findings of a module. If there is one
local module that comes first, if there is one remote module that
comes second. If there are no modules this raises an error. The final
branch is that one of as or bs must have a value.

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.

Thinking about it, if you have multiple local files, and one remote
file, that makes it succeed. That's the wrong behaviour! I'll try and
fix that while I'm there.

Thanks

Neil

On 2/24/07, codesite-noreply at google.com <codesite-noreply at google.com> wrote:
>
> Issue 122: yhc reports &quot;Found file multiple times&quot; when file not found
> http://code.google.com/p/yhc/issues/detail?id=122
>
> New issue report by thorkilnaur:
> What steps will reproduce the problem?
> Here is a session that illustrates the problem:
>
> Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$ cat T1.hs
> -- T1.hs: Yhc test program
> module Main where
>   import T2
>   main = putStr ( &quot;Hello Yhc\n&quot; )
> Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$ yhc T1
> yhc: Error: Found file multiple times, T2
> Reason: imported from Main
> Found in:
>
> Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$ ls
> T1.hs
> Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$
>
> What is the expected output? What do you see instead?
> I would expect the message to be &quot;yhc: Error: File not found, T2 ...&quot;
>
> Please use labels and text to provide additional information.
> I have attached a patch that changes the yhc message into:
>
> Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$ yhc T1.hs
> yhc: Error: File not found, T2
> Reason: imported from Main
> Looked in:
>   /Users/thorkilnaur/tn/test/Yhc/multiple/
>   .
>   /Users/thorkilnaur/tn/YhcDarcsRepository/yhc/inst/lib/yhc/packages/haskell98/1.0
>   /Users/thorkilnaur/tn/YhcDarcsRepository/yhc/inst/lib/yhc/packages/yhc-base/1.0
>
> Thorkil-Naurs-Computer:~/tn/test/Yhc/multiple thorkilnaur$
>
> The patch removes a case of overlapping patterns in Package.getModule that causes the wrong
> choice between &quot;Not found&quot; and &quot;Found multiple times&quot; to be taken. I seem to recall that patterns
> are supposed to be tested in the order that they are mentioned, but a quick study of the relevant
> material has not convinced me definitely. But if I do remember correctly, this could indicate an
> error in the ghc-6.6 used to compile Package.hs.
>
> Attachments:
>         Found_file_multiple_times_message_fix.patch  47.1 KB
>
>
> Issue attributes:
>         Status: New
>         Owner: ----
>         Labels: Type-Defect Priority-Medium
>
> --
> You received this message because you are listed in the owner
> or CC fields of this issue, or because you starred this issue.
> You may adjust your issue notification preferences at:
> http://code.google.com/hosting/settings
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups "yhc-bugtrack" group.
> To post to this group, send email to yhc-bugtrack at googlegroups.com
> To unsubscribe from this group, send email to yhc-bugtrack-unsubscribe at googlegroups.com
> For more options, visit this group at http://groups.google.com/group/yhc-bugtrack?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>


More information about the Yhc mailing list