From cbec64cf35a6b85148fb1151acd9373d7ab34168 Mon Sep 17 00:00:00 2001 From: kageru Date: Sun, 1 Dec 2019 10:19:49 +0100 Subject: [PATCH] Change haskell solution to handle bigint input --- 2019/1/day1.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2019/1/day1.hs b/2019/1/day1.hs index 255d7ab..bed4a54 100644 --- a/2019/1/day1.hs +++ b/2019/1/day1.hs @@ -8,10 +8,10 @@ main = do printf "Part 1: %d\n" (fuel input) printf "Part 2: %d\n" (fuelrec input) -fuel :: [Int] -> Int +fuel :: [Integer] -> Integer fuel xs = sum (map (subtract 2 . (`div` 3)) xs) -fuelrec :: [Int] -> Int +fuelrec :: [Integer] -> Integer fuelrec xs = sum (map f xs) - sum xs where f x | x > 0 = x + f ((subtract 2 . (`div` 3)) x) | otherwise = 0