fixed-vector-0.4.2.0: Generic vectors with statically known size.

Data.Vector.Fixed.Internal.Arity

Description

Type class for working with N-ary functions

Synopsis

# Type-level naturals

data Z Source

Type level zero

Instances

 Arity Z

data S n Source

Successor of n

Instances

 Arity n => Arity (S n)

## Synonyms for small numerals

type N1 = S ZSource

type N2 = S N1Source

type N3 = S N2Source

type N4 = S N3Source

type N5 = S N4Source

type N6 = S N5Source

# N-ary functions

type family Fn n a b Source

Type family for n-ary functions.

newtype Fun n a b Source

Newtype wrapper which is used to make Fn injective.

Constructors

 Fun FieldsunFun :: Fn n a b

Instances

 Arity n => Functor (Fun n a)

class Arity n whereSource

Type class for handling n-ary functions.

Methods

Arguments

 :: (forall k. t (S k) -> a -> t k) Fold function -> (t Z -> b) Extract result of fold -> t n Initial value -> Fn n a b Reduction function

Left fold over n elements exposed as n-ary function.

Arguments

 :: Monad m => (forall k. t (S k) -> a -> m (t k)) Fold function -> (t Z -> m b) Extract result of fold -> m (t n) Initial value -> Fn n a (m b) Reduction function

Arguments

 :: (forall k. t (S k) -> (a, t k)) Get value to apply to function -> t n Initial value -> Fn n a b N-ary function -> (b, t Z)

Apply all parameters to the function.

Arguments

 :: Monad m => (forall k. t (S k) -> m (a, t k)) Get value to apply to function -> t n Initial value -> Fn n a (m b) N-ary function -> m (b, t Z)

arity :: n -> IntSource

Arity of function.

Instances

 Arity Z Arity n => Arity (S n)

Arguments

 :: Arity n => (forall k. t (S k) -> (a, t k)) Get value to apply to function -> t n Initial value -> Fn n a b N-ary function -> b

Apply all parameters to the function.

Arguments

 :: (Arity n, Monad m) => (forall k. t (S k) -> m (a, t k)) Get value to apply to function -> t n Initial value -> Fn n a (m b) N-ary function -> m b

Apply all parameters to the function.