Title: Effective Haskell - Example doesn’t work (page 8)
Middle of page 8 says: "Create a new Main.hs and copy the example below to get started.
module Main where
makeGreeting salutation person =
salutation <> " " <> person
Now load up ghci and test out…"
If I load this file into ghci (or try to compile it), I get errors: "The IO action ‘main’ is not defined in the module ‘Main’.
The text shown is not complete as it doesn’t include a main module. The reader is left to figure out why it doesn’t work.
1 Like
Thanks for pointing out that bug! It will be fixed as soon as the next beta update is released.
Until then, the correct example should be:
module Main where
makeGreeting salutation person =
salutation <> " " <> person
main = print "no salutation to show yet"
I am seeing a different error.
Prelude> :load Main
[1 of 1] Compiling Main ( Main.hs, interpreted )
Main.hs:4:16: error:
• Variable not in scope: (<>) :: t2 -> [Char] -> t0
• Perhaps you meant one of these:
‘<*>’ (imported from Prelude), ‘*>’ (imported from Prelude),
‘>>’ (imported from Prelude)
Main.hs:4:23: error:
• Variable not in scope: (<>) :: t0 -> t1 -> t
• Perhaps you meant one of these:
‘<*>’ (imported from Prelude), ‘*>’ (imported from Prelude),
‘>>’ (imported from Prelude)
Failed, modules loaded: none.
It works if I add import Data.Monoid
after the module declaration