You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
708 B
Haskell
23 lines
708 B
Haskell
4 years ago
|
toPart :: [Char] -> [Char]
|
||
|
toPart recipient = "Dear " ++ recipient ++ ",\n"
|
||
|
|
||
|
bodyPart :: [Char] -> [Char]
|
||
|
bodyPart bookTitle = "Thanks for Purchasing" ++ bookTitle ++ ".\n"
|
||
|
|
||
|
fromPart :: [Char] -> [Char]
|
||
|
fromPart author = "Thanks, \n" ++ author
|
||
|
|
||
|
createEmail :: [Char] -> [Char] -> [Char] -> [Char]
|
||
|
createEmail recipient bookTitle author = toPart recipient ++
|
||
|
bodyPart bookTitle ++
|
||
|
fromPart author
|
||
|
|
||
|
main :: IO ()
|
||
|
main = do
|
||
|
print "Who is the email for?"
|
||
|
recipient <- getLine
|
||
|
print "What is the Title?"
|
||
|
title <- getLine
|
||
|
print "Who is the Author?"
|
||
|
author <- getLine
|
||
|
print (createEmail recipient title author)
|