I'm currently learning Haskell (far too many of my question are starting with this statement lately) and im having issues compiling programs due to syntax errors, mainly in identifying the errors, understanding/resolving the error messages provided by GHC.
For example, its just took me a good while to work out the error in the code below. bear in mind that this was taken from a Haskell tutorial book:
getNums = do
putStrLn "enter a number (0 to terminate)"
num <- getLine
if read num == 0
then return []
else do rest <- getNums
return ((read num :: Int):rest)
The GHCI output error message didn't really help either:
Number.hs:18:17:
The last statement in a 'do' block must be an expression
rest <- getNums
I'm currently running GHCI via Linux terminal and compiling manually, coding written in gedit. My question is:
Are there any better environments or setup's available which will provide more in-depth explanation for compile time errors for a beginner like myself?
I.e. something similar to the way the NetBeans IDE will provide hints/tips as to why code is not syntactically correct?
The last thing I want to do is be pasting a code block on SO and being the idiot who says "fix this for me"
EDIT
I appreciate this may not be classed as a very good question because it basically asking peoples opinions.
hlint
andstylish-haskell
are great and installable via cabal. Personally, even though I use SublimeHaskell I prefer to compile and run my code via a terminal, since I just have more direct control over the flow of execution. – bheklilr