This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addAuthor a (Book b as) = Book b ((createAuthor a [b]):as) | |
addBook b (Author a bs) = Author a ((createBook b [a]):bs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module LineEndingConverter | |
where | |
-- splits a string into substrings based on the newlines | |
-- and handles both windows and unix style line endings | |
splitLines [] = [] | |
splitLines string = firstLine : remainingLines | |
where | |
(firstLine, rest) = break carriageReturnOrLineFeed string | |
remainingLines = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import System.Environment (getArgs) | |
import LineEndingConverter | |
main = | |
do | |
args <- getArgs | |
case args of | |
[input,output] -> | |
transformFileWith transformerFunction input output |