Copyright | (c) 2013 Justus Sagemüller |
---|---|
License | GPL v3 (see COPYING) |
Maintainer | (@) jsag $ hvl.no |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Synopsis
- module Control.Functor.Constrained
- class (Functor f r t, Cartesian r, Cartesian t, Object t (f (UnitObject r))) => Monoidal f r t where
- pureUnit :: UnitObject t `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 r t where
- pure :: (Object r a, Object t (f a)) => a `t` 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) => f (r a b) `t` t (f a) (f b)
- constrainedFZipWith :: (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 :: (WellPointed r, Monoidal f r t, ObjectPoint r a, Object t (f a)) => a -> t (UnitObject t) (f a)
- fzip :: (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)) => (a `r` b) -> f a `t` 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)) => (a `r` (b `r` c)) -> f a `t` (f b `t` f c)
- liftA3 :: (Applicative f r t, Object r c, Object r d, ObjectMorphism r c d, ObjectMorphism r b (c `r` 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)) => (a `r` (b `r` (c `r` d))) -> f a `t` (f b `t` (f c `t` 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 r t where Source #
pureUnit :: UnitObject t `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 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 r t where Source #
pure :: (Object r a, Object t (f a)) => a `t` 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) => f (r a b) `t` t (f a) (f b) infixl 4 Source #
Instances
Applicative f => Applicative f (->) (->) Source # | |
Defined in Control.Applicative.Constrained 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 :: (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 :: (WellPointed r, Monoidal f r t, ObjectPoint r a, Object t (f a)) => a -> t (UnitObject t) (f a) Source #
fzip :: (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)) => (a `r` b) -> f a `t` 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)) => (a `r` (b `r` c)) -> f a `t` (f b `t` f c) Source #
liftA3 :: (Applicative f r t, Object r c, Object r d, ObjectMorphism r c d, ObjectMorphism r b (c `r` 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)) => (a `r` (b `r` (c `r` d))) -> f a `t` (f b `t` (f c `t` f d)) Source #