Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

haskell leksah hello-world

Tags:

haskell

leksah

bad news this morning, I was willing to try and use Leksah (nice looking application by the way) for continuing learning haskell.

I couldnt compile the "Hello World" example I found reading the leksah tutorial.

module Main (
main = putStrLn "Hello World"     
) where

compilation-error: src\Main.hs:16:5: parse error on input='`

and

module Main (
) where
main = putStrLn "Hello World"

compilation-error: src\Main.hs:1:0: The main functionmain' is not exported by module Main'

What would you advise me to try something else ?

IMPORTANT EDIT: Now Leksah is shipped with a file Main.hs, loaded directly the first time you launch leksah, that contains a fully functionnal Hello World mini project. It has also minimalist unit test counter part. Great for beginners :-)

like image 562
Stephane Rolland Avatar asked Jan 12 '11 10:01

Stephane Rolland


1 Answers

The text in the paranthesis after the module name is an export list. This means, that you have to put all functions in the program you want to export in there. But apart from this, you also have to define your main function somewhere. Try this:

module Main (
  main
) where
main = putStrLn "Hello World"

PS: You can also remove the paranthesis and anything in there, than anything in your module is going to be exported.

like image 57
fuz Avatar answered Sep 22 '22 14:09

fuz