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 partOne filepath = do
result <- try (readFile filepath) result <- try (readFile filepath)
case result of case result of
Left readError -> Left readError -> return $ Left (ReadFileError filepath readError)
return $ Left (ReadFileError filepath readError) Right contents -> return $ calculateScore <$> BF.first ParseInputError (parseInput contents)
Right contents ->
return $ calculateScore <$> BF.first ParseInputError (parseInput contents)
where where
-- To calculate the overall score we just need to -- To calculate the overall score we just need to
-- sort the lists and calculate the distances between each element -- sort the lists and calculate the distances between each element