Create First Program

main
Hammy 4 years ago
parent db2be7b9ac
commit 3cba01ec07

@ -0,0 +1,23 @@
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)
Loading…
Cancel
Save