Copyright | (c) 2013 Justus Sagemüller |
---|---|
License | GPL v3 (see COPYING) |
Maintainer | (@) jsag $ hvl.no |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Control.Applicative.Constrained
Description
Synopsis
- module Control.Functor.Constrained
- class (Functor f r t, Cartesian r, Cartesian t, Object t (f (UnitObject r))) => Monoidal (f :: Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) where
- pureUnit :: t (UnitObject t) (f (UnitObject r))
- fzipWith :: (ObjectPair r a b, Object r c, ObjectPair t (f a) (f b), Object t (f c)) => r (a, b) c -> t (f a, f b) (f c)
- class (Monoidal f r t, Curry r, Curry t) => Applicative (f :: Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) where
- pure :: (Object r a, Object t (f a)) => t a (f a)
- (<*>) :: (ObjectMorphism r a b, ObjectMorphism t (f a) (f b), Object t (t (f a) (f b)), ObjectPair r (r a b) a, ObjectPair t (f (r a b)) (f a), Object r a, Object r b) => t (f (r a b)) (t (f a) (f b))
- constrainedFZipWith :: forall r t (o :: Type -> Constraint) a b c f. (Category r, Category t, o a, o b, o (a, b), o c, o (f a, f b), o (f c)) => (r (a, b) c -> t (f a, f b) (f c)) -> (o ⊢ r) (a, b) c -> (o ⊢ t) (f a, f b) (f c)
- constPure :: forall (r :: Type -> Type -> Type) f t a. (WellPointed r, Monoidal f r t, ObjectPoint r a, Object t (f a)) => a -> t (UnitObject t) (f a)
- fzip :: forall f (r :: Type -> Type -> Type) t a b. (Monoidal f r t, ObjectPair r a b, ObjectPair t (f a) (f b), Object t (f (a, b))) => t (f a, f b) (f (a, b))
- (<**>) :: (Applicative f r (->), ObjectMorphism r a b, ObjectPair r (r a b) a) => f a -> f (r a b) -> f b
- liftA :: (Applicative f r t, Object r a, Object r b, Object t (f a), Object t (f b)) => r a b -> t (f a) (f b)
- liftA2 :: (Applicative f r t, Object r c, ObjectMorphism r b c, Object t (f c), ObjectMorphism t (f b) (f c), ObjectPair r a b, ObjectPair t (f a) (f b)) => r a (r b c) -> t (f a) (t (f b) (f c))
- liftA3 :: (Applicative f r t, Object r c, Object r d, ObjectMorphism r c d, ObjectMorphism r b (r c d), Object r (r c d), ObjectPair r a b, ObjectPair r (r c d) c, Object t (f c), Object t (f d), Object t (f a, f b), ObjectMorphism t (f c) (f d), ObjectMorphism t (f b) (t (f c) (f d)), Object t (t (f c) (f d)), ObjectPair t (f a) (f b), ObjectPair t (t (f c) (f d)) (f c), ObjectPair t (f (r c d)) (f c)) => r a (r b (r c d)) -> t (f a) (t (f b) (t (f c) (f d)))
Documentation
module Control.Functor.Constrained
Monoidal / applicative functors
class (Functor f r t, Cartesian r, Cartesian t, Object t (f (UnitObject r))) => Monoidal (f :: Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) where Source #
Methods
pureUnit :: t (UnitObject t) (f (UnitObject r)) Source #
fzipWith :: (ObjectPair r a b, Object r c, ObjectPair t (f a) (f b), Object t (f c)) => r (a, b) c -> t (f a, f b) (f c) Source #
Instances
Applicative f => Monoidal f (->) (->) Source # | |
Defined in Control.Applicative.Constrained Methods pureUnit :: UnitObject (->) -> f (UnitObject (->)) Source # fzipWith :: (ObjectPair (->) a b, Object (->) c, ObjectPair (->) (f a) (f b), Object (->) (f c)) => ((a, b) -> c) -> (f a, f b) -> f c Source # |
class (Monoidal f r t, Curry r, Curry t) => Applicative (f :: Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) where Source #
Minimal complete definition
Methods
pure :: (Object r a, Object t (f a)) => t a (f a) Source #
Note that this tends to make little sense for non-endofunctors.
Consider using constPure
instead.
(<*>) :: (ObjectMorphism r a b, ObjectMorphism t (f a) (f b), Object t (t (f a) (f b)), ObjectPair r (r a b) a, ObjectPair t (f (r a b)) (f a), Object r a, Object r b) => t (f (r a b)) (t (f a) (f b)) infixl 4 Source #
Instances
Applicative f => Applicative f (->) (->) Source # | |
Defined in Control.Applicative.Constrained Methods pure :: (Object (->) a, Object (->) (f a)) => a -> f a Source # (<*>) :: (ObjectMorphism (->) a b, ObjectMorphism (->) (f a) (f b), Object (->) (f a -> f b), ObjectPair (->) (a -> b) a, ObjectPair (->) (f (a -> b)) (f a), Object (->) a, Object (->) b) => f (a -> b) -> (f a -> f b) Source # |
Helper for constrained categories
constrainedFZipWith :: forall r t (o :: Type -> Constraint) a b c f. (Category r, Category t, o a, o b, o (a, b), o c, o (f a, f b), o (f c)) => (r (a, b) c -> t (f a, f b) (f c)) -> (o ⊢ r) (a, b) c -> (o ⊢ t) (f a, f b) (f c) Source #
Utility functions
constPure :: forall (r :: Type -> Type -> Type) f t a. (WellPointed r, Monoidal f r t, ObjectPoint r a, Object t (f a)) => a -> t (UnitObject t) (f a) Source #
fzip :: forall f (r :: Type -> Type -> Type) t a b. (Monoidal f r t, ObjectPair r a b, ObjectPair t (f a) (f b), Object t (f (a, b))) => t (f a, f b) (f (a, b)) Source #
(<**>) :: (Applicative f r (->), ObjectMorphism r a b, ObjectPair r (r a b) a) => f a -> f (r a b) -> f b infixl 4 Source #
liftA :: (Applicative f r t, Object r a, Object r b, Object t (f a), Object t (f b)) => r a b -> t (f a) (f b) Source #
liftA2 :: (Applicative f r t, Object r c, ObjectMorphism r b c, Object t (f c), ObjectMorphism t (f b) (f c), ObjectPair r a b, ObjectPair t (f a) (f b)) => r a (r b c) -> t (f a) (t (f b) (f c)) Source #
liftA3 :: (Applicative f r t, Object r c, Object r d, ObjectMorphism r c d, ObjectMorphism r b (r c d), Object r (r c d), ObjectPair r a b, ObjectPair r (r c d) c, Object t (f c), Object t (f d), Object t (f a, f b), ObjectMorphism t (f c) (f d), ObjectMorphism t (f b) (t (f c) (f d)), Object t (t (f c) (f d)), ObjectPair t (f a) (f b), ObjectPair t (t (f c) (f d)) (f c), ObjectPair t (f (r c d)) (f c)) => r a (r b (r c d)) -> t (f a) (t (f b) (t (f c) (f d))) Source #