# Pastebin yS4bux1k gridScanner :: Monoid m => Grid -> Point -> (Int -> [Int] -> m) -> m gridScanner g p f = foldMap (f height . lookups) (scan <$> [minBound..]) where height = digitToInt . Grid.b2c $ Grid.unsafeLookup g p scan dir = takeWhile (Grid.inRange g) . tail . iterate (fwd dir) $ p lookups = mapMaybe (fmap (digitToInt . Grid.b2c) . Grid.lookup g)