diff --git a/src/Day4/Part1.idr b/src/Day4/Part1.idr index eb9809a..73a5b10 100644 --- a/src/Day4/Part1.idr +++ b/src/Day4/Part1.idr @@ -63,7 +63,7 @@ checkString board str = go (unpack str) go [] _ _ = True go (c :: cs) pos dir = let Just next = moveDir dir pos - | Nothing => False + | Nothing => False in index next board == c && go cs next dir @@ -88,5 +88,5 @@ export solution : String -> Maybe Nat solution inp = let Just (_ ** _ ** board) = parseInput inp - | Nothing => Nothing + | Nothing => Nothing in Just $ countString board "XMAS" diff --git a/src/Day4/Part2.idr b/src/Day4/Part2.idr index 630bb78..b8fd9a8 100644 --- a/src/Day4/Part2.idr +++ b/src/Day4/Part2.idr @@ -14,7 +14,7 @@ checkMS board pos = let Just [ul, ur, dl, dr] = map (map (`index` board)) $ traverse {t=Vect _} (`moveDir` pos) [UL, UR, DL, DR] - | Nothing => False + | Nothing => False in ((ul == 'M' && dr == 'S') || (ul == 'S' && dr == 'M')) && ((ur == 'M' && dl == 'S') || (ur == 'S' && dl == 'M')) @@ -27,5 +27,5 @@ export solution : String -> Maybe Nat solution inp = let Just (_ ** _ ** board) = parseInput inp - | Nothing => Nothing + | Nothing => Nothing in Just $ countMAS board