[Hugs-bugs] Char.isUpper undefined
Hi, 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" I guess this is the wrong behaviour? GHCi gets this right. When saved to a file, for example: -- import Char res = Char.isUpper 'a' -- This works fine. This is tested on WinHugs from CVS, if someone could test it on the Linux hugs that would be useful. Thanks Neil
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.
participants (2)
-
Neil Mitchell -
Ross Paterson