Safe Haskell | None |
---|---|
Language | Haskell2010 |
CPS encoded heterogeneous vectors.
Synopsis
- type family Fn (f :: α -> *) (as :: [α]) b where ...
- type Fun = TFun Identity
- newtype TFun f as b = TFun {}
- class Arity (xs :: [α]) where
- class Arity (Elems v) => HVector v where
- tupleSize :: forall v proxy. HVector v => proxy v -> Int
- class Arity (ElemsF v) => HVectorF (v :: (α -> *) -> *) where
- tupleSizeF :: forall v f proxy. HVectorF v => proxy (v f) -> Int
- type family ValueAt n xs :: *
- class ArityPeano n => Index (n :: PeanoNum) (xs :: [*])
- type ContVec xs = ContVecF xs Identity
- newtype ContVecF (xs :: [α]) (f :: α -> *) = ContVecF {
- runContVecF :: forall r. TFun f xs r -> r
- data VecList :: [*] -> * where
- data VecListF (xs :: [α]) (f :: α -> *) where
- cvec :: (HVector v, Elems v ~ xs) => v -> ContVec xs
- vector :: (HVector v, Elems v ~ xs) => ContVec xs -> v
- cvecF :: HVectorF v => v f -> ContVecF (ElemsF v) f
- vectorF :: HVectorF v => ContVecF (ElemsF v) f -> v f
- head :: Arity xs => ContVec (x ': xs) -> x
- tail :: ContVec (x ': xs) -> ContVec xs
- cons :: x -> ContVec xs -> ContVec (x ': xs)
- consF :: f x -> ContVecF xs f -> ContVecF (x ': xs) f
- concat :: Arity xs => ContVec xs -> ContVec ys -> ContVec (xs ++ ys)
- index :: Index n xs => ContVec xs -> proxy n -> ValueAt n xs
- set :: Index n xs => proxy n -> ValueAt n xs -> ContVec xs -> ContVec xs
- tyLookup :: TyLookup a xs => ContVec xs -> a
- tyLookupF :: TyLookup a xs => ContVecF xs f -> f a
- foldlF :: ArityC c xs => Proxy c -> (forall a. c a => b -> f a -> b) -> b -> ContVecF xs f -> b
- foldrF :: ArityC c xs => Proxy c -> (forall a. c a => f a -> b -> b) -> b -> ContVecF xs f -> b
- foldlNatF :: Arity xs => (forall a. b -> f a -> b) -> b -> ContVecF xs f -> b
- foldrNatF :: Arity xs => (forall a. f a -> b -> b) -> b -> ContVecF xs f -> b
- unfoldrF :: ArityC c xs => Proxy c -> (forall a. c a => b -> (f a, b)) -> b -> ContVecF xs f
- replicateF :: ArityC c xs => Proxy c -> (forall a. c a => f a) -> ContVecF xs f
- replicateNatF :: Arity xs => (forall a. f a) -> ContVecF xs f
- zipWithF :: ArityC c xs => Proxy c -> (forall a. c a => f a -> g a -> h a) -> ContVecF xs f -> ContVecF xs g -> ContVecF xs h
- zipWithNatF :: Arity xs => (forall a. f a -> g a -> h a) -> ContVecF xs f -> ContVecF xs g -> ContVecF xs h
- zipFoldF :: forall xs c m f. (ArityC c xs, Monoid m) => Proxy c -> (forall a. c a => f a -> f a -> m) -> ContVecF xs f -> ContVecF xs f -> m
- monomorphizeF :: forall c xs a f n. (ArityC c xs, Peano n ~ Len xs) => Proxy c -> (forall x. c x => f x -> a) -> ContVecF xs f -> ContVec n a
- map :: ArityC c xs => Proxy c -> (forall a. c a => f a -> g a) -> ContVecF xs f -> ContVecF xs g
- mapNat :: Arity xs => (forall a. f a -> g a) -> ContVecF xs f -> ContVecF xs g
- sequenceF :: (Arity xs, Applicative f) => ContVecF xs (f `Compose` g) -> f (ContVecF xs g)
- distributeF :: forall f g xs. (Arity xs, Functor f) => f (ContVecF xs g) -> ContVecF xs (f `Compose` g)
CPS-encoded vector
Type classes
type family Fn (f :: α -> *) (as :: [α]) b where ... Source #
Type family for N-ary function. Types of function parameters are encoded as the list of types.
type Fun = TFun Identity Source #
Newtype wrapper to work around of type families' lack of injectivity.
Newtype wrapper for function where all type parameters have same type constructor. This type is required for writing function which works with monads, appicatives etc.
class Arity (xs :: [α]) where Source #
Type class for dealing with N-ary function in generic way. Both
accum
and apply
work with accumulator data types which are
polymorphic. So it's only possible to write functions which
rearrange elements in vector using plain ADT. It's possible to
get around it by using GADT as accumulator (See ArityC
and
function which use it)
This is also somewhat a kitchen sink module. It contains witnesses which could be used to prove type equalities or to bring instance in scope.
:: (forall a as. t (a ': as) -> f a -> t as) | Step function. Applies element to accumulator. |
-> (t '[] -> b) | Extract value from accumulator. |
-> t xs | Initial state. |
-> TFun f xs b |
Fold over N elements exposed as N-ary function.
:: (forall a as. t (a ': as) -> (f a, t as)) | Extract value to be applied to function. |
-> t xs | Initial state. |
-> ContVecF xs f |
Apply values to N-ary function
Size of type list as integer.
class Arity (Elems v) => HVector v where Source #
Type class for product type. Any product type could have instance of this type. Its methods describe how to construct and deconstruct data type. For example instance for simple data type with two fields could be written as:
data A a = A Int a instance HVector (A a) where type Elems (A a) = '[Int,a] construct = TFun $ \i a -> A i a inspect (A i a) (TFun f) = f i a
Another equivalent description of this type class is descibes
isomorphism between data type and
ContVec
, where constuct
implements
ContVec → a
(see vector
) and inspect
implements a → ContVec
(see cvec
)
Istances should satisfy one law:
inspect v construct = v
Default implementation which uses Generic
is provided.
Nothing
construct :: Fun (Elems v) v Source #
Function for constructing vector
construct :: (Generic v, GHVector (Rep v), GElems (Rep v) ~ Elems v) => Fun (Elems v) v Source #
Function for constructing vector
inspect :: v -> Fun (Elems v) a -> a Source #
Function for deconstruction of vector. It applies vector's elements to N-ary function.
inspect :: (Generic v, GHVector (Rep v), GElems (Rep v) ~ Elems v) => v -> Fun (Elems v) a -> a Source #
Function for deconstruction of vector. It applies vector's elements to N-ary function.
Instances
HVector () Source # | Unit is empty heterogeneous vector |
HVector (Complex a) Source # | |
Arity xs => HVector (VecList xs) Source # | |
Arity xs => HVector (HVec xs) Source # | |
HVector (a, b) Source # | |
(Unbox n a, HomArity (Peano n) a, KnownNat n, Peano (n + 1) ~ S (Peano n)) => HVector (Vec n a) Source # | |
(Storable a, HomArity (Peano n) a, KnownNat n, Peano (n + 1) ~ S (Peano n)) => HVector (Vec n a) Source # | |
(Prim a, HomArity (Peano n) a, KnownNat n, Peano (n + 1) ~ S (Peano n)) => HVector (Vec n a) Source # | |
(HomArity (Peano n) a, KnownNat n, Peano (n + 1) ~ S (Peano n)) => HVector (Vec n a) Source # | |
HVector (a, b, c) Source # | |
Arity xs => HVector (ContVecF xs Identity) Source # | |
HVector (a, b, c, d) Source # | |
HVector (a, b, c, d, e) Source # | |
HVector (a, b, c, d, e, f) Source # | |
HVector (a, b, c, d, e, f, g) Source # | |
HVector (a, b, c, d, e, f, g, h) Source # | |
HVector (a, b, c, d, e, f, g, h, i) Source # | |
HVector (a, b, c, d, e, f, g, h, i, j) Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) Source # | |
Defined in Data.Vector.HFixed.Class | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) Source # | |
Defined in Data.Vector.HFixed.Class construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) Source # | |
Defined in Data.Vector.HFixed.Class construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) Source # | |
Defined in Data.Vector.HFixed.Class construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) Source # | |
Defined in Data.Vector.HFixed.Class construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) Source # | |
Defined in Data.Vector.HFixed.Class construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a') Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a') :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a')) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a') Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a') -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a')) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b') Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b') :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b')) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b') Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b') -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b')) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c') Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c') :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c')) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c') Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c') -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c')) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d') Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d') :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d')) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d') Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d') -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d')) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e') Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e') :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e')) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e') Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e') -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e')) a0 -> a0 Source # | |
HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e', f') Source # | |
Defined in Data.Vector.HFixed.Class type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e', f') :: [Type] Source # construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e', f')) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e', f') Source # inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e', f') -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a', b', c', d', e', f')) a0 -> a0 Source # |
class Arity (ElemsF v) => HVectorF (v :: (α -> *) -> *) where Source #
Type class for partially homogeneous vector where every element in the vector have same type constructor. Vector itself is parametrized by that constructor
tupleSizeF :: forall v f proxy. HVectorF v => proxy (v f) -> Int Source #
Number of elements in parametrized product type
class ArityPeano n => Index (n :: PeanoNum) (xs :: [*]) Source #
Indexing of vectors
Instances
Arity xs => Index Z (x ': xs) Source # | |
Defined in Data.Vector.HFixed.Class getF :: proxy Z -> Fun (x ': xs) (ValueAt Z (x ': xs)) Source # putF :: proxy Z -> ValueAt Z (x ': xs) -> Fun (x ': xs) r -> Fun (x ': xs) r Source # lensF :: (Functor f, v ~ ValueAt Z (x ': xs)) => proxy Z -> (v -> f v) -> Fun (x ': xs) r -> Fun (x ': xs) (f r) Source # lensChF :: Functor f => proxy Z -> (ValueAt Z (x ': xs) -> f a) -> Fun (NewElems Z (x ': xs) a) r -> Fun (x ': xs) (f r) Source # | |
Index n xs => Index (S n) (x ': xs) Source # | |
Defined in Data.Vector.HFixed.Class getF :: proxy (S n) -> Fun (x ': xs) (ValueAt (S n) (x ': xs)) Source # putF :: proxy (S n) -> ValueAt (S n) (x ': xs) -> Fun (x ': xs) r -> Fun (x ': xs) r Source # lensF :: (Functor f, v ~ ValueAt (S n) (x ': xs)) => proxy (S n) -> (v -> f v) -> Fun (x ': xs) r -> Fun (x ': xs) (f r) Source # lensChF :: Functor f => proxy (S n) -> (ValueAt (S n) (x ': xs) -> f a) -> Fun (NewElems (S n) (x ': xs) a) r -> Fun (x ': xs) (f r) Source # |
CPS-encoded vector
newtype ContVecF (xs :: [α]) (f :: α -> *) Source #
CPS-encoded partially heterogeneous vector.
ContVecF | |
|
Instances
Arity xs => HVectorF (ContVecF xs :: (α -> Type) -> Type) Source # | |
Arity xs => HVector (ContVecF xs Identity) Source # | |
type ElemsF (ContVecF xs :: (α -> Type) -> Type) Source # | |
Defined in Data.Vector.HFixed.Class | |
type Elems (ContVecF xs Identity) Source # | |
Defined in Data.Vector.HFixed.Class |
Other data types
data VecList :: [*] -> * where Source #
List like heterogeneous vector.
data VecListF (xs :: [α]) (f :: α -> *) where Source #
List-like vector
Conversion to/from vector
cvec :: (HVector v, Elems v ~ xs) => v -> ContVec xs Source #
Convert heterogeneous vector to CPS form
vector :: (HVector v, Elems v ~ xs) => ContVec xs -> v Source #
Convert CPS-vector to heterogeneous vector
Generic API for tuples
Position based functions
concat :: Arity xs => ContVec xs -> ContVec ys -> ContVec (xs ++ ys) Source #
Concatenate two vectors
Indexing
set :: Index n xs => proxy n -> ValueAt n xs -> ContVec xs -> ContVec xs Source #
Set value on nth position.
Folds and unfolds
foldlF :: ArityC c xs => Proxy c -> (forall a. c a => b -> f a -> b) -> b -> ContVecF xs f -> b Source #
Left fold over vector
foldrF :: ArityC c xs => Proxy c -> (forall a. c a => f a -> b -> b) -> b -> ContVecF xs f -> b Source #
Right fold over vector
foldlNatF :: Arity xs => (forall a. b -> f a -> b) -> b -> ContVecF xs f -> b Source #
Left fold over vector
foldrNatF :: Arity xs => (forall a. f a -> b -> b) -> b -> ContVecF xs f -> b Source #
Right fold over vector
unfoldrF :: ArityC c xs => Proxy c -> (forall a. c a => b -> (f a, b)) -> b -> ContVecF xs f Source #
Unfold vector.
Replicate variants
replicateNatF :: Arity xs => (forall a. f a) -> ContVecF xs f Source #
Zip variants
zipWithF :: ArityC c xs => Proxy c -> (forall a. c a => f a -> g a -> h a) -> ContVecF xs f -> ContVecF xs g -> ContVecF xs h Source #
Zip two heterogeneous vectors
zipWithNatF :: Arity xs => (forall a. f a -> g a -> h a) -> ContVecF xs f -> ContVecF xs g -> ContVecF xs h Source #
Zip two heterogeneous vectors
zipFoldF :: forall xs c m f. (ArityC c xs, Monoid m) => Proxy c -> (forall a. c a => f a -> f a -> m) -> ContVecF xs f -> ContVecF xs f -> m Source #
Zip vector and fold result using monoid
Monomorphization of vectors
monomorphizeF :: forall c xs a f n. (ArityC c xs, Peano n ~ Len xs) => Proxy c -> (forall x. c x => f x -> a) -> ContVecF xs f -> ContVec n a Source #
Convert heterogeneous vector to homogeneous
Manipulation with type constructor
map :: ArityC c xs => Proxy c -> (forall a. c a => f a -> g a) -> ContVecF xs f -> ContVecF xs g Source #
Apply transformation to every element of the tuple.
mapNat :: Arity xs => (forall a. f a -> g a) -> ContVecF xs f -> ContVecF xs g Source #
Apply natural transformation to every element of the tuple.