[Hugs-bugs] Char.isUpper undefined

Ross Paterson ross at soi.city.ac.uk
Sun Apr 30 11:22:51 EDT 2006


On Sun, Apr 30, 2006 at 04:04:42PM +0100, Neil Mitchell wrote:
> In Hugs,
> 
> :l Char
> :t isUpper -- works fine
> :t Data.Char.isUpper -- fine
> :t Char.isUpper -- fails
> 
> Char> Char.isUpper 'a'
> ERROR - Undefined qualified variable "Char.isUpper"

It's a subtle consequence of the documented behaviour: the names
in scope at the prompt are those in scope inside the current module.
According to the rules of Haskell 98, inside the Char module, the names
isUpper and Data.Char.isUpper are in scope, but Char.isUpper is not,
because isUpper isn't defined in the module Char.

> I guess this is the wrong behaviour? GHCi gets this right.

GHCi has an extra feature:

	3.4.3.1. Qualified names

	To make life slightly easier, the GHCi prompt also behaves as if
	there is an implicit import qualified declaration for every module
	in every package, and every module currently loaded into GHCi.

> When saved to a file, for example:
> 
> --
> import Char
> res = Char.isUpper 'a'
> --
> 
> This works fine.

Yes, and if you :l that module, Char.isUpper will be in scope.



More information about the Hugs-Bugs mailing list