grids-0.4.0.0

Safe HaskellNone
LanguageHaskell2010

Data.Grid.Internal.Nest

Synopsis

Documentation

joinGrid :: Grid dims (Grid ns a) -> Grid (dims ++ ns) a Source #

The inverse of splitGrid, joinGrid will nest a grid from: > Grid outer (Grid inner a) -> Grid (outer ++ inner) a

For example, you can nest a simple 3x3 from smaller [3] grids as follows:

joinGrid (myGrid :: Grid [3] (Grid [3] a)) :: Grid '[3, 3] a

splitGrid :: forall outer inner a from. (from ~ (outer ++ inner), Dimensions from, Dimensions inner, Dimensions outer, NestedLists from a ~ NestedLists outer (NestedLists inner a)) => Grid from a -> Grid outer (Grid inner a) Source #

The inverse of joinGrid, splitGrid outerDims innerDims will un-nest a grid from: > Grid (outer ++ inner) a -> Grid outer (Grid inner a)

For example, you can unnest a simple 3x3 as follows:

splitGrid @'[3] @'[3] myGrid :: Grid '[3] (Grid [3] a)