def at
import minebender-game@1.0.0.0/LAWS.bend as LAWSimport Base
import minebender-game@1.0.0.0/types.bend as T
19# The value of grid g at p, or d when p is off the grid.
20def at(-A: Data, d: A, g: T.Grid(A), p: T.Pos) -> A:
21 match p:
22 case T.Pos{x, y}:
23 row = Maybe.default(&2, List<&2, A>, List.get(&2, List<&2, A>, g, y), Nil{})
24 Maybe.default(&2, A, List.get(&2, A, row, x), d)