[Haskell-beginners] Follow up to reference request

David Frey dpfrey at shaw.ca
Mon Jan 26 17:59:19 EST 2009


On 1/26/2009, "Alan Cameron" <alan.cameron at iname.com> wrote:

>Hi,
>
>I am indebted to Andrew Wagner for pointing me in the direction of the book
>http://book.realworldhaskell.org/read/
>Which I now have time to study. Everything was going fine until I got to the
>section in Getting Started where it gives A Simple Program.
>
>Now as someone who is used to the Windows environment CLI is not my forte.
>Following instructions which appear to be incomplete I created a file of the
>program WC.hs but where should it go?

Put it in any directory you want, but I would suggest putting it in a
directory named "Chapter 1" inside another directory named "Real
World Haskell".


>I tried various places until I reread the :? For the :cd command.
>Ah I said that's what I need to do put it in a folder and change the Dir.
>
>Now I can find the file with the :edit command.
>Did the same with the file quux.txt same place.

It's probably easier to just use the Windows GUI to browse to your
Haskell sources and open them directly in the editor.


>
>Now run the command $ runghc WC < quux.txt
>
><interactive>:1:0: parse error on input '$'
>
>What have I done wrong or not done?

The '$' character is not actually part of the command.  It's just
written in the book so that you know that what follows is a command that
you should type into the command line.

So:

$ ghci File.hs
means
1) Open a console, (terminal, command line prompt or whatever you want to
call it)
2) Use the cd command to go into that directory containing File.hs
3) Type (without quotes) "ghci File.hs" and press enter.

Similarly,
ghci> 2 + 3
means type "2 + 3" followed by enter.


I hope that clears things up a bit.


More information about the Beginners mailing list