ersatz
ersatz copied to clipboard
rows, colums of relation
I sometimes want to convert between R.Relation a b and [[Bit]]. It's easy to write
rows b =
let ((u,l),(o,r)) = R.bounds b
in flip map (A.range (u,o)) $ \ x ->
flip map (A.range (l,r)) $ \ y ->
b R.! (x,y)
but it could be in the library.
Actually, it already is, sort of, but hidden in the implementation of https://hackage.haskell.org/package/ersatz-0.5/docs/src/Ersatz.Relation.Data.html#table