summaryrefslogtreecommitdiff
path: root/Day3.lean
diff options
context:
space:
mode:
Diffstat (limited to 'Day3.lean')
-rw-r--r--Day3.lean4
1 files changed, 2 insertions, 2 deletions
diff --git a/Day3.lean b/Day3.lean
index 76c06be..e15e205 100644
--- a/Day3.lean
+++ b/Day3.lean
@@ -78,10 +78,10 @@ private def extractPartNumbers (input : List (Coordinate × Char)) : List PartNu
acc :: helper as none
helper input none
-def parse (schematic : String) : Option Schematic := do
+def parse (schematic : String) : Except String Schematic := do
-- I think this one is easier if we don't split the input in lines. Because:
let charsWithCoordinates ← match schematic.toList with
- | [] => none
+ | [] => throw "Could not pare input: Empty"
| c :: cs => pure $ cs.scan (λ s c ↦ (uncurry Coordinate.nextByChar s, c)) (Coordinate.default, c)
-- Whitespaces are **intentionally** left in. This makes extracting the numbers easier.
pure $ {