| Safe Haskell | None |
|---|
Control.Applicative.Indexed
Description
This module provides a type-indexed / parameterized version of the Functor and Applicative classes.
- class IndexedFunctor f where
- imap :: (x -> y) -> (a -> b) -> f x a -> f y b
- class IndexedFunctor f => IndexedApplicative f where
- (<<$>>) :: IndexedFunctor f => (a -> b) -> f y a -> f y b
- (<<**>>) :: IndexedApplicative f => f x a -> f (x -> y) (a -> b) -> f y b
- liftIA :: IndexedApplicative f => (a -> b) -> (x -> y) -> f a x -> f b y
- liftIA2 :: IndexedApplicative f => (a -> b -> c) -> (x -> y -> z) -> f a x -> f b y -> f c z
- liftIA3 :: IndexedApplicative f => (a -> b -> c -> d) -> (w -> x -> y -> z) -> f a w -> f b x -> f c y -> f d z
- newtype WrappedApplicative f index a = WrappedApplicative {
- unwrapApplicative :: f a
type-indexed / parameterized classes
class IndexedFunctor f whereSource
a class for a 'type-indexed' or paramaterized functor
note: not sure what the most correct name is for this class, or if it exists in a well supported library already.
Methods
Arguments
| :: (x -> y) | function to apply to first parameter |
| -> (a -> b) | function to apply to second parameter |
| -> f x a | indexed functor |
| -> f y b |
imap is similar to fmap
Instances
| Functor f => IndexedFunctor (WrappedApplicative f) | |
| Monad m => IndexedFunctor (Form m input view error) |
class IndexedFunctor f => IndexedApplicative f whereSource
a class for a 'type-indexed' or paramaterized applicative functors
note: not sure what the most correct name is for this class, or if it exists in a well supported library already.
Methods
ipure :: x -> a -> f x aSource
similar to pure
(<<*>>) :: f (x -> y) (a -> b) -> f x a -> f y bSource
similar to <*>
(*>>) :: f x a -> f y b -> f y bSource
similar to *>
(<<*) :: f x a -> f y b -> f x aSource
similar to <*
Instances
| Applicative f => IndexedApplicative (WrappedApplicative f) | |
| (Monoid view, Monad m) => IndexedApplicative (Form m input error view) |
(<<$>>) :: IndexedFunctor f => (a -> b) -> f y a -> f y bSource
similar to <$>. An alias for imap id
(<<**>>) :: IndexedApplicative f => f x a -> f (x -> y) (a -> b) -> f y bSource
A variant of <<*>> with the arguments reversed.
liftIA :: IndexedApplicative f => (a -> b) -> (x -> y) -> f a x -> f b ySource
Lift a function to actions.
This function may be used as a value for imap in a IndexedFunctor instance.
liftIA2 :: IndexedApplicative f => (a -> b -> c) -> (x -> y -> z) -> f a x -> f b y -> f c zSource
Lift a binary function to actions.
liftIA3 :: IndexedApplicative f => (a -> b -> c -> d) -> (w -> x -> y -> z) -> f a w -> f b x -> f c y -> f d zSource
Lift a binary function to actions.
WrappedApplicative
newtype WrappedApplicative f index a Source
a wrapper which lifts a value with an Applicative instance so that it can be used as an IndexedFunctor or IndexedApplicative
d :: WrappedApplicative Maybe y Char d = WrappedApplicative (Just succ) <<*>> WrappedApplicative (Just 'c')
Constructors
| WrappedApplicative | |
Fields
| |
Instances
| Applicative f => IndexedApplicative (WrappedApplicative f) | |
| Functor f => IndexedFunctor (WrappedApplicative f) | |
| Monad f => Monad (WrappedApplicative f index) | |
| Functor f => Functor (WrappedApplicative f index) | |
| Applicative f => Applicative (WrappedApplicative f index) | |
| Eq (f a) => Eq (WrappedApplicative f index a) | |
| Ord (f a) => Ord (WrappedApplicative f index a) | |
| Read (f a) => Read (WrappedApplicative f index a) | |
| Show (f a) => Show (WrappedApplicative f index a) |