Title: Effective Haskell (Page 31)

@RebeccaSkinner

At the bottom of page 31 when let is added to the example greeting I cannot get the example to work. I’ve tried rechecking spacing inside the example, made sure I copied the example correctly and put in hours trying to get the example to work. I get different errors every time I try to run it in ghci.

Hey, sorry you’re having a problem! Here’s a working version of the example you can copy and paste:

module Main where

makeGreeting salutation person =
  let messageWithTrailingSpace = salutation <> " "
  in messageWithTrailingSpace <> person

extendedGreeting person =
  let hello = makeGreeting "Hello" person
      goodDay = makeGreeting "I hope you have a nice afternoon" person
      goodBye = makeGreeting "see you later" person
  in hello <> "\n" <> goodDay <> "\n" <> goodBye

main = print $ extendedGreeting "George"

If you can paste your code and the output of the errors I’d be happy to help you spot what’s going on!

Thank you so much for your help.
Ed

Hello Rebecca,

Thanks to your code I was able to get the example to work.

Thank you very much,

Ed