Safe Haskell | Safe-Inferred |
---|
Data.Vector.Fixed.Internal.Arity
Description
Type class for working with N-ary functions
- data Z
- data S n
- type N1 = S Z
- type N2 = S N1
- type N3 = S N2
- type N4 = S N3
- type N5 = S N4
- type N6 = S N5
- type family Fn n a b
- newtype Fun n a b = Fun (Fn n a b)
- class Arity n where
- accum :: (forall k. t (S k) -> a -> t k) -> (t Z -> b) -> t n -> Fn n a b
- accumM :: Monad m => (forall k. t (S k) -> a -> m (t k)) -> (t Z -> m b) -> m (t n) -> Fn n a (m b)
- apply :: (forall k. t (S k) -> (a, t k)) -> t n -> Fn n a b -> b
- applyM :: Monad m => (forall k. t (S k) -> m (a, t k)) -> t n -> Fn n a (m b) -> m b
- arity :: n -> Int
Type-level naturals
Synonyms for small numerals
N-ary functions
Newtype wrapper which is used to make Fn
injective.
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 |
Monadic left fold.
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 |
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 |
Monadic apply
Arity of function.