-
-
Save pta2002/dfe130522335cf395857fba1e1cbca8e to your computer and use it in GitHub Desktop.
This file contains 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
parseList :: GenParser Char st CalorieList | |
parseList = sepBy (try group) (string "\n\n") | |
group :: GenParser Char st [Int] | |
group = sepBy integer (char '\n') | |
integer :: GenParser Char st Int | |
integer = read <$> many1 digit | |
countCalories :: CalorieList -> [Int] | |
countCalories = map sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment