tensor-0.3.0.1: A completely type-safe library for linear algebra

Portabilitynon-portable
Stabilityexperimental
MaintainerNicola Squartini <tensor5@gmail.com>
Safe HaskellSafe-Inferred

Data.TypeList

Description

The Module Data.TypeList is a collection of classes to manipulate lists of types, a.k.a. heterogeneous lists. Check the module Data.TypeList.MultiIndex for a concrete implementation of TypeList.

Synopsis

Documentation

class TypeList l whereSource

Every TypeList has a Length. The Length is actually a type, and should be a Cardinal (see Data.Cardinal).

Associated Types

type Length l Source

Methods

length :: l -> Length lSource

Instances

class TypeList l => HeadTail l whereSource

Associated Types

type Head l Source

type Tail l Source

Methods

head :: l -> Head lSource

tail :: l -> Tail lSource

(.|.) :: Head l -> Tail l -> lSource

Instances

TypeList l => HeadTail (:|: e l) 

class Component l n whereSource

Extracts the n-th component of the list l

Associated Types

type l :!!: n Source

Methods

(!!) :: l -> n -> l :!!: nSource

The second argument of !! should always be undefined :: n.

partialMap :: n -> ((l :!!: n) -> l :!!: n) -> l -> lSource

Applies the given function to one component of the list.

Instances

HeadTail l => Component l Zero 
(HeadTail l, Component (Tail l) n) => Component l (Succ n) 

class (TypeList l, TypeList l') => AppendList l l' whereSource

A class for appending two TypeLists. The result of appending l and l' has type l :++: l'.

Associated Types

type l :++: l' Source

Methods

(<++>) :: l -> l' -> l :++: l'Source

Instances

TypeList l => AppendList Nil l 
AppendList l l' => AppendList (:|: e l) l' 

class (Cardinal n, TypeList l) => TakeList n l whereSource

This is does for TakeList what take does for ordinary lists.

Associated Types

type Take n l Source

Methods

take :: n -> l -> Take n lSource

Instances

class (Cardinal n, TypeList l) => DropList n l whereSource

This is does for TakeList what drop does for ordinary lists.

Associated Types

type Drop n l Source

Methods

drop :: n -> l -> Drop n lSource

Instances

class (TypeList l, TypeList l') => TailRevList l l' whereSource

Reverse l and append it in front of l'.

Associated Types

type TailRev l l' Source

Methods

rev :: l -> l' -> TailRev l l'Source

Instances

TypeList l => TailRevList Nil l 
(TailRevList l (:|: e l'), TypeList l') => TailRevList (:|: e l) l' 

class TypeList l => ReverseList l whereSource

Reverse the TypeList l, and get Reverse l.

Associated Types

type Reverse l Source

Methods

reverse :: l -> Reverse lSource

Instances

class JoinList n l l' whereSource

Join together TypeLists l and l' where the last n types of l coincide with the first n types of l'. The result has a the common n types eliminated.

Associated Types

type Join n l l' Source

Methods

join :: n -> l -> l' -> Join n l l'Source

Instances

(ReverseList (Drop n (Reverse l)), DropList n (Reverse l), ReverseList l, AppendList (Reverse (Drop n (Reverse l))) (Drop n l'), DropList n l', ~ * (Reverse (Take n (Reverse l))) (Take n l')) => JoinList n l l' 

class Extend l l' whereSource

Extend the list l to l' by adding the necessary extension Ext l l'.

Associated Types

type Ext l l' Source

Methods

extend :: l -> Ext l l' -> l'Source

Instances

Extend Nil l' 
Extend l l' => Extend (:|: e l) (:|: e l')