HLearn-algebra-1.1.0.0: Algebraic foundation for homomorphic learning

Safe HaskellNone

HLearn.Algebra.Types.Indexing

Contents

Synopsis

Documentation

class (Eq (IndexType datatype), Bounded (IndexType datatype), Enum (IndexType datatype)) => Index datatype whereSource

index into a data type, all of whose members have the same type

Associated Types

type IndexType datatype Source

type IndexResult datatype Source

Methods

(!) :: datatype -> IndexType datatype -> IndexResult datatypeSource

Instances

(Ord a, Num a) => Index (a, a) 
(Ord a, Num a) => Index (a, a, a) 

class DepIndex datatype index whereSource

index into a data type, but the result type depends on which record we're indexing

Associated Types

type DepIndexResult datatype index Source

Methods

(#) :: datatype -> index -> datatype `DepIndexResult` indexSource

Instances

DepIndex (HList xs) (Nat1Box n) => DepIndex (HList (: * x xs)) (Nat1Box (Succ n)) 
DepIndex (HList (: * x xs)) (Nat1Box Zero) 
DepIndex (HList ([] *)) (Nat1Box Zero) 
DepIndex (a, b) TH_1 
DepIndex (a, b) TH_0 
DepIndex (a, b, c) TH_2 
DepIndex (a, b, c) TH_1 
DepIndex (a, b, c) TH_0 

class IndexList datatype (HList (DepIndexList datatype)) => HasDepIndex datatype whereSource

defines a canonical ordering of all elments in the data type

Associated Types

type DepIndexList datatype :: [*]Source

Methods

depIndexList :: datatype -> HList (DepIndexList datatype)Source

datatype2valueList :: HasDepIndex datatype => datatype -> HList (ValueList datatype)Source

type ValueList datatype = IndexList2ValueList datatype (HList (DepIndexList datatype))Source

template haskell

makeIndex :: Name -> Q [Dec]Source

Creates data types and instances for indexing into a class. Dependent indices are preficed with "TH_" and normal indices by "I_". The dependent indices and DepIndex instances are always created. The normal index data types are always created, but the Index instance is created only if all records within the data type have the same type.

dependent tuple indexing

data TH_0 Source

Instances

DepIndex (a, b) TH_0 
DepIndex (a, b, c) TH_0 

data TH_1 Source

Instances

DepIndex (a, b) TH_1 
DepIndex (a, b, c) TH_1 

data TH_2 Source

Instances

DepIndex (a, b, c) TH_2