Content
We’ll start off with a really simple program that opens a file called girlfriend.txt, which contains a verse from Avril Lavigne’s 1 hit Girlfriend, and just prints out out to the terminal. Here’s girlfriend.txt: Hey! Hey! You! You! I don’t like your girlfriend! No way! No way! I think you need a new one! And here’s our program: import System.I0 main do handle – openFile "girlfriend.txt" ReadMode contents – hGetContents handle putStr contents Close handle Running it, we get the expected result: runhaskell girlfriend.hs Hey! Hey! You! You! I don’t like your girlfriend! No way! No way! I think you need a new one! Let’s go over this line by line. The first line is just four exclamations, to get our attention. In the second line, Avril tells us that she doesn’t like our current romantic partner. The third line serves to emphasize that disapproval, whereas the fourth line suggests we should seek out a new girlfriend. Let’s also go over the program line by line! Our program is several IO ProarammerHumor.io