import ambiguity

Dean Herington heringto@cs.unc.edu
Wed, 23 Oct 2002 13:14:37 -0400


With the program:

import Exception
main = let catch = Prelude.catch in catch (print "ok") print

hugs 98 version 20021021 gives:

__   __ __  __  ____   ___
_________________________________________
||   || ||  || ||  || ||__      Hugs 98: Based on the Haskell 98
standard
||___|| ||__|| ||__||  __||     Copyright (c) 1994-2002
||---||         ___||           World Wide Web: http://haskell.org/hugs
||   ||                         Report bugs to: hugs-bugs@haskell.org
||   || Version: 20021021
_________________________________________

Haskell 98 mode: Restart with command line option -98 to enable
extensions

Reading file "/stotts2/epa1/hugs98-Oct2002/rel/lib/hugs/lib/Prelude.hs":

Reading file "ImportAmbiguity.hs":
Reading file
"/stotts2/epa1/hugs98-Oct2002/rel/lib/hugs/lib/exts/Exception.hs":
Reading file "ImportAmbiguity.hs":
Dependency analysis
ERROR "ImportAmbiguity.hs":2 - Ambiguous variable occurrence "catch"
*** Could refer to: Prelude.catch Exception.catch

Exception>


whereas GHC accepts the program.  Which system is right?

By the way, hugs98-Dec2001 gives:

Reading file "ImportAmbiguity.hs":
Reading file
"/stotts2/epa1/hugs98-Dec2001/rel/share/hugs/lib/exts/Exception.hs":
Reading file "ImportAmbiguity.hs":
ERROR "ImportAmbiguity.hs" - Entity "catch" imported from module
"Exception" already defined in module "Prelude"