Opened 10 years ago

Closed 10 years ago

Last modified 44 years ago

#211 closed bug (Fixed)

hiding does not follow haskell report

Reported by: nobody Owned by: nobody
Priority: normal Milestone:
Component: Compiler Version: 6.0.1
Keywords: Cc:
Operating System: Architecture:
Type of failure: Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Email: mdg@wanadoo.fr

As understand hiding from the Haskell report, it should
hide only the unqualified name and not the qualified name,
e.g., hide head but not Prelude.head (or List.head).  This
is not the case with ghc 6.0.1:

mdg@mdglt:/bug-2111> cat Main.hs 
module Main where

import Prelude hiding (head)

main = do print (Prelude.head [0..])
          head

head = print "head"

mdg@mdglt:/bug-2112> ghc --version        
The Glorious Glasgow Haskell Compilation System,
version 6.0.1

mdg@mdglt:/bug-2113> ghc -fglasgow-exts -o Main --make Main
Chasing modules from: Main
Compiling Main             ( Main.hs, ./Main.o )

Main.hs:5: Variable not in scope: `Prelude.head'

mdg@mdglt:/bug-2114> ghc -o Main --make Main               
Chasing modules from: Main
Compiling Main             ( Main.hs, ./Main.o )

Main.hs:5: Variable not in scope: `Prelude.head'
mdg@mdglt:/bug-2115> runhugs Main
0
"head"

as expected.

Change History (2)

comment:1 Changed 10 years ago by simonpj

  • Status changed from assigned to closed
Logged In: YES 
user_id=50165

Quite right!  Thus bug has been there for ages, but no one 
(including us) noticed.

I'm going to fix the HEAD.  It turns out to be more awkward 
to fix the 6.2 branch, so I'll let it lie.

comment:2 Changed 10 years ago by sigbjorn

Logged In: YES 
user_id=232905

This is not a bug, but expected behaviour. See the examples 
table in Section 5.3.4 of the Haskell 98 report.
Note: See TracTickets for help on using tickets.