[Haskell-beginners] Re: How to import the Data.Char library in Hugs?

Daniel Fischer daniel.is.fischer at web.de
Thu Sep 17 22:52:17 EDT 2009


Am Freitag 18 September 2009 04:27:31 schrieb Benjamin L.Russell:
> On Thu, 17 Sep 2009 15:04:07 +0200, Daniel Fischer
>
> <daniel.is.fischer at web.de> wrote:
> >Am Donnerstag 17 September 2009 14:41:47 schrieb Benjamin L.Russell:
> >> My apologies if this is an extremely elementary question, but I am
> >> having difficulties in importing the Data.Char library in Hugs.
> >
> >Hugs> :a Data.Char
> >Data.Char>
>
> Thank you; that was exactly the information for which I was looking.
>
> Incidentally, what option name does 'a' represent?  That one doesn't
> appear when I type ":?."  Shouldn't it appear in that list?

It should, and it does for me (hugs september 2006):

Hugs> :?
LIST OF COMMANDS:  Any command may be abbreviated to :c where
c is the first character in the full name.

:load <filenames>   load modules from specified files
:load               clear all files except prelude
:also <filenames>   read additional modules         <--- There
:reload             repeat last load command

Unfortunately, Hugs' behaviour is much less convenient than ghci's:

Hugs> :also Data.Char SimplTest
SimplTest> ord 'a'
ERROR - Undefined variable "ord"
SimplTest> Data.Char.ord 'a'
ERROR - Undefined qualified variable "Data.Char.ord"

You can't directly use it, neither qualified nor unqualified, you have to switch contexts 
with :m(odule):

SimplTest> :m Data.Char
Data.Char> ord 'a'
97
Data.Char> :m SimplTest
SimplTest> filter (test 4) $ digl 3
[[0,0,0],[0,1,4],[0,2,8],[1,4,0],[1,5,4],[1,6,8],[2,8,0],[2,9,4]]

>
> -- Benjamin L. Russell



More information about the Beginners mailing list