grids-0.3.0.0

Safe HaskellNone
LanguageHaskell2010

Data.Grid.Internal.NestedLists

Synopsis

Documentation

type family AllC (c :: x -> Constraint) (ts :: [x]) :: Constraint where ... Source #

Equations

AllC c '[] = () 
AllC c (x ': xs) = (c x, AllC c xs) 

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 (AllC KnownNat dims, SingI dims, Enum (Coord dims), Bounded (Coord dims)) => Dimensions (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 #

Instances
(KnownNat x, Bounded (Coord xs), SingI xs, Dimensions (y ': xs)) => Dimensions (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 #

KnownNat x => Dimensions (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 #