grids-0.5.0.0

Safe HaskellNone
LanguageHaskell2010

Data.Grid.Internal.NestedLists

Synopsis

Documentation

type family NestedLists (dims :: [Nat]) a where ... Source #

Computes the level of nesting requried to represent a given grid dimensionality as a nested list

NestedLists [2, 3] Int == [[Int]]
NestedLists [2, 3, 4] Int == [[[Int]]]

Equations

NestedLists '[] a = a 
NestedLists (_ ': xs) a = [NestedLists xs a] 

chunkVector :: forall a. Int -> Vector a -> [Vector a] Source #

class Sizable (dims :: [Nat]) where Source #

Represents valid dimensionalities. All non empty lists of Nats have an instance

Methods

nestLists :: Proxy dims -> Vector a -> NestedLists dims a Source #

unNestLists :: Proxy dims -> NestedLists dims a -> [a] Source #

gridSize :: Proxy dims -> Int Source #

Get the total size of a Grid of the given dimensions

gridSize (Proxy @'[2, 2]) == 4
Instances
(KnownNat x, Sizable (y ': xs)) => Sizable (x ': (y ': xs)) Source # 
Instance details

Defined in Data.Grid.Internal.NestedLists

Methods

nestLists :: Proxy (x ': (y ': xs)) -> Vector a -> NestedLists (x ': (y ': xs)) a Source #

unNestLists :: Proxy (x ': (y ': xs)) -> NestedLists (x ': (y ': xs)) a -> [a] Source #

gridSize :: Proxy (x ': (y ': xs)) -> Int Source #

KnownNat x => Sizable (x ': ([] :: [Nat])) Source # 
Instance details

Defined in Data.Grid.Internal.NestedLists

Methods

nestLists :: Proxy (x ': []) -> Vector a -> NestedLists (x ': []) a Source #

unNestLists :: Proxy (x ': []) -> NestedLists (x ': []) a -> [a] Source #

gridSize :: Proxy (x ': []) -> Int Source #