diff options
| author | Andreas Grois <andi@grois.info> | 2023-12-07 20:26:51 +0100 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2023-12-07 20:26:51 +0100 |
| commit | 8d6efb1c1fdddc1fbad167510ce25e56be684130 (patch) | |
| tree | f35cf0d4943ccb397f3d0a91ad8a1cb1116eccdd /Main.lean | |
| parent | 9fb83b22220c825943549bc97bdab457bfad7f5b (diff) | |
Allow error messages in parsing (for debugging)
And fix an off-by-one in day 5
Diffstat (limited to 'Main.lean')
| -rw-r--r-- | Main.lean | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -9,10 +9,7 @@ open DayPart def try_run_day_part (day : Days) (part : Parts) (data : String) : IO String := let impl : {ι : Type} → (d : Days) → (p : Parts) → String → [Parse d (ι := ι)] → [Part d p (ι := ι)] → IO String := λ day part data ↦ do - let instructions ← if let some instructions := Parse.parse day data then - pure instructions - else - throw $ IO.userError "Failed to parse input file." + let instructions ← IO.ofExcept $ Parse.parse day data if let some result := (Part.run day part instructions).map ToString.toString then pure result else |
