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

Benjamin L.Russell DekuDekuplex at Yahoo.com
Fri Sep 18 00:25:43 EDT 2009


On Fri, 18 Sep 2009 04:52:17 +0200, Daniel Fischer
<daniel.is.fischer at web.de> wrote:

>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

Oops; you're right:  The structure of the two commands above it was
the following:

>:load <filenames>   load modules from specified files
>:load               clear all files except prelude

Apparently, for some reason, when I tried to scan through the list, I
subconsciously grouped the two commands below similarly:

>:also <filenames>   read additional modules
>:reload             repeat last load command

Therefore, I somehow only read the second line of what I thought was a
structurally similar second group, and therefore noticed the
":reload," but not the ":also," expecting the command above it to be
":reload <filenames>."

I probably should have either read more slowly (I was rushing out to
lunch at the time), or somehow avoided unconsciously assuming patterns
that didn't exist.

Too much mental pattern-matching ;-).

>
>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]]

Interesting; what happens if I then need to use a higher-order
function composed of other functions, some of which are from different
modules, interactively?

-- Benjamin L. Russell
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
"Furuike ya, kawazu tobikomu mizu no oto." 
-- Matsuo Basho^ 



More information about the Beginners mailing list