Type-level lists for Flow
.
Install with npm
$ npm install --save-dev flow-type-list
or yarn
$ yarn add flow-type-list
and use it in your project.
import { ... } from 'flow-type-list';
Represents an empty type list.
Represents the joining of a head type and tail List
.
A List<A, B>
is either Nil
or Cons<A, B>
.
Utility type that returns the type of the head element of the given type list.
Utility type that returns the type of the tail type list of the given type list.
Represents a list with one type.
Represents a list with two types.
Represents a list with three types.
Represents a list with four types.
Represents a list with five types.
Represents a list with six types.
Utility type that returns the first type in the given type List
.
Utility type that returns the second type in the given type List
.
Utility type that returns the third type in the given type List
.
Utility type that returns the fourth type in the given type List
.
Utility type that returns the fifth type in the given type List
.
Utility type that returns the sixth type in the given type List
.
Utility type that swaps the given type into the first position of the given List
.
Utility type that swaps the given type into the second position of the given List
.
Utility type that swaps the given type into the third position of the given List
.
Utility type that swaps the given type into the fourth position of the given List
.
Utility type that swaps the given type into the fifth position of the given List
.
Utility type that swaps the given type into the sixth position of the given List
.
<A, B: List<any, any>>(a: A, b: B) => Cons<A, B>
Joins the given value and List
into a new List
.
<A, B: List<any, any>>(cons: Cons<A, B>) => [A, B]
Separates the head value and tail List
of the given List
.
<A>(cons: Cons<A, any>) => A
Returns the head value of the given List
.
<B: List<any, any>>(cons: Cons<any, B>) => B
Returns the tail List
of the given List
.
<A>(list: List<A, any>) => A
Returns the first value in the given List
.
<B>(list: List<any, List<B, any>>) => B
Returns the second value in the given List
.
<C>(list: List<any, List<any, List<C, any>>>) => C
Returns the third value in the given List
.
<D>(list: List<any, List<any, List<any, List<D, any>>>>) => D
Returns the fourth value in the given List
.
<E>(list: List<any, List<any, List<any, List<any, List<E, any>>>>>) => E
Returns the fifth value in the given List
.
<F>(list: List<any, List<any, List<any, List<any, List<any, List<F, any>>>>>>) => F
Returns the sixth value in the given List
.
<A>(a: A) => Cons<A, Nil>
Creates a list with one value.
<A>(list: Cons<A, any>) => [A]
Deconstructs a List
with one value.
<A, B>(a: A, b: B) => Cons<A, Cons<B, Nil>>
Creates a list with two values.
<A, B>(list: Cons<A, Cons<B, any>>) => [A, B]
Deconstructs a List
with two values.
<A, B, C>(a: a, b: B, c: C) => Cons<A, Cons<B, Cons<C, Nil>>>
Creates a list with three values.
<A, B>(list: Cons<A, Cons<B, any>>) => [A, B]
Deconstructs a List
with three values.
<A, B, C, D>(a: a, b: B, c: C, d: D) => Cons<A, Cons<B, Cons<C, Cons<D, Nil>>>>
Creates a list with four values.
<A, B, C, D>(list: Cons<A, Cons<B, Cons<C, Cons<D, any>>>>) => [A, B, C, D]
Deconstructs a List
with four values.
<A, B, C, D, E>(a: a, b: B, c: C, d: D, e: E) => Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Nil>>>>>
Creates a list with five values.
<A, B, C, D, E>(list: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, any>>>>>) => [A, B, C, D, E]
Deconstructs a List
with five values.
<A, B, C, D, E, F>(a: a, b: B, c: C, d: D, e: E, f: F) => Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, Nil>>>>>>
Creates a list with six values.
<A, B, C, D, E, F>(list: Cons<A, Cons<B, Cons<C, Cons<D, Cons<E, Cons<F, any>>>>>>) => [A, B, C, D, E, F]
Deconstructs a List
with six values.