curiosity, bug, or just dead code?

Tim Chevalier catamorphism at gmail.com
Mon Sep 10 21:15:20 EDT 2007


On 9/10/07, Claus Reinke <claus.reinke at talk21.com> wrote:
> consider this module, which is accepted by ghci-6.6.1:
>
>     module T where
>     import qualified Prelude as T(length)
>     import Prelude(length)
>     length = 0
>
> there is no way to refer to either length, as both 'length'
> and 'T.length' are ambiguous (ghci complains on uses
> of either name). but is it a bug?
>

This seems like a GHC bug to me. The Haskell 98 report says:
"It is legal for more than one module in scope to use the same
qualifier, provided that all names can still be resolved
unambiguously." (section 5.3.3)
and in this case, T.length is ambiguous as you say, so I think the
module should fail to typecheck.

Cheers,
Tim

-- 
Tim Chevalier * catamorphism.org * Often in error, never in doubt
"Investing in monopoly software is like investing in crack cocaine; it
is the consequential damages, rather than the immediate ones, that
kill you in the end." -- Kent Paul Dolan


More information about the Glasgow-haskell-bugs mailing list