[Hat] Hat bug report: Ambiguous occurrence `List'

Fergus Henderson fjh007 at galois.com
Tue Jun 22 06:19:54 EDT 2004


On 22-Jun-2004, Malcolm Wallace <Malcolm.Wallace at cs.york.ac.uk> wrote:
> Fergus Henderson <fjh007 at galois.com> writes:
> 
> >  | Hat/Foo/List.hs:1:
> >  |     Ambiguous occurrence `List'
> >  |     It could refer to either `Hat.Hat.List', imported from Hat.Prelude at
> >  |     Hat/Foo/List.hs:30
> >  |                           or `Hat.Foo.List.List', defined at
> >  |                           Hat/Foo/List.hs:32
> 
> Unfortunately, ghc-6 seems to be rather over-eager to report ambiguous
> use of identifiers, where in fact the usage is not ambiguous (the
> Hat.Hat versions are only visible qualified, whereas your Foo.List
> is visible unqualified).

The Hat.Hat versions are imported unqualified in line 30 of Hat/Foo/List.hs,
which is "import Hat.Prelude".  So I think this is a Hat bug, not a ghc
bug.

> Ideally we will try to find a fix for this.  In the meantime, you
> can work around the bug either by renaming your own versions of the
> overlapping identifiers, or always using them qualified (including
> in export lists).

And including in _implicit_ export lists?

Well, I tried that, but the result was another Hat bug: a pattern match
failure for the following function in src/hattrans/TraceId.hs:

	tyClsInfo :: TraceId -> TyCls
	tyClsInfo (TI _ (Just (TyCls tyCls))) = tyCls

 | bash$ hmake -hat Main.hs
 | hat-trans  Foo/List.hs
 | Creating directories Hat Hat/Foo
 | 
 | Fail: TraceId.hs:152: Non-exhaustive patterns in function tyClsInfo
 |
 | bash$ cat Main.hs
 | import Foo.List
 | main = Foo.List.main
 | 
 | bash$ cat Foo/List.hs
 | module Foo.List(Foo.List,main) where
 | 
 | class List a b where
 |         foo :: a -> b
 | 
 | main :: IO ()
 | main = return ()

-- 
Fergus J. Henderson                 |  "I have always known that the pursuit
Galois Connections, Inc.            |  of excellence is a lethal habit"
Phone: +1 503 626 6616              |     -- the last words of T. S. Garp.


More information about the Hat mailing list