[Haskell-cafe] Writing functions in Haskell.

Ross Paterson ross at soi.city.ac.uk
Fri Apr 29 12:01:53 EDT 2005


On Thu, Apr 28, 2005 at 09:22:15PM -0400, Cale Gibbard wrote:
> The second problem arises from hugs not doing the same thing as ghci
> with respect to looking up qualified variable names (that is, those
> with the module name specified, in this case, the standard module
> Char). You can tell hugs to also load the Char module on top of
> whatever code you have loaded by using the command ":also Char", after
> which the prompt should look like
> Char>
> and you can try
> toUpper 'a'

Might as well use :load -- in both case Char becomes the new current
module, making the old current module inaccessible.

Hal:
Char.toUpper and Char.isLower in Chapter 3 seem to be a perennial
stumbling block for Hugs users -- could you suggest that Hugs users
load Char and just say toUpper and isLower instead?

> (without the Char, hugs doesn't seem to like qualified names, perhaps
> someone else can explain this)

Since you ask: the names in scope at the Hugs prompt are exactly those
in scope inside the current module, which is Char in this case.  Now Char
just imports and re-exports names from Data.Char, so inside Char there is
no Char.toUpper, just toUpper and Data.Char.toUpper.  On the other hand,
inside a module Test that imports Char, you can refer to Char.toUpper
as well as toUpper.


More information about the Haskell-Cafe mailing list