There are several problems, so I will be fine. First, the syntax is:
- You do not want the latter to
putStrLn xbe at a different level of indentation from the rest of your block do. - You do not want to surround
letterwith sentencesingle quotes in the function call.
, :
• '[ Char] ' Char : Char : • "dup", "letter" : dup letter sentence "x: x = dup letter
, letter String, Char. getChar, IO Char, IO String:
main = do
putStrLn "Enter a sentence."
sentence <- getLine
putStrLn "Enter a single letter that is in your sentence, to duplicate."
letter <- getChar
let x = dup letter sentence
putStrLn $ '\n' : x
'\n' x, .
:
ghci>> main
Enter a sentence.
hi
Enter a single letter that is in your sentence, to duplicate.
h
hhi