fixed-vector-hetero-0.3.1.2: Generic heterogeneous vectors

Safe HaskellNone
LanguageHaskell98

Data.Vector.HFixed.Cont

Contents

Description

CPS encoded heterogeneous vectors.

Synopsis

CPS-encoded vector

Type classes

type family Fn (as :: [*]) b Source #

Type family for N-ary function. Types of function parameters are encoded as the list of types.

Instances

type Fn ([] *) b Source # 
type Fn ([] *) b = b
type Fn ((:) * a as) b Source # 
type Fn ((:) * a as) b = a -> Fn as b

newtype Fun as b Source #

Newtype wrapper to work around of type families' lack of injectivity.

Constructors

Fun 

Fields

Instances

Arity xs => Monad (Fun xs) Source # 

Methods

(>>=) :: Fun xs a -> (a -> Fun xs b) -> Fun xs b #

(>>) :: Fun xs a -> Fun xs b -> Fun xs b #

return :: a -> Fun xs a #

fail :: String -> Fun xs a #

Arity xs => Functor (Fun xs) Source # 

Methods

fmap :: (a -> b) -> Fun xs a -> Fun xs b #

(<$) :: a -> Fun xs b -> Fun xs a #

Arity xs => Applicative (Fun xs) Source # 

Methods

pure :: a -> Fun xs a #

(<*>) :: Fun xs (a -> b) -> Fun xs a -> Fun xs b #

(*>) :: Fun xs a -> Fun xs b -> Fun xs b #

(<*) :: Fun xs a -> Fun xs b -> Fun xs a #

newtype TFun f as b Source #

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.

Constructors

TFun 

Fields

Instances

Arity xs => Monad (TFun * f xs) Source # 

Methods

(>>=) :: TFun * f xs a -> (a -> TFun * f xs b) -> TFun * f xs b #

(>>) :: TFun * f xs a -> TFun * f xs b -> TFun * f xs b #

return :: a -> TFun * f xs a #

fail :: String -> TFun * f xs a #

Arity xs => Functor (TFun * f xs) Source # 

Methods

fmap :: (a -> b) -> TFun * f xs a -> TFun * f xs b #

(<$) :: a -> TFun * f xs b -> TFun * f xs a #

Arity xs => Applicative (TFun * f xs) Source # 

Methods

pure :: a -> TFun * f xs a #

(<*>) :: TFun * f xs (a -> b) -> TFun * f xs a -> TFun * f xs b #

(*>) :: TFun * f xs a -> TFun * f xs b -> TFun * f xs b #

(<*) :: TFun * f xs a -> TFun * f xs b -> TFun * f xs a #

class Arity (Len xs) => 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.

Methods

accum :: (forall a as. t (a ': as) -> a -> t as) -> (t '[] -> b) -> t xs -> Fn xs b Source #

Fold over N elements exposed as N-ary function.

apply :: (forall a as. t (a ': as) -> (a, t as)) -> t xs -> ContVec xs Source #

Apply values to N-ary function

applyM :: Monad m => (forall a as. t (a ': as) -> m (a, t as)) -> t xs -> m (ContVec xs) Source #

Apply value to N-ary function using monadic actions

accumTy :: (forall a as. t (a ': as) -> f a -> t as) -> (t '[] -> b) -> t xs -> Fn (Wrap f xs) b Source #

Analog of accum

applyTy :: (forall a as. t (a ': as) -> (f a, t as)) -> t xs -> ContVecF xs f Source #

Analog of apply which allows to works with vectors which elements are wrapped in the newtype constructor.

arity :: p xs -> Int Source #

Size of type list as integer.

witWrapped :: WitWrapped f xs Source #

witConcat :: Arity ys => WitConcat xs ys Source #

witNestedFun :: WitNestedFun xs ys r Source #

witLenWrap :: WitLenWrap f xs Source #

Instances

Arity ([] *) Source # 

Methods

accum :: (forall a as. t ((* ': a) as) -> a -> t as) -> (t [*] -> b) -> t [*] -> Fn [*] b Source #

apply :: (forall a as. t ((* ': a) as) -> (a, t as)) -> t [*] -> ContVec [*] Source #

applyM :: Monad m => (forall a as. t ((* ': a) as) -> m (a, t as)) -> t [*] -> m (ContVec [*]) Source #

accumTy :: (forall a as. t ((* ': a) as) -> f a -> t as) -> (t [*] -> b) -> t [*] -> Fn (Wrap * * f [*]) b Source #

applyTy :: (forall a as. t ((* ': a) as) -> (f a, t as)) -> t [*] -> ContVecF * [*] f Source #

arity :: p [*] -> Int Source #

witWrapped :: WitWrapped f [*] Source #

witConcat :: Arity ys => WitConcat [*] ys Source #

witNestedFun :: WitNestedFun [*] ys r Source #

witLenWrap :: WitLenWrap f [*] Source #

Arity xs => Arity ((:) * x xs) Source # 

Methods

accum :: (forall a as. t ((* ': a) as) -> a -> t as) -> (t [*] -> b) -> t ((* ': x) xs) -> Fn ((* ': x) xs) b Source #

apply :: (forall a as. t ((* ': a) as) -> (a, t as)) -> t ((* ': x) xs) -> ContVec ((* ': x) xs) Source #

applyM :: Monad m => (forall a as. t ((* ': a) as) -> m (a, t as)) -> t ((* ': x) xs) -> m (ContVec ((* ': x) xs)) Source #

accumTy :: (forall a as. t ((* ': a) as) -> f a -> t as) -> (t [*] -> b) -> t ((* ': x) xs) -> Fn (Wrap * * f ((* ': x) xs)) b Source #

applyTy :: (forall a as. t ((* ': a) as) -> (f a, t as)) -> t ((* ': x) xs) -> ContVecF * ((* ': x) xs) f Source #

arity :: p ((* ': x) xs) -> Int Source #

witWrapped :: WitWrapped f ((* ': x) xs) Source #

witConcat :: Arity ys => WitConcat ((* ': x) xs) ys Source #

witNestedFun :: WitNestedFun ((* ': x) xs) ys r Source #

witLenWrap :: WitLenWrap f ((* ': x) xs) Source #

class Arity (Elems v) => HVector v where Source #

Type class for heterogeneous vectors. Instance should specify way to construct and deconstruct itself

Note that this type class is extremely generic. Almost any single constructor data type could be made instance. It could be monomorphic, it could be polymorphic in some or all fields it doesn't matter. Only law instance should obey is:

inspect v construct = v

Default implementation which uses Generic is provided.

Associated Types

type Elems v :: [*] Source #

Methods

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

Associated Types

type Elems () :: [*] Source #

Methods

construct :: Fun (Elems ()) () Source #

inspect :: () -> Fun (Elems ()) a -> a Source #

HVector (Complex a) Source # 

Associated Types

type Elems (Complex a) :: [*] Source #

Methods

construct :: Fun (Elems (Complex a)) (Complex a) Source #

inspect :: Complex a -> Fun (Elems (Complex a)) a -> a Source #

Arity xs => HVector (ContVec xs) Source # 

Associated Types

type Elems (ContVec xs) :: [*] Source #

Methods

construct :: Fun (Elems (ContVec xs)) (ContVec xs) Source #

inspect :: ContVec xs -> Fun (Elems (ContVec xs)) a -> a Source #

Arity xs => HVector (VecList xs) Source # 

Associated Types

type Elems (VecList xs) :: [*] Source #

Methods

construct :: Fun (Elems (VecList xs)) (VecList xs) Source #

inspect :: VecList xs -> Fun (Elems (VecList xs)) a -> a Source #

Arity xs => HVector (HVec xs) Source # 

Associated Types

type Elems (HVec xs) :: [*] Source #

Methods

construct :: Fun (Elems (HVec xs)) (HVec xs) Source #

inspect :: HVec xs -> Fun (Elems (HVec xs)) a -> a Source #

HVector (a, b) Source # 

Associated Types

type Elems (a, b) :: [*] Source #

Methods

construct :: Fun (Elems (a, b)) (a, b) Source #

inspect :: (a, b) -> Fun (Elems (a, b)) a -> a Source #

(Unbox n a, HomArity n a) => HVector (Vec n a) Source # 

Associated Types

type Elems (Vec n a) :: [*] Source #

Methods

construct :: Fun (Elems (Vec n a)) (Vec n a) Source #

inspect :: Vec n a -> Fun (Elems (Vec n a)) a -> a Source #

(Storable a, HomArity n a) => HVector (Vec n a) Source # 

Associated Types

type Elems (Vec n a) :: [*] Source #

Methods

construct :: Fun (Elems (Vec n a)) (Vec n a) Source #

inspect :: Vec n a -> Fun (Elems (Vec n a)) a -> a Source #

(Prim a, HomArity n a) => HVector (Vec n a) Source # 

Associated Types

type Elems (Vec n a) :: [*] Source #

Methods

construct :: Fun (Elems (Vec n a)) (Vec n a) Source #

inspect :: Vec n a -> Fun (Elems (Vec n a)) a -> a Source #

HomArity n a => HVector (Vec n a) Source # 

Associated Types

type Elems (Vec n a) :: [*] Source #

Methods

construct :: Fun (Elems (Vec n a)) (Vec n a) Source #

inspect :: Vec n a -> Fun (Elems (Vec n a)) a -> a Source #

(Arity (Wrap * * f xs), Arity xs) => HVector (HVecF xs f) Source #

It's not possible to remove constrain Arity (Wrap f xs) because it's required by superclass and we cannot prove it for all f. witWrapped allow to generate proofs for terms

Associated Types

type Elems (HVecF xs f) :: [*] Source #

Methods

construct :: Fun (Elems (HVecF xs f)) (HVecF xs f) Source #

inspect :: HVecF xs f -> Fun (Elems (HVecF xs f)) a -> a Source #

HVector (a, b, c) Source # 

Associated Types

type Elems (a, b, c) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c)) (a, b, c) Source #

inspect :: (a, b, c) -> Fun (Elems (a, b, c)) a -> a Source #

HVector (a, b, c, d) Source # 

Associated Types

type Elems (a, b, c, d) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d)) (a, b, c, d) Source #

inspect :: (a, b, c, d) -> Fun (Elems (a, b, c, d)) a -> a Source #

HVector (a, b, c, d, e) Source # 

Associated Types

type Elems (a, b, c, d, e) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e)) (a, b, c, d, e) Source #

inspect :: (a, b, c, d, e) -> Fun (Elems (a, b, c, d, e)) a -> a Source #

HVector (a, b, c, d, e, f) Source # 

Associated Types

type Elems (a, b, c, d, e, f) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f)) (a, b, c, d, e, f) Source #

inspect :: (a, b, c, d, e, f) -> Fun (Elems (a, b, c, d, e, f)) a -> a Source #

HVector (a, b, c, d, e, f, g) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g)) (a, b, c, d, e, f, g) Source #

inspect :: (a, b, c, d, e, f, g) -> Fun (Elems (a, b, c, d, e, f, g)) a -> a Source #

HVector (a, b, c, d, e, f, g, h) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h)) (a, b, c, d, e, f, g, h) Source #

inspect :: (a, b, c, d, e, f, g, h) -> Fun (Elems (a, b, c, d, e, f, g, h)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i)) (a, b, c, d, e, f, g, h, i) Source #

inspect :: (a, b, c, d, e, f, g, h, i) -> Fun (Elems (a, b, c, d, e, f, g, h, i)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j)) (a, b, c, d, e, f, g, h, i, j) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k)) (a, b, c, d, e, f, g, h, i, j, k) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l)) (a, b, c, d, e, f, g, h, i, j, k, l) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m)) (a, b, c, d, e, f, g, h, i, j, k, l, m) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) :: [*] Source #

Methods

construct :: Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)) (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) Source #

inspect :: (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) -> Fun (Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) :: [*] Source #

Methods

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)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) :: [*] Source #

Methods

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)) a -> a Source #

HVector (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) Source # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) :: [*] Source #

Methods

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)) a -> a 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 # 

Associated Types

type Elems (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) :: [*] Source #

Methods

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)) a -> a 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 # 

Associated Types

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) :: [*] Source #

Methods

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)) a -> a 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 # 

Associated Types

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) :: [*] Source #

Methods

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)) a -> a 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 # 

Associated Types

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) :: [*] Source #

Methods

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)) a -> a 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 # 

Associated Types

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) :: [*] Source #

Methods

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)) a -> a 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 # 

Associated Types

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') :: [*] Source #

Methods

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')) a -> a 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 # 

Associated Types

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') :: [*] Source #

Methods

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')) a -> a 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 # 

Associated Types

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') :: [*] Source #

Methods

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')) a -> a 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 # 

Associated Types

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') :: [*] Source #

Methods

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')) a -> a 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 # 

Associated Types

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') :: [*] Source #

Methods

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')) a -> a 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 # 

Associated Types

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') :: [*] Source #

Methods

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')) a -> a 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

Minimal complete definition

inspectF, constructF

Associated Types

type ElemsF v :: [*] Source #

Elements of the vector without type constructors

Methods

inspectF :: v f -> TFun f (ElemsF v) a -> a Source #

constructF :: TFun f (ElemsF v) (v f) Source #

Instances

Arity xs => HVectorF (VecListF xs) Source # 

Associated Types

type ElemsF (VecListF xs :: (* -> *) -> *) :: [*] Source #

Methods

inspectF :: VecListF xs f -> TFun * f (ElemsF (VecListF xs)) a -> a Source #

constructF :: TFun * f (ElemsF (VecListF xs)) (VecListF xs f) Source #

Arity xs => HVectorF (HVecF xs) Source # 

Associated Types

type ElemsF (HVecF xs :: (* -> *) -> *) :: [*] Source #

Methods

inspectF :: HVecF xs f -> TFun * f (ElemsF (HVecF xs)) a -> a Source #

constructF :: TFun * f (ElemsF (HVecF xs)) (HVecF xs f) Source #

Arity xs => HVectorF (ContVecF * xs) Source # 

Associated Types

type ElemsF (ContVecF * xs :: (* -> *) -> *) :: [*] Source #

Methods

inspectF :: ContVecF * xs f -> TFun * f (ElemsF (ContVecF * xs)) a -> a Source #

constructF :: TFun * f (ElemsF (ContVecF * xs)) (ContVecF * xs f) Source #

class Arity n => Index n xs Source #

Indexing of vectors

Minimal complete definition

getF, putF, lensF, lensChF, witWrapIndex

Associated Types

type ValueAt n xs :: * Source #

Type at position n

Instances

Arity xs => Index Z ((:) * x xs) Source # 

Associated Types

type ValueAt Z ((:) * x xs :: [*]) :: * Source #

type NewElems Z ((:) * x xs :: [*]) a :: [*] Source #

Methods

getF :: Z -> Fun ((* ': x) xs) (ValueAt Z ((* ': x) xs)) Source #

putF :: Z -> ValueAt Z ((* ': x) xs) -> Fun ((* ': x) xs) r -> Fun ((* ': x) xs) r Source #

lensF :: (Functor f, (* ~ v) (ValueAt Z ((* ': x) xs))) => Z -> (v -> f v) -> Fun ((* ': x) xs) r -> Fun ((* ': x) xs) (f r) Source #

lensChF :: Functor f => Z -> (ValueAt Z ((* ': x) xs) -> f a) -> Fun (NewElems Z ((* ': x) xs) a) r -> Fun ((* ': x) xs) (f r) Source #

witWrapIndex :: WitWrapIndex f Z ((* ': x) xs) Source #

Index n xs => Index (S n) ((:) * x xs) Source # 

Associated Types

type ValueAt (S n) ((:) * x xs :: [*]) :: * Source #

type NewElems (S n) ((:) * x xs :: [*]) a :: [*] Source #

Methods

getF :: S n -> Fun ((* ': x) xs) (ValueAt (S n) ((* ': x) xs)) Source #

putF :: 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))) => S n -> (v -> f v) -> Fun ((* ': x) xs) r -> Fun ((* ': x) xs) (f r) Source #

lensChF :: Functor f => S n -> (ValueAt (S n) ((* ': x) xs) -> f a) -> Fun (NewElems (S n) ((* ': x) xs) a) r -> Fun ((* ': x) xs) (f r) Source #

witWrapIndex :: WitWrapIndex f (S n) ((* ': x) xs) Source #

type family Wrap (f :: α -> β) (a :: [α]) :: [β] Source #

Wrap every element of list into type constructor

Instances

type Wrap β α f ([] α) Source # 
type Wrap β α f ([] α) = [] β
type Wrap β α f ((:) α x xs) Source # 
type Wrap β α f ((:) α x xs) = (:) β (f x) (Wrap β α f xs)

CPS-encoded vector

newtype ContVec xs Source #

CPS-encoded heterogeneous vector.

Constructors

ContVec 

Fields

Instances

Arity xs => HVector (ContVec xs) Source # 

Associated Types

type Elems (ContVec xs) :: [*] Source #

Methods

construct :: Fun (Elems (ContVec xs)) (ContVec xs) Source #

inspect :: ContVec xs -> Fun (Elems (ContVec xs)) a -> a Source #

type Elems (ContVec xs) Source # 
type Elems (ContVec xs) = xs

newtype ContVecF xs f Source #

CPS-encoded partially heterogeneous vector.

Constructors

ContVecF (forall r. TFun f xs r -> r) 

Instances

Arity xs => HVectorF (ContVecF * xs) Source # 

Associated Types

type ElemsF (ContVecF * xs :: (* -> *) -> *) :: [*] Source #

Methods

inspectF :: ContVecF * xs f -> TFun * f (ElemsF (ContVecF * xs)) a -> a Source #

constructF :: TFun * f (ElemsF (ContVecF * xs)) (ContVecF * xs f) Source #

type ElemsF (ContVecF * xs) Source # 
type ElemsF (ContVecF * xs) = xs

Other data types

data VecList :: [*] -> * where Source #

List like heterogeneous vector.

Constructors

Nil :: VecList '[] 
Cons :: x -> VecList xs -> VecList (x ': xs) 

Instances

Arity xs => HVector (VecList xs) Source # 

Associated Types

type Elems (VecList xs) :: [*] Source #

Methods

construct :: Fun (Elems (VecList xs)) (VecList xs) Source #

inspect :: VecList xs -> Fun (Elems (VecList xs)) a -> a Source #

type Elems (VecList xs) Source # 
type Elems (VecList xs) = xs

data VecListF xs f where Source #

List-like vector

Constructors

NilF :: VecListF '[] f 
ConsF :: f x -> VecListF xs f -> VecListF (x ': xs) f 

Instances

Arity xs => HVectorF (VecListF xs) Source # 

Associated Types

type ElemsF (VecListF xs :: (* -> *) -> *) :: [*] Source #

Methods

inspectF :: VecListF xs f -> TFun * f (ElemsF (VecListF xs)) a -> a Source #

constructF :: TFun * f (ElemsF (VecListF xs)) (VecListF xs f) Source #

type ElemsF (VecListF xs) Source # 
type ElemsF (VecListF xs) = xs

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

cvecF :: HVectorF v => v f -> ContVecF (ElemsF v) f Source #

vectorF :: HVectorF v => ContVecF (ElemsF v) f -> v f Source #

Position based functions

head :: forall x xs. Arity xs => ContVec (x ': xs) -> x Source #

Head of vector

tail :: ContVec (x ': xs) -> ContVec xs Source #

Tail of CPS-encoded vector

cons :: x -> ContVec xs -> ContVec (x ': xs) Source #

Cons element to the vector

consF :: f x -> ContVecF xs f -> ContVecF (x ': xs) f Source #

Cons element to the vector

concat :: Arity xs => ContVec xs -> ContVec ys -> ContVec (xs ++ ys) Source #

Concatenate two vectors

Indexing

index :: Index n xs => ContVec xs -> n -> ValueAt n xs Source #

Get value at nth position.

set :: Index n xs => n -> ValueAt n xs -> ContVec xs -> ContVec xs Source #

Set value on nth position.

Constructors

mk1 :: a -> ContVec '[a] Source #

mk2 :: a -> b -> ContVec '[a, b] Source #

mk3 :: a -> b -> c -> ContVec '[a, b, c] Source #

mk4 :: a -> b -> c -> d -> ContVec '[a, b, c, d] Source #

mk5 :: a -> b -> c -> d -> e -> ContVec '[a, b, c, d, e] Source #

Folds and unfolds

foldl :: forall xs c b. ArityC c xs => Proxy c -> (forall a. c a => b -> a -> b) -> b -> ContVec xs -> b Source #

Left fold over vector

foldr :: forall xs c b. ArityC c xs => Proxy c -> (forall a. c a => a -> b -> b) -> b -> ContVec xs -> b Source #

Right fold over vector

unfoldr :: forall xs c b. ArityC c xs => Proxy c -> (forall a. c a => b -> (a, b)) -> b -> ContVec xs Source #

Unfold vector.

Polymorphic values

replicate :: forall xs c. ArityC c xs => Proxy c -> (forall x. c x => x) -> ContVec xs Source #

Replicate polymorphic value n times. Concrete instance for every element is determined by their respective types.

replicateM :: forall xs c m. (ArityC c xs, Monad m) => Proxy c -> (forall x. c x => m x) -> m (ContVec xs) Source #

Replicate monadic action n times.

replicateF :: forall f xs. Arity xs => (forall a. f a) -> ContVecF xs f Source #

zipMono :: forall xs c. ArityC c xs => Proxy c -> (forall a. c a => a -> a -> a) -> ContVec xs -> ContVec xs -> ContVec xs Source #

Zip two heterogeneous vectors

zipMonoF :: forall xs f g h c. 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

zipFold :: forall xs c m. (ArityC c xs, Monoid m) => Proxy c -> (forall a. c a => a -> a -> m) -> ContVec xs -> ContVec xs -> m Source #

Zip vector and fold result using monoid

monomorphize :: forall c xs a. ArityC c xs => Proxy c -> (forall x. c x => x -> a) -> ContVec xs -> ContVec (Len xs) a Source #

Convert heterogeneous vector to homogeneous

monomorphizeF :: forall c xs a f. ArityC c xs => Proxy c -> (forall x. c x => f x -> a) -> ContVecF xs f -> ContVec (Len xs) a Source #

Convert heterogeneous vector to homogeneous

Vector parametrized with type constructor

mapFunctor :: Arity xs => (forall a. f a -> g a) -> ContVecF xs f -> ContVecF xs g Source #

Map functor.

sequence :: (Arity xs, Monad m) => ContVecF xs m -> m (ContVec xs) Source #

Sequence vector's elements

sequenceA :: (Arity xs, Applicative f) => ContVecF xs f -> f (ContVec xs) Source #

Sequence vector's elements

sequenceF :: (Arity xs, Monad m) => ContVecF xs (m `Compose` f) -> m (ContVecF xs f) Source #

Sequence vector's elements

sequenceAF :: (Arity xs, Applicative f) => ContVecF xs (f `Compose` g) -> f (ContVecF xs g) Source #

Sequence vector's elements

distribute :: forall f xs. (Arity xs, Functor f) => f (ContVec xs) -> ContVecF xs f Source #

distributeF :: forall f g xs. (Arity xs, Functor f) => f (ContVecF xs g) -> ContVecF xs (f `Compose` g) Source #

wrap :: Arity xs => (forall a. a -> f a) -> ContVec xs -> ContVecF xs f Source #

Wrap every value in the vector into type constructor.

unwrap :: Arity xs => (forall a. f a -> a) -> ContVecF xs f -> ContVec xs Source #

Unwrap every value in the vector from the type constructor.