This commit is contained in:
Victor Martinez 2025-03-12 01:22:59 +01:00
parent 6e55a067dc
commit 14ba05fc6c

View file

@ -27,10 +27,8 @@ partOne :: String -> IO (Either Error Int)
partOne filepath = do
result <- try (readFile filepath)
case result of
Left readError ->
return $ Left (ReadFileError filepath readError)
Right contents ->
return $ calculateScore <$> BF.first ParseInputError (parseInput contents)
Left readError -> return $ Left (ReadFileError filepath readError)
Right contents -> return $ calculateScore <$> BF.first ParseInputError (parseInput contents)
where
-- To calculate the overall score we just need to
-- sort the lists and calculate the distances between each element