> Paul Saxton wrote:
> 
> Hello!
> 
> I am a student attempting to do some programming with HUGS.  I have downloaded you 
>FEB
> 2000 build and all I want it to do is to run a program from a file.  I tried to put 
>the
> following into a normal text file [1,3,5]!!2
> This did not work, HUGS said
> 
> "ERROR "d.txt" (line 1): Syntax error in declaration (unexpected '}', possibly due to
> bad layout)
> 
> I have even trying running the program with an EMPTY file and it still does it!  
>This is
> very annoying please can you tell me what is going on!  I need a reply asap.

Hi Paul,

Here are a few pointers about using Hugs. There is more information
in the documentation, found at the downloads page on 

        http://www.haskell.org/hugs

(1) All Haskell programs go in files with suffix .hs or .lhs
[Like all C files go into files with .c suffix]

.hs are traditional Haskell programs
.lhs are literate Haskell programs (we'll ignore these for now,
      and stick with .hs file).

(2) When you start runhugs, it looks for the function main,
and "runs" it. 

So the file "Main.hs" might contain

main = print ([1,2,3] !! 2)

and you might type 

runhugs Main.hs

(3) But for learning, the hugs interpreter is useful. It gives
you a prompt that you can type expressions at. For example,
after starting up hugs, you might see:

Type :? for help
Prelude>                <-- the prompt

If you type  [1,2,3] !! 2
Hugs will say

3
Prelude>                <-- new prompt

Good Luck!

-- Andy Gill

Reply via email to