Re: WinHugs extremely basic newbie question
Thorkil Naur <[email protected]> Thu, 6 Sep 2007 20:01:47 +0200
| Newsgroups | gmane.comp.lang.haskell.hugs.user |
|---|---|
| Message-ID | <[email protected]> |
Hello Risto,
I don't have a Windows system myself, and therefore no winhugs, but your=20
problems seem unrelated to winhugs as such, so I will try to indicate how y=
ou=20
might proceed, using my Linux Hugs for illustration.
On Thursday 06 September 2007 14:13, Risto Rangel Kuoppa wrote:
> Hello everyone,
>=20
> 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:
>=20
> Hugs> data Tipo =3D Cruz | Circulo deriving Eq
Quoting from the "The Hugs 98 User's Guide": "The Hugs prompt accepts=20
expressions, but not Haskell definitions." (See=20
http://cvs.haskell.org/Hugs/pages/users_guide/module-commands.html) So if y=
ou=20
wish to work with definitions, you have to put them in a file and either li=
st=20
the file on the hugs command line (this is not winhugs) or load the file fr=
om=20
the hugs promt. Here is what it would look like on a Linux system:
> tn@linux:~/tn/tmp/hugs> cat Risto1.hs
> data Tipo =3D Cruz | Circulo deriving Eq
("cat" is the Linux "type" command.)
> tn@linux:~/tn/tmp/hugs> hugs
> __ __ __ __ ____ ___ _________________________________________
> || || || || || || ||__ Hugs 98: Based on the Haskell 98 standard
> ||___|| ||__|| ||__|| __|| Copyright (c) 1994-2003
> ||---|| ___|| World Wide Web: http://haskell.org/hugs
> || || Report bugs to: [email protected]
> || || Version: November 2003 _________________________________________
>=20
> Haskell 98 mode: Restart with command line option -98 to enable extensions
>=20
> Type :? for help
> Prelude> :load Risto1
> Main> Cruz
> ERROR - Cannot find "show" function for:
> *** Expression : Cruz
> *** Of type : Tipo
>=20
> Main> :type Cruz
> Cruz :: Tipo
> Main>=20
=46rom this, you can see that hugs has indeed "got" the data definition. (T=
o=20
enable values of type Tipo to be printed, you should derive Show in additio=
n=20
to Eq.)
>=20
> But all I get is:
> ERROR - Syntax error in expression (unexpected keyword "data")
> Hugs>
>=20
> I think that I must load some module or library but when I make:
>=20
>=20
> Hugs> :load "C:\\Program
> Files\\WinHugs\\packages\\hugsbase\\Hugs\\Prelude.hs"
>=20
> I get:
> ERROR file:.\Prelude.hs - Module "Hugs.Prelude" already loaded
> Hugs.Prelude>
Here, you are trying to load the standard prelude, but that is loaded alrea=
dy=20
by default, so the error message tells you exactly that. As indicated, you=
=20
should probably create your own file, containing your definitions, and then=
=20
load that.
>=20
> 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=20
information.
I hope that you will be able to get past some of the initial hurdles. If no=
t,=20
or if you have additional questions, please feel free to ask again.
Best regards
Thorkil
> Could=20
> 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.
>=20
> Thanks in advance,
>=20
> Risto
>=20
>=20
>=20
> _______________________________________________
> Hugs-Users mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/hugs-users
>=20