The compiler does its best to tell us when something seems amiss in our code. Let’s intentionally introduce a “mistake” and see what happens.
Remove the closing quotation mark in the hello world program, and save the file.
= putStrLn "hello worldmain
The display in
ghcid now displays an error message.
hello-world.hs:1:29: error: lexical error in string/character literal at character '\n'
The output includes an excerpt from the source file with a marker
^ pointing to the location of the error. This is a particularly useful way to see at a glance where the problem is.
| 1 | main = putStrLn "hello world | ^