I'm having trouble getting "hello world" going with eclipseFP and Haskell.
I have the following code,
module Main where
main = putStr "Hello world!"
and when I compile it with
ghc.exe .\H1.hs -o hw.exe
it works fine, but under eclipseFP, when I run it I only see the following in the console window:
GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Ok, modules loaded: Main.
Prelude Main>
What mistakes am I making?
I haven't used EclipseFP in years, so bear that in mind.
What appears to be happening is that EclipseFP is loading GHCi in the console.
GHCi is an interactive Haskell shell, in which you can evaluate simple expressions. It also apparently loaded your module Main
, so you can use GHCi to call functions in your module.
If you type in :main
in the console, it will run you program and print "Hello world!", you could also call other functions you define in your program or standard Haskell functions.
However, what you may want to do is set EclipseFP to execute your program when you run, and I can't remember how to do that, probably somewhere in the "Run" menu.
In the project explorer click on your project and then click the right mouse button and select Run As > Run Configurations > Run As Haskell Application
.
Never used eclipse but what you see is ghci, GHCi is GHC's interactive environment. Your module was loaded successfully in ghci, you can type main in ghci to run the function main of your program, actually you can call any function of your program that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With