Name collisions

Ian Lynagh igloo@earth.li
Sat, 21 Dec 2002 01:48:06 +0000


Hi all

I think this is a hugs bug, but the logic behind the rules in this sort
of case is a bit lost on me.



> module A (foo) where

> foo :: Int
> foo = 5



> module B (foo) where

> import A

> foo :: Int
> foo = 4



ghci says:

B.lhs:2:
    Ambiguous occurrence `foo'
    It could refer to either `A.foo', imported from A at B.lhs:4
                                        (defined at A.lhs:5)
                          or `B.foo', defined at B.lhs:7


hugs (CVS) says:

Hugs session for:
/home/igloo/local/hugs/lib/hugs/libraries/Hugs/Prelude.hs
/home/igloo/local/hugs/lib/hugs/libraries/Prelude.hs
A.lhs
B.lhs
Type :? for help
B> foo
4
B> 

ghci allows it if foo is not in the export list or there is no export
list.


Thanks
Ian