Discussion:
[Hugs-users] WinHugs extremely basic newbie question
Risto Rangel Kuoppa
2007-09-06 12:13:46 UTC
Permalink
Hello everyone,

I am having troubles to start using WinHugs. I downloaded it, installed,
and run it. Yet I am unable to run something else than just evaluating
expressions. For example, I am trying to define my first data type with:

Hugs> data Tipo = Cruz | Circulo deriving Eq

But all I get is:
ERROR - Syntax error in expression (unexpected keyword "data")
Hugs>

I think that I must load some module or library but when I make:


Hugs> :load "C:\\Program
Files\\WinHugs\\packages\\hugsbase\\Hugs\\Prelude.hs"

I get:
ERROR file:.\Prelude.hs - Module "Hugs.Prelude" already loaded
Hugs.Prelude>

And I cannot find any Data.hs (Does it actually exist?) anywhere. Could
someone help me with this please? I have already spent several hours
trying to figure it out. All I want is to start testing the tutorials and
learn Haskell but I am missing something to run them with WinHugs.

Thanks in advance,

Risto
Thorkil Naur
2007-09-06 18:01:47 UTC
Permalink
Hello Risto,

I don't have a Windows system myself, and therefore no winhugs, but your
problems seem unrelated to winhugs as such, so I will try to indicate how you
might proceed, using my Linux Hugs for illustration.
Post by Risto Rangel Kuoppa
Hello everyone,
I am having troubles to start using WinHugs. I downloaded it, installed,
and run it. Yet I am unable to run something else than just evaluating
Hugs> data Tipo = Cruz | Circulo deriving Eq
Quoting from the "The Hugs 98 User's Guide": "The Hugs prompt accepts
expressions, but not Haskell definitions." (See
http://cvs.haskell.org/Hugs/pages/users_guide/module-commands.html) So if you
wish to work with definitions, you have to put them in a file and either list
the file on the hugs command line (this is not winhugs) or load the file from
Post by Risto Rangel Kuoppa
data Tipo = Cruz | Circulo deriving Eq
("cat" is the Linux "type" command.)
Post by Risto Rangel Kuoppa
__ __ __ __ ____ ___ _________________________________________
|| || || || || || ||__ Hugs 98: Based on the Haskell 98 standard
||___|| ||__|| ||__|| __|| Copyright (c) 1994-2003
||---|| ___|| World Wide Web: http://haskell.org/hugs
|| || Version: November 2003 _________________________________________
Haskell 98 mode: Restart with command line option -98 to enable extensions
Type :? for help
Prelude> :load Risto1
Main> Cruz
*** Expression : Cruz
*** Of type : Tipo
Main> :type Cruz
Cruz :: Tipo
Main>
From this, you can see that hugs has indeed "got" the data definition. (To
enable values of type Tipo to be printed, you should derive Show in addition
to Eq.)
Post by Risto Rangel Kuoppa
ERROR - Syntax error in expression (unexpected keyword "data")
Hugs>
Hugs> :load "C:\\Program
Files\\WinHugs\\packages\\hugsbase\\Hugs\\Prelude.hs"
ERROR file:.\Prelude.hs - Module "Hugs.Prelude" already loaded
Hugs.Prelude>
Here, you are trying to load the standard prelude, but that is loaded already
by default, so the error message tells you exactly that. As indicated, you
should probably create your own file, containing your definitions, and then
load that.
Post by Risto Rangel Kuoppa
And I cannot find any Data.hs (Does it actually exist?) anywhere.
I am not sure what you are getting at here. Please give some additional
information.

I hope that you will be able to get past some of the initial hurdles. If not,
or if you have additional questions, please feel free to ask again.

Best regards
Thorkil
Post by Risto Rangel Kuoppa
Could
someone help me with this please? I have already spent several hours
trying to figure it out. All I want is to start testing the tutorials and
learn Haskell but I am missing something to run them with WinHugs.
Thanks in advance,
Risto
_______________________________________________
Hugs-Users mailing list
http://www.haskell.org/mailman/listinfo/hugs-users
Loading...