constrained-categories 0.3.1.1 → 0.4.0.0
raw patch · 7 files changed
+118/−57 lines, 7 filesdep +contravariantdep +trivial-constraintPVP ok
version bump matches the API change (PVP)
Dependencies added: contravariant, trivial-constraint
API changes (from Hackage documentation)
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.EnhancedCat a k, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.EnhancedCat (Control.Category.Constrained.ConstrainedCategory a o) k
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.MorphChoice k, o (Control.Category.Constrained.ZeroObject k)) => Control.Arrow.Constrained.MorphChoice (Control.Category.Constrained.ConstrainedCategory k o)
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.Morphism a, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.Morphism (Control.Category.Constrained.ConstrainedCategory a o)
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.PreArrChoice k, o (Control.Category.Constrained.ZeroObject k)) => Control.Arrow.Constrained.PreArrChoice (Control.Category.Constrained.ConstrainedCategory k o)
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.PreArrow a, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.PreArrow (Control.Category.Constrained.ConstrainedCategory a o)
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.SPDistribute k, o (Control.Category.Constrained.ZeroObject k), o (Control.Category.Constrained.UnitObject k)) => Control.Arrow.Constrained.SPDistribute (Control.Category.Constrained.ConstrainedCategory k o)
- Control.Arrow.Constrained: instance (Control.Arrow.Constrained.WellPointed a, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.WellPointed (Control.Category.Constrained.ConstrainedCategory a o)
- Control.Arrow.Constrained: instance Control.Arrow.Constrained.EnhancedCat Control.Category.Discrete.Discrete f => Control.Arrow.Constrained.EnhancedCat Control.Category.Discrete.Discrete (Control.Category.Constrained.ConstrainedCategory f o)
- Control.Arrow.Constrained: instance Control.Arrow.Constrained.Function f => Control.Arrow.Constrained.EnhancedCat (->) (Control.Category.Constrained.ConstrainedCategory f o)
- Control.Arrow.Constrained: instance Control.Category.Constrained.Category f => Control.Arrow.Constrained.EnhancedCat (Control.Category.Constrained.ConstrainedCategory f o) Control.Category.Discrete.Discrete
- Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian f, o (Control.Category.Constrained.UnitObject f)) => Control.Category.Constrained.Cartesian (Control.Category.Constrained.ConstrainedCategory f o)
- Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u) => Control.Category.Constrained.Isomorphic k (a, u) a
- Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u) => Control.Category.Constrained.Isomorphic k a (a, u)
- Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u, Control.Category.Constrained.ObjectPair k u a, Control.Category.Constrained.Object k (u, a), Control.Category.Constrained.Object k (a, u)) => Control.Category.Constrained.Isomorphic k (u, a) a
- Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u, Control.Category.Constrained.ObjectPair k u a, Control.Category.Constrained.Object k (u, a), Control.Category.Constrained.Object k (a, u)) => Control.Category.Constrained.Isomorphic k a (u, a)
- Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian f, o (Control.Category.Constrained.ZeroObject f)) => Control.Category.Constrained.CoCartesian (Control.Category.Constrained.ConstrainedCategory f o)
- Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u) => Control.Category.Constrained.Isomorphic k (a Control.Category.Constrained.+ u) a
- Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u) => Control.Category.Constrained.Isomorphic k a (a Control.Category.Constrained.+ u)
- Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u, Control.Category.Constrained.ObjectSum k u a, Control.Category.Constrained.Object k (u Control.Category.Constrained.+ a), Control.Category.Constrained.Object k (a Control.Category.Constrained.+ u)) => Control.Category.Constrained.Isomorphic k (u Control.Category.Constrained.+ a) a
- Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u ~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u, Control.Category.Constrained.ObjectSum k u a, Control.Category.Constrained.Object k (u Control.Category.Constrained.+ a), Control.Category.Constrained.Object k (a Control.Category.Constrained.+ u)) => Control.Category.Constrained.Isomorphic k a (u Control.Category.Constrained.+ a)
- Control.Category.Constrained: instance (Control.Category.Constrained.Curry f, o (Control.Category.Constrained.UnitObject f)) => Control.Category.Constrained.Curry (Control.Category.Constrained.ConstrainedCategory f o)
- Control.Category.Constrained: instance Control.Category.Constrained.Category k => Control.Category.Constrained.Category (Control.Category.Constrained.ConstrainedCategory k isObj)
- Control.Category.Constrained: type + = Either
- Control.Category.Constrained.Prelude: type + = Either
- Control.Functor.Constrained: instance (Control.Functor.Constrained.Functor [] k k, o [Control.Category.Constrained.UnitObject k]) => Control.Functor.Constrained.Functor [] (Control.Category.Constrained.ConstrainedCategory k o) (Control.Category.Constrained.ConstrainedCategory k o)
- Control.Functor.Constrained: instance (o (), o [()], o Data.Void.Void, o [Data.Void.Void]) => Control.Functor.Constrained.SumToProduct [] (Control.Category.Constrained.ConstrainedCategory (->) o) (Control.Category.Constrained.ConstrainedCategory (->) o)
- Control.Functor.Constrained: instance Control.Functor.Constrained.Functor GHC.Base.Maybe Control.Category.Discrete.Discrete Control.Category.Discrete.Discrete
- Control.Functor.Constrained: instance Control.Functor.Constrained.Functor GHC.Base.Maybe Data.Type.Coercion.Coercion Data.Type.Coercion.Coercion
- Data.Foldable.Constrained: instance (Control.Applicative.Constrained.Monoidal f k k, Control.Arrow.Constrained.Function k, u ~ Control.Category.Constrained.UnitObject k, GHC.Base.Semigroup u, GHC.Base.Monoid u, Control.Category.Constrained.ObjectPair k u u, Control.Category.Constrained.ObjectPair k (f u) (f u), Control.Category.Constrained.Object k (f u, f u)) => GHC.Base.Monoid (Data.Foldable.Constrained.Monoidal_ k k f u)
- Data.Foldable.Constrained: instance (Control.Applicative.Constrained.Monoidal f k k, Control.Arrow.Constrained.Function k, u ~ Control.Category.Constrained.UnitObject k, GHC.Base.Semigroup u, GHC.Base.Monoid u, Control.Category.Constrained.ObjectPair k u u, Control.Category.Constrained.ObjectPair k (f u) (f u), Control.Category.Constrained.Object k (f u, f u)) => GHC.Base.Semigroup (Data.Foldable.Constrained.Monoidal_ k k f u)
- Data.Foldable.Constrained: instance (Data.Foldable.Constrained.Foldable f s t, Control.Arrow.Constrained.WellPointed s, Control.Arrow.Constrained.WellPointed t, Control.Functor.Constrained.Functor f (Control.Category.Constrained.ConstrainedCategory s o) (Control.Category.Constrained.ConstrainedCategory t o)) => Data.Foldable.Constrained.Foldable f (Control.Category.Constrained.ConstrainedCategory s o) (Control.Category.Constrained.ConstrainedCategory t o)
- Data.Foldable.Constrained: instance Data.Foldable.Constrained.Foldable GHC.Base.Maybe (->) (->)
- Data.Traversable.Constrained: instance (Control.Arrow.Constrained.Arrow k (->), Control.Arrow.Constrained.WellPointed k, Control.Arrow.Constrained.Function k, Control.Functor.Constrained.Functor GHC.Base.Maybe k k) => Data.Traversable.Constrained.Traversable GHC.Base.Maybe GHC.Base.Maybe k k
+ Control.Arrow.Constrained: infixr 2 |||
+ Control.Arrow.Constrained: infixr 3 &&&
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.EnhancedCat a k, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.EnhancedCat (o Control.Category.Constrained.⊢ a) k
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.MorphChoice k, o (Control.Category.Constrained.ZeroObject k)) => Control.Arrow.Constrained.MorphChoice (o Control.Category.Constrained.⊢ k)
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.Morphism a, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.Morphism (o Control.Category.Constrained.⊢ a)
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.PreArrChoice k, o (Control.Category.Constrained.ZeroObject k)) => Control.Arrow.Constrained.PreArrChoice (o Control.Category.Constrained.⊢ k)
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.PreArrow a, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.PreArrow (o Control.Category.Constrained.⊢ a)
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.SPDistribute k, o (Control.Category.Constrained.ZeroObject k), o (Control.Category.Constrained.UnitObject k)) => Control.Arrow.Constrained.SPDistribute (o Control.Category.Constrained.⊢ k)
+ Control.Arrow.Constrained: instance (Control.Arrow.Constrained.WellPointed a, o (Control.Category.Constrained.UnitObject a)) => Control.Arrow.Constrained.WellPointed (o Control.Category.Constrained.⊢ a)
+ Control.Arrow.Constrained: instance Control.Arrow.Constrained.EnhancedCat Control.Category.Discrete.Discrete f => Control.Arrow.Constrained.EnhancedCat Control.Category.Discrete.Discrete (o Control.Category.Constrained.⊢ f)
+ Control.Arrow.Constrained: instance Control.Arrow.Constrained.Function f => Control.Arrow.Constrained.EnhancedCat (->) (o Control.Category.Constrained.⊢ f)
+ Control.Arrow.Constrained: instance Control.Arrow.Constrained.MorphChoice Data.Functor.Contravariant.Op
+ Control.Arrow.Constrained: instance Control.Arrow.Constrained.Morphism Data.Functor.Contravariant.Op
+ Control.Arrow.Constrained: instance Control.Category.Constrained.Category f => Control.Arrow.Constrained.EnhancedCat (o Control.Category.Constrained.⊢ f) Control.Category.Discrete.Discrete
+ Control.Category.Constrained: --
+ Control.Category.Constrained: -- <tt>(a,b)</tt> objects should require the stronger
+ Control.Category.Constrained: -- <tt><a>ObjectPair</a> k a b</tt>.
+ Control.Category.Constrained: -- If <i>any</i> two object types of your category make up a pair object,
+ Control.Category.Constrained: -- do that seperately: every function that actually deals with
+ Control.Category.Constrained: -- take care for <tt>a</tt> and <tt>b</tt> themselves being objects, we
+ Control.Category.Constrained: -- then just leave <a>PairObjects</a> at the default (empty constraint).
+ Control.Category.Constrained: -- | Defaults to <a>Void</a>.
+ Control.Category.Constrained: infixr 0 $~
+ Control.Category.Constrained: infixr 9 .
+ Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian f, o (Control.Category.Constrained.UnitObject f)) => Control.Category.Constrained.Cartesian (o Control.Category.Constrained.⊢ f)
+ Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u) => Control.Category.Constrained.Isomorphic k (a, u) a
+ Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u) => Control.Category.Constrained.Isomorphic k a (a, u)
+ Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u, Control.Category.Constrained.ObjectPair k u a, Control.Category.Constrained.Object k (u, a), Control.Category.Constrained.Object k (a, u)) => Control.Category.Constrained.Isomorphic k (u, a) a
+ Control.Category.Constrained: instance (Control.Category.Constrained.Cartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.UnitObject k, Control.Category.Constrained.ObjectPair k a u, Control.Category.Constrained.ObjectPair k u a, Control.Category.Constrained.Object k (u, a), Control.Category.Constrained.Object k (a, u)) => Control.Category.Constrained.Isomorphic k a (u, a)
+ Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian f, o (Control.Category.Constrained.ZeroObject f)) => Control.Category.Constrained.CoCartesian (o Control.Category.Constrained.⊢ f)
+ Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u) => Control.Category.Constrained.Isomorphic k (a Control.Category.Constrained.+ u) a
+ Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u) => Control.Category.Constrained.Isomorphic k a (a Control.Category.Constrained.+ u)
+ Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u, Control.Category.Constrained.ObjectSum k u a, Control.Category.Constrained.Object k (u Control.Category.Constrained.+ a), Control.Category.Constrained.Object k (a Control.Category.Constrained.+ u)) => Control.Category.Constrained.Isomorphic k (u Control.Category.Constrained.+ a) a
+ Control.Category.Constrained: instance (Control.Category.Constrained.CoCartesian k, Control.Category.Constrained.Object k a, u Data.Type.Equality.~ Control.Category.Constrained.ZeroObject k, Control.Category.Constrained.ObjectSum k a u, Control.Category.Constrained.ObjectSum k u a, Control.Category.Constrained.Object k (u Control.Category.Constrained.+ a), Control.Category.Constrained.Object k (a Control.Category.Constrained.+ u)) => Control.Category.Constrained.Isomorphic k a (u Control.Category.Constrained.+ a)
+ Control.Category.Constrained: instance (Control.Category.Constrained.Curry f, o (Control.Category.Constrained.UnitObject f)) => Control.Category.Constrained.Curry (o Control.Category.Constrained.⊢ f)
+ Control.Category.Constrained: instance Control.Category.Constrained.Cartesian Data.Functor.Contravariant.Op
+ Control.Category.Constrained: instance Control.Category.Constrained.Category Data.Functor.Contravariant.Op
+ Control.Category.Constrained: instance Control.Category.Constrained.Category k => Control.Category.Constrained.Category (isObj Control.Category.Constrained.⊢ k)
+ Control.Category.Constrained: instance Control.Category.Constrained.CoCartesian Data.Functor.Contravariant.Op
+ Control.Category.Constrained: type (+) = Either
+ Control.Category.Constrained: type Hask = Unconstrained ⊢ (->)
+ Control.Category.Constrained: type o ⊢ k = ConstrainedCategory k o
+ Control.Category.Constrained.Prelude: --
+ Control.Category.Constrained.Prelude: -- <tt>(a,b)</tt> objects should require the stronger
+ Control.Category.Constrained.Prelude: -- <tt><a>ObjectPair</a> k a b</tt>.
+ Control.Category.Constrained.Prelude: -- If <i>any</i> two object types of your category make up a pair object,
+ Control.Category.Constrained.Prelude: -- do that seperately: every function that actually deals with
+ Control.Category.Constrained.Prelude: -- take care for <tt>a</tt> and <tt>b</tt> themselves being objects, we
+ Control.Category.Constrained.Prelude: -- then just leave <a>PairObjects</a> at the default (empty constraint).
+ Control.Category.Constrained.Prelude: -- | Defaults to '()', and should normally be left at that.
+ Control.Category.Constrained.Prelude: infixl 6 -
+ Control.Category.Constrained.Prelude: infixl 7 *
+ Control.Category.Constrained.Prelude: infixr 6 <>
+ Control.Category.Constrained.Prelude: infixr 9 .
+ Control.Category.Constrained.Prelude: type (+) = Either
+ Control.Category.Constrained.Prelude: type Hask = Unconstrained ⊢ (->)
+ Control.Category.Constrained.Prelude: type o ⊢ k = ConstrainedCategory k o
+ Control.Category.Constrained.Reified.PolyPattern: pattern Specific :: forall (k :: Type -> Type -> Type) α β. CRCategory k => () => SpecificCat k α β -> k α β
+ Control.Category.Constrained.Reified.PolyPattern: pattern Terminal :: forall (k :: Type -> Type -> Type) α β. CRPreArrow k => (Object k α, UnitObject k ~ β) => k α β
+ Control.Category.Constrained.Reified.PolyPattern: pattern Const :: forall (k :: Type -> Type -> Type) α β. CRWellPointed k => (Object k α, Object k β) => β -> k α β
+ Control.Category.Hask: infixl 1 >>
+ Control.Category.Hask: infixl 6 -
+ Control.Category.Hask: infixl 7 *
+ Control.Category.Hask: infixr 6 <>
+ Control.Functor.Constrained: instance (Control.Functor.Constrained.Functor [] k k, o [Control.Category.Constrained.UnitObject k]) => Control.Functor.Constrained.Functor [] (o Control.Category.Constrained.⊢ k) (o Control.Category.Constrained.⊢ k)
+ Control.Functor.Constrained: instance (o (), o [()], o Data.Void.Void, o [Data.Void.Void]) => Control.Functor.Constrained.SumToProduct [] (o Control.Category.Constrained.⊢ (->)) (o Control.Category.Constrained.⊢ (->))
+ Control.Functor.Constrained: instance Control.Functor.Constrained.Functor GHC.Maybe.Maybe Control.Category.Discrete.Discrete Control.Category.Discrete.Discrete
+ Control.Functor.Constrained: instance Control.Functor.Constrained.Functor GHC.Maybe.Maybe Data.Type.Coercion.Coercion Data.Type.Coercion.Coercion
+ Data.Foldable.Constrained: instance (Control.Applicative.Constrained.Monoidal f k k, Control.Arrow.Constrained.Function k, u Data.Type.Equality.~ Control.Category.Constrained.UnitObject k, GHC.Base.Semigroup u, GHC.Base.Monoid u, Control.Category.Constrained.ObjectPair k u u, Control.Category.Constrained.ObjectPair k (f u) (f u), Control.Category.Constrained.Object k (f u, f u)) => GHC.Base.Monoid (Data.Foldable.Constrained.Monoidal_ k k f u)
+ Data.Foldable.Constrained: instance (Control.Applicative.Constrained.Monoidal f k k, Control.Arrow.Constrained.Function k, u Data.Type.Equality.~ Control.Category.Constrained.UnitObject k, GHC.Base.Semigroup u, GHC.Base.Monoid u, Control.Category.Constrained.ObjectPair k u u, Control.Category.Constrained.ObjectPair k (f u) (f u), Control.Category.Constrained.Object k (f u, f u)) => GHC.Base.Semigroup (Data.Foldable.Constrained.Monoidal_ k k f u)
+ Data.Foldable.Constrained: instance (Data.Foldable.Constrained.Foldable f s t, Control.Arrow.Constrained.WellPointed s, Control.Arrow.Constrained.WellPointed t, Control.Functor.Constrained.Functor f (o Control.Category.Constrained.⊢ s) (o Control.Category.Constrained.⊢ t)) => Data.Foldable.Constrained.Foldable f (o Control.Category.Constrained.⊢ s) (o Control.Category.Constrained.⊢ t)
+ Data.Foldable.Constrained: instance Data.Foldable.Constrained.Foldable GHC.Maybe.Maybe (->) (->)
+ Data.Traversable.Constrained: instance (Control.Arrow.Constrained.Arrow k (->), Control.Arrow.Constrained.WellPointed k, Control.Arrow.Constrained.Function k, Control.Functor.Constrained.Functor GHC.Maybe.Maybe k k) => Data.Traversable.Constrained.Traversable GHC.Maybe.Maybe GHC.Maybe.Maybe k k
- Control.Applicative.Constrained: 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)) -> ConstrainedCategory r o (a, b) c -> ConstrainedCategory t o (f a, f b) (f c)
+ Control.Applicative.Constrained: 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)
- Control.Applicative.Constrained: 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
+ Control.Applicative.Constrained: 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
- Control.Applicative.Constrained: 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)
+ Control.Applicative.Constrained: 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)
- Control.Applicative.Constrained: 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))
+ Control.Applicative.Constrained: 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))
- Control.Arrow.Constrained: coFst :: (PreArrChoice k, (ObjectSum k a b)) => k a (a + b)
+ Control.Arrow.Constrained: coFst :: (PreArrChoice k, ObjectSum k a b) => k a (a + b)
- Control.Arrow.Constrained: coSnd :: (PreArrChoice k, (ObjectSum k a b)) => k b (a + b)
+ Control.Arrow.Constrained: coSnd :: (PreArrChoice k, ObjectSum k a b) => k b (a + b)
- Control.Arrow.Constrained: fst :: (PreArrow a, (ObjectPair a x y)) => a (x, y) x
+ Control.Arrow.Constrained: fst :: (PreArrow a, ObjectPair a x y) => a (x, y) x
- Control.Arrow.Constrained: globalElement :: (WellPointed a, (ObjectPoint a x)) => x -> a (UnitObject a) x
+ Control.Arrow.Constrained: globalElement :: (WellPointed a, ObjectPoint a x) => x -> a (UnitObject a) x
- Control.Arrow.Constrained: initial :: (PreArrChoice k, (Object k b)) => k (ZeroObject k) b
+ Control.Arrow.Constrained: initial :: (PreArrChoice k, Object k b) => k (ZeroObject k) b
- Control.Arrow.Constrained: snd :: (PreArrow a, (ObjectPair a x y)) => a (x, y) y
+ Control.Arrow.Constrained: snd :: (PreArrow a, ObjectPair a x y) => a (x, y) y
- Control.Arrow.Constrained: terminal :: (PreArrow a, (Object a b)) => a b (UnitObject a)
+ Control.Arrow.Constrained: terminal :: (PreArrow a, Object a b) => a b (UnitObject a)
- Control.Category.Constrained: attachUnit :: (Cartesian k, u ~ UnitObject k, ObjectPair k a u) => k a (a, u)
+ Control.Category.Constrained: attachUnit :: (Cartesian k, unit ~ UnitObject k, ObjectPair k a unit) => k a (a, unit)
- Control.Category.Constrained: attachZero :: (CoCartesian k, Object k a, z ~ ZeroObject k, ObjectSum k a z) => k a (a + z)
+ Control.Category.Constrained: attachZero :: (CoCartesian k, Object k a, zero ~ ZeroObject k, ObjectSum k a zero) => k a (a + zero)
- Control.Category.Constrained: constrained :: (Category k, o a, o b) => k a b -> ConstrainedCategory k o a b
+ Control.Category.Constrained: constrained :: forall o k a b. (Category k, o a, o b) => k a b -> (o ⊢ k) a b
- Control.Category.Constrained: detachUnit :: (Cartesian k, u ~ UnitObject k, ObjectPair k a u) => k (a, u) a
+ Control.Category.Constrained: detachUnit :: (Cartesian k, unit ~ UnitObject k, ObjectPair k a unit) => k (a, unit) a
- Control.Category.Constrained: detachZero :: (CoCartesian k, Object k a, z ~ ZeroObject k, ObjectSum k a z) => k (a + z) a
+ Control.Category.Constrained: detachZero :: (CoCartesian k, Object k a, zero ~ ZeroObject k, ObjectSum k a zero) => k (a + zero) a
- Control.Category.Constrained: inCategoryOf :: (Category k) => k a b -> k c d -> k a b
+ Control.Category.Constrained: inCategoryOf :: Category k => k a b -> k c d -> k a b
- Control.Category.Constrained: unconstrained :: (Category k) => ConstrainedCategory k o a b -> k a b
+ Control.Category.Constrained: unconstrained :: forall o k a b. Category k => (o ⊢ k) a b -> k a b
- Control.Category.Constrained.Prelude: ($!) :: () => a -> b -> a -> b
+ Control.Category.Constrained.Prelude: ($!) :: () => (a -> b) -> a -> b
- Control.Category.Constrained.Prelude: all :: Foldable t => a -> Bool -> t a -> Bool
+ Control.Category.Constrained.Prelude: all :: Foldable t => (a -> Bool) -> t a -> Bool
- Control.Category.Constrained.Prelude: any :: Foldable t => a -> Bool -> t a -> Bool
+ Control.Category.Constrained.Prelude: any :: Foldable t => (a -> Bool) -> t a -> Bool
- Control.Category.Constrained.Prelude: attachUnit :: (Cartesian k, u ~ UnitObject k, ObjectPair k a u) => k a (a, u)
+ Control.Category.Constrained.Prelude: attachUnit :: (Cartesian k, unit ~ UnitObject k, ObjectPair k a unit) => k a (a, unit)
- Control.Category.Constrained.Prelude: attachZero :: (CoCartesian k, Object k a, z ~ ZeroObject k, ObjectSum k a z) => k a (a + z)
+ Control.Category.Constrained.Prelude: attachZero :: (CoCartesian k, Object k a, zero ~ ZeroObject k, ObjectSum k a zero) => k a (a + zero)
- Control.Category.Constrained.Prelude: break :: () => a -> Bool -> [a] -> ([a], [a])
+ Control.Category.Constrained.Prelude: break :: () => (a -> Bool) -> [a] -> ([a], [a])
- Control.Category.Constrained.Prelude: constrained :: (Category k, o a, o b) => k a b -> ConstrainedCategory k o a b
+ Control.Category.Constrained.Prelude: constrained :: forall o k a b. (Category k, o a, o b) => k a b -> (o ⊢ k) a b
- Control.Category.Constrained.Prelude: 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)) -> ConstrainedCategory r o (a, b) c -> ConstrainedCategory t o (f a, f b) (f c)
+ Control.Category.Constrained.Prelude: 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)
- Control.Category.Constrained.Prelude: constrainedFmap :: (Category r, Category t, o a, o b, o (f a), o (f b)) => (r a b -> t (f a) (f b)) -> ConstrainedCategory r o a b -> ConstrainedCategory t o (f a) (f b)
+ Control.Category.Constrained.Prelude: constrainedFmap :: (Category r, Category t, o a, o b, o (f a), o (f b)) => (r a b -> t (f a) (f b)) -> (o ⊢ r) a b -> (o ⊢ t) (f a) (f b)
- Control.Category.Constrained.Prelude: detachUnit :: (Cartesian k, u ~ UnitObject k, ObjectPair k a u) => k (a, u) a
+ Control.Category.Constrained.Prelude: detachUnit :: (Cartesian k, unit ~ UnitObject k, ObjectPair k a unit) => k (a, unit) a
- Control.Category.Constrained.Prelude: detachZero :: (CoCartesian k, Object k a, z ~ ZeroObject k, ObjectSum k a z) => k (a + z) a
+ Control.Category.Constrained.Prelude: detachZero :: (CoCartesian k, Object k a, zero ~ ZeroObject k, ObjectSum k a zero) => k (a + zero) a
- Control.Category.Constrained.Prelude: dropWhile :: () => a -> Bool -> [a] -> [a]
+ Control.Category.Constrained.Prelude: dropWhile :: () => (a -> Bool) -> [a] -> [a]
- Control.Category.Constrained.Prelude: either :: () => a -> c -> b -> c -> Either a b -> c
+ Control.Category.Constrained.Prelude: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
- Control.Category.Constrained.Prelude: fail :: (MonadFail m k, (Object k (m a))) => k String (m a)
+ Control.Category.Constrained.Prelude: fail :: (MonadFail m k, Object k (m a)) => k String (m a)
- Control.Category.Constrained.Prelude: filterM :: (PreArrow k, Monad m k, SumToProduct c k k, EndoTraversable c k, ObjectPair k Bool a, Object k (c a), Object k (m (c a)), ObjectPair k (Bool, a) (c (Bool, a)), ObjectPair k (m Bool) (m a), ObjectPair k (m (Bool, a)) (m (c (Bool, a))), TraversalObject k c (Bool, a)) => a `k` m Bool -> c a `k` m (c a)
+ Control.Category.Constrained.Prelude: filterM :: (PreArrow k, Monad m k, SumToProduct c k k, EndoTraversable c k, ObjectPair k Bool a, Object k (c a), Object k (m (c a)), ObjectPair k (Bool, a) (c (Bool, a)), ObjectPair k (m Bool) (m a), ObjectPair k (m (Bool, a)) (m (c (Bool, a))), TraversalObject k c (Bool, a)) => (a `k` m Bool) -> c a `k` m (c a)
- Control.Category.Constrained.Prelude: flip :: () => a -> b -> c -> b -> a -> c
+ Control.Category.Constrained.Prelude: flip :: () => (a -> b -> c) -> b -> a -> c
- Control.Category.Constrained.Prelude: foldl :: Foldable t => b -> a -> b -> b -> t a -> b
+ Control.Category.Constrained.Prelude: foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
- Control.Category.Constrained.Prelude: foldl1 :: Foldable t => a -> a -> a -> t a -> a
+ Control.Category.Constrained.Prelude: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- Control.Category.Constrained.Prelude: foldr :: Foldable t => a -> b -> b -> b -> t a -> b
+ Control.Category.Constrained.Prelude: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Control.Category.Constrained.Prelude: foldr1 :: Foldable t => a -> a -> a -> t a -> a
+ Control.Category.Constrained.Prelude: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- Control.Category.Constrained.Prelude: forM_ :: forall t k l f a b uk ul. (Foldable t k l, Monoidal f l l, Monoidal f k k, Function l, Arrow k (->), Arrow l (->), ul ~ UnitObject l, uk ~ UnitObject k, uk ~ ul, ObjectPair l ul ul, ObjectPair l (f ul) (f ul), ObjectPair l (f ul) (t a), ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair l (f ul) a, ObjectPair k b (f b), ObjectPair k b ul, ObjectPair k uk uk, ObjectPair k (f uk) a, ObjectPair k (f uk) (f uk)) => t a -> a `k` f b -> f uk
+ Control.Category.Constrained.Prelude: forM_ :: forall t k l f a b uk ul. (Foldable t k l, Monoidal f l l, Monoidal f k k, Function l, Arrow k (->), Arrow l (->), ul ~ UnitObject l, uk ~ UnitObject k, uk ~ ul, ObjectPair l ul ul, ObjectPair l (f ul) (f ul), ObjectPair l (f ul) (t a), ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair l (f ul) a, ObjectPair k b (f b), ObjectPair k b ul, ObjectPair k uk uk, ObjectPair k (f uk) a, ObjectPair k (f uk) (f uk)) => t a -> (a `k` f b) -> f uk
- Control.Category.Constrained.Prelude: fst :: (PreArrow a, (ObjectPair a x y)) => a (x, y) x
+ Control.Category.Constrained.Prelude: fst :: (PreArrow a, ObjectPair a x y) => a (x, y) x
- Control.Category.Constrained.Prelude: inCategoryOf :: (Category k) => k a b -> k c d -> k a b
+ Control.Category.Constrained.Prelude: inCategoryOf :: Category k => k a b -> k c d -> k a b
- Control.Category.Constrained.Prelude: interact :: String -> String -> IO ()
+ Control.Category.Constrained.Prelude: interact :: (String -> String) -> IO ()
- Control.Category.Constrained.Prelude: iterate :: () => a -> a -> a -> [a]
+ Control.Category.Constrained.Prelude: iterate :: () => (a -> a) -> a -> [a]
- Control.Category.Constrained.Prelude: 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
+ Control.Category.Constrained.Prelude: 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
- Control.Category.Constrained.Prelude: 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)
+ Control.Category.Constrained.Prelude: 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)
- Control.Category.Constrained.Prelude: 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))
+ Control.Category.Constrained.Prelude: 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))
- Control.Category.Constrained.Prelude: map :: () => a -> b -> [a] -> [b]
+ Control.Category.Constrained.Prelude: map :: () => (a -> b) -> [a] -> [b]
- Control.Category.Constrained.Prelude: mapM :: (Traversable s t k l, k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => a `k` m b -> t a `k` m (t b)
+ Control.Category.Constrained.Prelude: mapM :: (Traversable s t k l, k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => (a `k` m b) -> t a `k` m (t b)
- Control.Category.Constrained.Prelude: mapM_ :: forall t k o f a b u. (Foldable t k k, WellPointed k, Monoidal f k k, u ~ UnitObject k, ObjectPair k (f u) (t a), ObjectPair k (f u) a, ObjectPair k u (t a), ObjectPair k (t a) u, ObjectPair k (f u) (f u), ObjectPair k u u, ObjectPair k b u, Object k (f b)) => a `k` f b -> t a `k` f u
+ Control.Category.Constrained.Prelude: mapM_ :: forall t k o f a b u. (Foldable t k k, WellPointed k, Monoidal f k k, u ~ UnitObject k, ObjectPair k (f u) (t a), ObjectPair k (f u) a, ObjectPair k u (t a), ObjectPair k (t a) u, ObjectPair k (f u) (f u), ObjectPair k u u, ObjectPair k b u, Object k (f b)) => (a `k` f b) -> t a `k` f u
- Control.Category.Constrained.Prelude: maybe :: () => b -> a -> b -> Maybe a -> b
+ Control.Category.Constrained.Prelude: maybe :: () => b -> (a -> b) -> Maybe a -> b
- Control.Category.Constrained.Prelude: mplus :: (MonadPlus m (->)) => m a -> m a -> m a
+ Control.Category.Constrained.Prelude: mplus :: MonadPlus m (->) => m a -> m a -> m a
- Control.Category.Constrained.Prelude: mzero :: (MonadZero m (->)) => m a
+ Control.Category.Constrained.Prelude: mzero :: MonadZero m (->) => m a
- Control.Category.Constrained.Prelude: scanl :: () => b -> a -> b -> b -> [a] -> [b]
+ Control.Category.Constrained.Prelude: scanl :: () => (b -> a -> b) -> b -> [a] -> [b]
- Control.Category.Constrained.Prelude: scanl1 :: () => a -> a -> a -> [a] -> [a]
+ Control.Category.Constrained.Prelude: scanl1 :: () => (a -> a -> a) -> [a] -> [a]
- Control.Category.Constrained.Prelude: scanr :: () => a -> b -> b -> b -> [a] -> [b]
+ Control.Category.Constrained.Prelude: scanr :: () => (a -> b -> b) -> b -> [a] -> [b]
- Control.Category.Constrained.Prelude: scanr1 :: () => a -> a -> a -> [a] -> [a]
+ Control.Category.Constrained.Prelude: scanr1 :: () => (a -> a -> a) -> [a] -> [a]
- Control.Category.Constrained.Prelude: sequenceA :: (Traversable t, Applicative f) => t f a -> f t a
+ Control.Category.Constrained.Prelude: sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
- Control.Category.Constrained.Prelude: snd :: (PreArrow a, (ObjectPair a x y)) => a (x, y) y
+ Control.Category.Constrained.Prelude: snd :: (PreArrow a, ObjectPair a x y) => a (x, y) y
- Control.Category.Constrained.Prelude: span :: () => a -> Bool -> [a] -> ([a], [a])
+ Control.Category.Constrained.Prelude: span :: () => (a -> Bool) -> [a] -> ([a], [a])
- Control.Category.Constrained.Prelude: takeWhile :: () => a -> Bool -> [a] -> [a]
+ Control.Category.Constrained.Prelude: takeWhile :: () => (a -> Bool) -> [a] -> [a]
- Control.Category.Constrained.Prelude: unconstrained :: (Category k) => ConstrainedCategory k o a b -> k a b
+ Control.Category.Constrained.Prelude: unconstrained :: forall o k a b. Category k => (o ⊢ k) a b -> k a b
- Control.Category.Constrained.Prelude: until :: () => a -> Bool -> a -> a -> a -> a
+ Control.Category.Constrained.Prelude: until :: () => (a -> Bool) -> (a -> a) -> a -> a
- Control.Category.Constrained.Prelude: zipWith :: () => a -> b -> c -> [a] -> [b] -> [c]
+ Control.Category.Constrained.Prelude: zipWith :: () => (a -> b -> c) -> [a] -> [b] -> [c]
- Control.Category.Constrained.Prelude: zipWith3 :: () => a -> b -> c -> d -> [a] -> [b] -> [c] -> [d]
+ Control.Category.Constrained.Prelude: zipWith3 :: () => (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- Control.Category.Hask: ($!) :: () => a -> b -> a -> b
+ Control.Category.Hask: ($!) :: () => (a -> b) -> a -> b
- Control.Category.Hask: ($) :: () => a -> b -> a -> b
+ Control.Category.Hask: ($) :: () => (a -> b) -> a -> b
- Control.Category.Hask: (<$>) :: Functor f => a -> b -> f a -> f b
+ Control.Category.Hask: (<$>) :: Functor f => (a -> b) -> f a -> f b
- Control.Category.Hask: (<*>) :: Applicative f => f a -> b -> f a -> f b
+ Control.Category.Hask: (<*>) :: Applicative f => f (a -> b) -> f a -> f b
- Control.Category.Hask: (=<<) :: Monad m => a -> m b -> m a -> m b
+ Control.Category.Hask: (=<<) :: Monad m => (a -> m b) -> m a -> m b
- Control.Category.Hask: (>>=) :: Monad m => m a -> a -> m b -> m b
+ Control.Category.Hask: (>>=) :: Monad m => m a -> (a -> m b) -> m b
- Control.Category.Hask: all :: Foldable t => a -> Bool -> t a -> Bool
+ Control.Category.Hask: all :: Foldable t => (a -> Bool) -> t a -> Bool
- Control.Category.Hask: any :: Foldable t => a -> Bool -> t a -> Bool
+ Control.Category.Hask: any :: Foldable t => (a -> Bool) -> t a -> Bool
- Control.Category.Hask: break :: () => a -> Bool -> [a] -> ([a], [a])
+ Control.Category.Hask: break :: () => (a -> Bool) -> [a] -> ([a], [a])
- Control.Category.Hask: class Functor f => Applicative (f :: * -> *)
+ Control.Category.Hask: class Functor f => Applicative (f :: Type -> Type)
- Control.Category.Hask: class Foldable (t :: * -> *)
+ Control.Category.Hask: class Foldable (t :: Type -> Type)
- Control.Category.Hask: class Functor (f :: * -> *)
+ Control.Category.Hask: class Functor (f :: Type -> Type)
- Control.Category.Hask: class Applicative m => Monad (m :: * -> *)
+ Control.Category.Hask: class Applicative m => Monad (m :: Type -> Type)
- Control.Category.Hask: class (Functor t, Foldable t) => Traversable (t :: * -> *)
+ Control.Category.Hask: class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
- Control.Category.Hask: concatMap :: Foldable t => a -> [b] -> t a -> [b]
+ Control.Category.Hask: concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
- Control.Category.Hask: curry :: () => (a, b) -> c -> a -> b -> c
+ Control.Category.Hask: curry :: () => ((a, b) -> c) -> a -> b -> c
- Control.Category.Hask: dropWhile :: () => a -> Bool -> [a] -> [a]
+ Control.Category.Hask: dropWhile :: () => (a -> Bool) -> [a] -> [a]
- Control.Category.Hask: either :: () => a -> c -> b -> c -> Either a b -> c
+ Control.Category.Hask: either :: () => (a -> c) -> (b -> c) -> Either a b -> c
- Control.Category.Hask: filter :: () => a -> Bool -> [a] -> [a]
+ Control.Category.Hask: filter :: () => (a -> Bool) -> [a] -> [a]
- Control.Category.Hask: flip :: () => a -> b -> c -> b -> a -> c
+ Control.Category.Hask: flip :: () => (a -> b -> c) -> b -> a -> c
- Control.Category.Hask: fmap :: Functor f => a -> b -> f a -> f b
+ Control.Category.Hask: fmap :: Functor f => (a -> b) -> f a -> f b
- Control.Category.Hask: foldMap :: (Foldable t, Monoid m) => a -> m -> t a -> m
+ Control.Category.Hask: foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m
- Control.Category.Hask: foldl :: Foldable t => b -> a -> b -> b -> t a -> b
+ Control.Category.Hask: foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
- Control.Category.Hask: foldl1 :: Foldable t => a -> a -> a -> t a -> a
+ Control.Category.Hask: foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
- Control.Category.Hask: foldr :: Foldable t => a -> b -> b -> b -> t a -> b
+ Control.Category.Hask: foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
- Control.Category.Hask: foldr1 :: Foldable t => a -> a -> a -> t a -> a
+ Control.Category.Hask: foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
- Control.Category.Hask: interact :: String -> String -> IO ()
+ Control.Category.Hask: interact :: (String -> String) -> IO ()
- Control.Category.Hask: iterate :: () => a -> a -> a -> [a]
+ Control.Category.Hask: iterate :: () => (a -> a) -> a -> [a]
- Control.Category.Hask: map :: () => a -> b -> [a] -> [b]
+ Control.Category.Hask: map :: () => (a -> b) -> [a] -> [b]
- Control.Category.Hask: mapM :: (Traversable t, Monad m) => a -> m b -> t a -> m t b
+ Control.Category.Hask: mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- Control.Category.Hask: mapM_ :: (Foldable t, Monad m) => a -> m b -> t a -> m ()
+ Control.Category.Hask: mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
- Control.Category.Hask: maybe :: () => b -> a -> b -> Maybe a -> b
+ Control.Category.Hask: maybe :: () => b -> (a -> b) -> Maybe a -> b
- Control.Category.Hask: scanl :: () => b -> a -> b -> b -> [a] -> [b]
+ Control.Category.Hask: scanl :: () => (b -> a -> b) -> b -> [a] -> [b]
- Control.Category.Hask: scanl1 :: () => a -> a -> a -> [a] -> [a]
+ Control.Category.Hask: scanl1 :: () => (a -> a -> a) -> [a] -> [a]
- Control.Category.Hask: scanr :: () => a -> b -> b -> b -> [a] -> [b]
+ Control.Category.Hask: scanr :: () => (a -> b -> b) -> b -> [a] -> [b]
- Control.Category.Hask: scanr1 :: () => a -> a -> a -> [a] -> [a]
+ Control.Category.Hask: scanr1 :: () => (a -> a -> a) -> [a] -> [a]
- Control.Category.Hask: sequence :: (Traversable t, Monad m) => t m a -> m t a
+ Control.Category.Hask: sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
- Control.Category.Hask: sequenceA :: (Traversable t, Applicative f) => t f a -> f t a
+ Control.Category.Hask: sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
- Control.Category.Hask: sequence_ :: (Foldable t, Monad m) => t m a -> m ()
+ Control.Category.Hask: sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
- Control.Category.Hask: span :: () => a -> Bool -> [a] -> ([a], [a])
+ Control.Category.Hask: span :: () => (a -> Bool) -> [a] -> ([a], [a])
- Control.Category.Hask: takeWhile :: () => a -> Bool -> [a] -> [a]
+ Control.Category.Hask: takeWhile :: () => (a -> Bool) -> [a] -> [a]
- Control.Category.Hask: traverse :: (Traversable t, Applicative f) => a -> f b -> t a -> f t b
+ Control.Category.Hask: traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
- Control.Category.Hask: uncurry :: () => a -> b -> c -> (a, b) -> c
+ Control.Category.Hask: uncurry :: () => (a -> b -> c) -> (a, b) -> c
- Control.Category.Hask: until :: () => a -> Bool -> a -> a -> a -> a
+ Control.Category.Hask: until :: () => (a -> Bool) -> (a -> a) -> a -> a
- Control.Category.Hask: zipWith :: () => a -> b -> c -> [a] -> [b] -> [c]
+ Control.Category.Hask: zipWith :: () => (a -> b -> c) -> [a] -> [b] -> [c]
- Control.Category.Hask: zipWith3 :: () => a -> b -> c -> d -> [a] -> [b] -> [c] -> [d]
+ Control.Category.Hask: zipWith3 :: () => (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
- Control.Functor.Constrained: constrainedFmap :: (Category r, Category t, o a, o b, o (f a), o (f b)) => (r a b -> t (f a) (f b)) -> ConstrainedCategory r o a b -> ConstrainedCategory t o (f a) (f b)
+ Control.Functor.Constrained: constrainedFmap :: (Category r, Category t, o a, o b, o (f a), o (f b)) => (r a b -> t (f a) (f b)) -> (o ⊢ r) a b -> (o ⊢ t) (f a) (f b)
- Control.Monad.Constrained: (<=<) :: (Monad m k, Object k a, Object k b, Object k c, Object k (m b), Object k (m c), Object k (m (m c))) => b `k` m c -> a `k` m b -> a `k` m c
+ Control.Monad.Constrained: (<=<) :: (Monad m k, Object k a, Object k b, Object k c, Object k (m b), Object k (m c), Object k (m (m c))) => (b `k` m c) -> (a `k` m b) -> a `k` m c
- Control.Monad.Constrained: (>=>) :: (Monad m k, Object k a, Object k b, Object k c, Object k (m b), Object k (m c), Object k (m (m c))) => a `k` m b -> b `k` m c -> a `k` m c
+ Control.Monad.Constrained: (>=>) :: (Monad m k, Object k a, Object k b, Object k c, Object k (m b), Object k (m c), Object k (m (m c))) => (a `k` m b) -> (b `k` m c) -> a `k` m c
- Control.Monad.Constrained: fail :: (MonadFail m k, (Object k (m a))) => k String (m a)
+ Control.Monad.Constrained: fail :: (MonadFail m k, Object k (m a)) => k String (m a)
- Control.Monad.Constrained: filterM :: (PreArrow k, Monad m k, SumToProduct c k k, EndoTraversable c k, ObjectPair k Bool a, Object k (c a), Object k (m (c a)), ObjectPair k (Bool, a) (c (Bool, a)), ObjectPair k (m Bool) (m a), ObjectPair k (m (Bool, a)) (m (c (Bool, a))), TraversalObject k c (Bool, a)) => a `k` m Bool -> c a `k` m (c a)
+ Control.Monad.Constrained: filterM :: (PreArrow k, Monad m k, SumToProduct c k k, EndoTraversable c k, ObjectPair k Bool a, Object k (c a), Object k (m (c a)), ObjectPair k (Bool, a) (c (Bool, a)), ObjectPair k (m Bool) (m a), ObjectPair k (m (Bool, a)) (m (c (Bool, a))), TraversalObject k c (Bool, a)) => (a `k` m Bool) -> c a `k` m (c a)
- Control.Monad.Constrained: fmplus :: (MonadPlus m k, (ObjectPair k (m a) (m a))) => k (m a, m a) (m a)
+ Control.Monad.Constrained: fmplus :: (MonadPlus m k, ObjectPair k (m a) (m a)) => k (m a, m a) (m a)
- Control.Monad.Constrained: forM_ :: forall t k l f a b uk ul. (Foldable t k l, Monoidal f l l, Monoidal f k k, Function l, Arrow k (->), Arrow l (->), ul ~ UnitObject l, uk ~ UnitObject k, uk ~ ul, ObjectPair l ul ul, ObjectPair l (f ul) (f ul), ObjectPair l (f ul) (t a), ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair l (f ul) a, ObjectPair k b (f b), ObjectPair k b ul, ObjectPair k uk uk, ObjectPair k (f uk) a, ObjectPair k (f uk) (f uk)) => t a -> a `k` f b -> f uk
+ Control.Monad.Constrained: forM_ :: forall t k l f a b uk ul. (Foldable t k l, Monoidal f l l, Monoidal f k k, Function l, Arrow k (->), Arrow l (->), ul ~ UnitObject l, uk ~ UnitObject k, uk ~ ul, ObjectPair l ul ul, ObjectPair l (f ul) (f ul), ObjectPair l (f ul) (t a), ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair l (f ul) a, ObjectPair k b (f b), ObjectPair k b ul, ObjectPair k uk uk, ObjectPair k (f uk) a, ObjectPair k (f uk) (f uk)) => t a -> (a `k` f b) -> f uk
- Control.Monad.Constrained: mapM :: (Traversable s t k l, k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => a `k` m b -> t a `k` m (t b)
+ Control.Monad.Constrained: mapM :: (Traversable s t k l, k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => (a `k` m b) -> t a `k` m (t b)
- Control.Monad.Constrained: mapM_ :: forall t k o f a b u. (Foldable t k k, WellPointed k, Monoidal f k k, u ~ UnitObject k, ObjectPair k (f u) (t a), ObjectPair k (f u) a, ObjectPair k u (t a), ObjectPair k (t a) u, ObjectPair k (f u) (f u), ObjectPair k u u, ObjectPair k b u, Object k (f b)) => a `k` f b -> t a `k` f u
+ Control.Monad.Constrained: mapM_ :: forall t k o f a b u. (Foldable t k k, WellPointed k, Monoidal f k k, u ~ UnitObject k, ObjectPair k (f u) (t a), ObjectPair k (f u) a, ObjectPair k u (t a), ObjectPair k (t a) u, ObjectPair k (f u) (f u), ObjectPair k u u, ObjectPair k b u, Object k (f b)) => (a `k` f b) -> t a `k` f u
- Control.Monad.Constrained: mplus :: (MonadPlus m (->)) => m a -> m a -> m a
+ Control.Monad.Constrained: mplus :: MonadPlus m (->) => m a -> m a -> m a
- Control.Monad.Constrained: mzero :: (MonadZero m (->)) => m a
+ Control.Monad.Constrained: mzero :: MonadZero m (->) => m a
- Data.Foldable.Constrained: concatMap :: (Foldable f k l, Object k a, Object k [b], Object l (f a), Object l [b]) => a `k` [b] -> f a `l` [b]
+ Data.Foldable.Constrained: concatMap :: (Foldable f k l, Object k a, Object k [b], Object l (f a), Object l [b]) => (a `k` [b]) -> f a `l` [b]
- Data.Foldable.Constrained: forM_ :: forall t k l f a b uk ul. (Foldable t k l, Monoidal f l l, Monoidal f k k, Function l, Arrow k (->), Arrow l (->), ul ~ UnitObject l, uk ~ UnitObject k, uk ~ ul, ObjectPair l ul ul, ObjectPair l (f ul) (f ul), ObjectPair l (f ul) (t a), ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair l (f ul) a, ObjectPair k b (f b), ObjectPair k b ul, ObjectPair k uk uk, ObjectPair k (f uk) a, ObjectPair k (f uk) (f uk)) => t a -> a `k` f b -> f uk
+ Data.Foldable.Constrained: forM_ :: forall t k l f a b uk ul. (Foldable t k l, Monoidal f l l, Monoidal f k k, Function l, Arrow k (->), Arrow l (->), ul ~ UnitObject l, uk ~ UnitObject k, uk ~ ul, ObjectPair l ul ul, ObjectPair l (f ul) (f ul), ObjectPair l (f ul) (t a), ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair l (f ul) a, ObjectPair k b (f b), ObjectPair k b ul, ObjectPair k uk uk, ObjectPair k (f uk) a, ObjectPair k (f uk) (f uk)) => t a -> (a `k` f b) -> f uk
- Data.Foldable.Constrained: mapM_ :: forall t k o f a b u. (Foldable t k k, WellPointed k, Monoidal f k k, u ~ UnitObject k, ObjectPair k (f u) (t a), ObjectPair k (f u) a, ObjectPair k u (t a), ObjectPair k (t a) u, ObjectPair k (f u) (f u), ObjectPair k u u, ObjectPair k b u, Object k (f b)) => a `k` f b -> t a `k` f u
+ Data.Foldable.Constrained: mapM_ :: forall t k o f a b u. (Foldable t k k, WellPointed k, Monoidal f k k, u ~ UnitObject k, ObjectPair k (f u) (t a), ObjectPair k (f u) a, ObjectPair k u (t a), ObjectPair k (t a) u, ObjectPair k (f u) (f u), ObjectPair k u u, ObjectPair k b u, Object k (f b)) => (a `k` f b) -> t a `k` f u
- Data.Foldable.Constrained: traverse_ :: forall t k l o f a b uk ul. (Foldable t k l, PreArrow k, PreArrow l, Monoidal f l l, Monoidal f k k, ObjectPair l (f ul) (t a), ObjectPair k (f ul) a, ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair k b ul, Object k (f b), ObjectPair k (f ul) (f ul), ObjectPair k ul ul, uk ~ UnitObject k, ul ~ UnitObject l, uk ~ ul) => a `k` f b -> t a `l` f ul
+ Data.Foldable.Constrained: traverse_ :: forall t k l o f a b uk ul. (Foldable t k l, PreArrow k, PreArrow l, Monoidal f l l, Monoidal f k k, ObjectPair l (f ul) (t a), ObjectPair k (f ul) a, ObjectPair l ul (t a), ObjectPair l (t a) ul, ObjectPair k b ul, Object k (f b), ObjectPair k (f ul) (f ul), ObjectPair k ul ul, uk ~ UnitObject k, ul ~ UnitObject l, uk ~ ul) => (a `k` f b) -> t a `l` f ul
- Data.Traversable.Constrained: mapM :: (Traversable s t k l, k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => a `k` m b -> t a `k` m (t b)
+ Data.Traversable.Constrained: mapM :: (Traversable s t k l, k ~ l, s ~ t, Applicative m k k, Object k a, Object k (t a), ObjectPair k b (t b), ObjectPair k (m b) (m (t b)), TraversalObject k t b) => (a `k` m b) -> t a `k` m (t b)
- Data.Traversable.Constrained: traverse :: (Traversable s t k l, Monoidal f k l, Object l a, Object l (s a), ObjectPair k b (t b), ObjectPair l (f b) (f (t b)), TraversalObject k t b) => a `l` f b -> s a `l` f (t b)
+ Data.Traversable.Constrained: traverse :: (Traversable s t k l, Monoidal f k l, Object l a, Object l (s a), ObjectPair k b (t b), ObjectPair l (f b) (f (t b)), TraversalObject k t b) => (a `l` f b) -> s a `l` f (t b)
Files
- Control/Applicative/Constrained.hs +2/−2
- Control/Arrow/Constrained.hs +32/−23
- Control/Category/Constrained.hs +75/−17
- Control/Functor/Constrained.hs +4/−6
- Data/Foldable/Constrained.hs +2/−3
- Data/Traversable/Constrained.hs +0/−5
- constrained-categories.cabal +3/−1
Control/Applicative/Constrained.hs view
@@ -91,8 +91,8 @@ 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) )- -> ConstrainedCategory r o (a, b) c -> ConstrainedCategory t o (f a, f b) (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) constrainedFZipWith zf = constrained . zf . unconstrained
Control/Arrow/Constrained.hs view
@@ -82,6 +82,8 @@ import Control.Category.Discrete +import qualified Data.Functor.Contravariant as Hask+ infixr 1 >>>, <<< infixr 3 &&&, *** @@ -242,7 +244,7 @@ arr Refl = id instance EnhancedCat Coercion Discrete where arr Refl = id-instance Category f => EnhancedCat (ConstrainedCategory f o) Discrete where+instance Category f => EnhancedCat (o⊢f) Discrete where arr Refl = id -- | Many categories have as morphisms essentially /functions with extra properties/:@@ -260,9 +262,9 @@ ($) :: (Function f, Object f a, Object f b) => f a b -> a -> b f $ x = arr f x -instance (Function f) => EnhancedCat (->) (ConstrainedCategory f o) where+instance (Function f) => EnhancedCat (->) (o⊢f) where arr (ConstrainedMorphism q) = arr q-instance (EnhancedCat Discrete f) => EnhancedCat Discrete (ConstrainedCategory f o) where+instance (EnhancedCat Discrete f) => EnhancedCat Discrete (o⊢f) where arr (ConstrainedMorphism q) = arr q instance EnhancedCat (->) Coercion where@@ -305,71 +307,78 @@ unit = Hask.pure () const = Hask.const -constrainedArr :: (Category k, Category a, o b, o c )- => ( k b c -> a b c )- -> k b c -> ConstrainedCategory a o b c+constrainedArr :: (Category k, Category a, o b, o c ) => ( k b c -> a b c )+ -> k b c -> (o⊢a) b c constrainedArr ar = constrained . ar constrainedFirst :: ( Category a, Cartesian a, ObjectPair a b d, ObjectPair a c d )- => ( a b c -> a (b, d) (c, d) )- -> ConstrainedCategory a o b c -> ConstrainedCategory a o (b, d) (c, d)+ => ( a b c -> a (b, d) (c, d) )+ -> (o⊢a) b c -> (o⊢a) (b, d) (c, d) constrainedFirst fs = ConstrainedMorphism . fs . unconstrained constrainedSecond :: ( Category a, Cartesian a, ObjectPair a d b, ObjectPair a d c )- => ( a b c -> a (d, b) (d, c) )- -> ConstrainedCategory a o b c -> ConstrainedCategory a o (d, b) (d, c)+ => ( a b c -> a (d, b) (d, c) )+ -> (o⊢a) b c -> (o⊢a) (d, b) (d, c) constrainedSecond sn = ConstrainedMorphism . sn . unconstrained +instance Morphism Hask.Op where+ first (Hask.Op f) = Hask.Op $ first f+ second (Hask.Op f) = Hask.Op $ second f+ Hask.Op f *** Hask.Op g = Hask.Op $ f *** g+instance MorphChoice Hask.Op where+ left (Hask.Op f) = Hask.Op $ left f+ right (Hask.Op f) = Hask.Op $ right f+ Hask.Op f +++ Hask.Op g = Hask.Op $ f +++ g -instance (Morphism a, o (UnitObject a)) => Morphism (ConstrainedCategory a o) where+instance (Morphism a, o (UnitObject a)) => Morphism (o⊢a) where first = constrainedFirst first second = constrainedSecond second ConstrainedMorphism a *** ConstrainedMorphism b = ConstrainedMorphism $ a *** b -instance (PreArrow a, o (UnitObject a)) => PreArrow (ConstrainedCategory a o) where+instance (PreArrow a, o (UnitObject a)) => PreArrow (o⊢a) where ConstrainedMorphism a &&& ConstrainedMorphism b = ConstrainedMorphism $ a &&& b terminal = ConstrainedMorphism terminal fst = ConstrainedMorphism fst snd = ConstrainedMorphism snd -instance (WellPointed a, o (UnitObject a)) => WellPointed (ConstrainedCategory a o) where- type PointObject (ConstrainedCategory a o) x = PointObject a x+instance (WellPointed a, o (UnitObject a)) => WellPointed (o⊢a) where+ type PointObject (o⊢a) x = PointObject a x globalElement x = ConstrainedMorphism $ globalElement x unit = cstrCatUnit const x = ConstrainedMorphism $ const x cstrCatUnit :: forall a o . (WellPointed a, o (UnitObject a))- => CatTagged (ConstrainedCategory a o) (UnitObject a)+ => CatTagged (o⊢a) (UnitObject a) cstrCatUnit = retag (unit :: CatTagged a (UnitObject a)) instance (EnhancedCat a k, o (UnitObject a))- => EnhancedCat (ConstrainedCategory a o) k where+ => EnhancedCat (o⊢a) k where arr = constrainedArr arr constrainedLeft :: ( CoCartesian k, ObjectSum k b d, ObjectSum k c d )- => ( k b c -> k (b+d) (c+d) )- -> ConstrainedCategory k o b c -> ConstrainedCategory k o (b+d) (c+d)+ => ( k b c -> k (b+d) (c+d) )+ -> (o⊢k) b c -> (o⊢k) (b+d) (c+d) constrainedLeft fs = ConstrainedMorphism . fs . unconstrained constrainedRight :: ( CoCartesian k, ObjectSum k b c, ObjectSum k b d )- => ( k c d -> k (b+c) (b+d) )- -> ConstrainedCategory k o c d -> ConstrainedCategory k o (b+c) (b+d)+ => ( k c d -> k (b+c) (b+d) )+ -> (o⊢k) c d -> (o⊢k) (b+c) (b+d) constrainedRight fs = ConstrainedMorphism . fs . unconstrained -instance (MorphChoice k, o (ZeroObject k)) => MorphChoice (ConstrainedCategory k o) where+instance (MorphChoice k, o (ZeroObject k)) => MorphChoice (o⊢k) where left = constrainedLeft left right = constrainedRight right ConstrainedMorphism a +++ ConstrainedMorphism b = ConstrainedMorphism $ a +++ b -instance (PreArrChoice k, o (ZeroObject k)) => PreArrChoice (ConstrainedCategory k o) where+instance (PreArrChoice k, o (ZeroObject k)) => PreArrChoice (o⊢k) where ConstrainedMorphism a ||| ConstrainedMorphism b = ConstrainedMorphism $ a ||| b initial = ConstrainedMorphism initial coFst = ConstrainedMorphism coFst coSnd = ConstrainedMorphism coSnd instance (SPDistribute k, o (ZeroObject k), o (UnitObject k))- => SPDistribute (ConstrainedCategory k o) where+ => SPDistribute (o⊢k) where distribute = ConstrainedMorphism distribute unDistribute = ConstrainedMorphism unDistribute boolAsSwitch = ConstrainedMorphism boolAsSwitch
Control/Category/Constrained.hs view
@@ -13,6 +13,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-}+{-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE ExplicitNamespaces #-}@@ -20,6 +21,7 @@ #if __GLASGOW_HASKELL__ >= 800 {-# LANGUAGE UndecidableSuperClasses #-} #endif+{-# LANGUAGE LambdaCase #-} module Control.Category.Constrained ( -- * The category class@@ -30,10 +32,13 @@ -- * Monoidal with coproducts , type (+)() , CoCartesian (..), ObjectSum+ -- * The standard function category+ , type Hask -- * Isomorphisms , Isomorphic (..) -- * Constraining a category , ConstrainedCategory (ConstrainedMorphism)+ , type (⊢)() , constrained, unconstrained , ConstrainedFunction -- * Global-element proxies@@ -53,7 +58,10 @@ import Data.Void import Data.Type.Coercion import qualified Control.Category as Hask+import qualified Data.Functor.Contravariant as Hask (Op(..)) +import Data.Constraint.Trivial (Unconstrained)+ import Control.Category.Discrete -- | In mathematics, a category is defined as a class of /objects/, plus a class of@@ -86,6 +94,21 @@ id = Prelude.id (.) = (Prelude..) +instance Category Hask.Op where+ id = Hask.id+ (.) = (Hask..)++-- | The category of all Haskell types, with (wrapped) Haskell functions as morphisms.+-- This is just a type-wrapper, morally equivalent to the @(->)@ category itself.+-- The difference is that 'Control.Functor.Constrained.Functor' instances in the '(->)'+-- category are automatically inherited from the standard 'Prelude.Functor' instances+-- that most packages define their type for. The benefit of that is that normal+-- Haskell code keeps working when the "Prelude" classes are replaced with the ones+-- from this library, but the downside is that you can't make /more gradual/ instances+-- when this is desired. This is where the 'Hask' category comes in: it only has functors+-- that are explicitly declared as such.+type Hask = Unconstrained⊢(->)+ -- | Analogue to 'asTypeOf', this does not actually do anything but can -- give the compiler type unification hints in a convenient manner. inCategoryOf :: (Category k) => k a b -> k c d -> k a b@@ -95,15 +118,22 @@ -- | A given category can be specialised, by using the same morphisms but adding -- extra constraints to what is considered an object. -- --- For instance, @'ConstrainedCategory' (->) 'Ord'@ is the category of all+-- For instance, @'Ord'⊢(->)@ is the category of all -- totally ordered data types (but with arbitrary functions; this does not require -- monotonicity or anything). newtype ConstrainedCategory (k :: * -> * -> *) (o :: * -> Constraint) (a :: *) (b :: *) = ConstrainedMorphism { unconstrainedMorphism :: k a b } +type o ⊢ k = ConstrainedCategory k o+ -- | Cast a morphism to its equivalent in a more constrained category, -- provided it connects objects that actually satisfy the extra constraint.-constrained :: (Category k, o a, o b) => k a b -> ConstrainedCategory k o a b+-- +-- In practice, it is often necessary to specify to what typeclass it should be+-- constrained. The most convenient way of doing that is with+-- <https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#extension-TypeApplications type-applications syntax>.+-- E.g. @'constrained' \@Ord length@ is the 'length' function considered as a morphism in the subcategory of Hask in which all types are orderable. (Which makes it suitable for e.g. fmapping over a set.)+constrained :: ∀ o k a b . (Category k, o a, o b) => k a b -> (o⊢k) a b constrained = ConstrainedMorphism -- | \"Unpack\" a constrained morphism again (forgetful functor).@@ -112,11 +142,11 @@ -- morphisms that are actually 'Function's can just be applied -- to their objects with '$' right away, no need to go back to -- Hask first.-unconstrained :: (Category k) => ConstrainedCategory k o a b -> k a b+unconstrained :: ∀ o k a b . (Category k) => (o⊢k) a b -> k a b unconstrained = unconstrainedMorphism -instance (Category k) => Category (ConstrainedCategory k isObj) where- type Object (ConstrainedCategory k isObj) o = (Object k o, isObj o)+instance (Category k) => Category (isObj⊢k) where+ type Object (isObj⊢k) o = (Object k o, isObj o) id = ConstrainedMorphism id ConstrainedMorphism f . ConstrainedMorphism g = ConstrainedMorphism $ f . g @@ -214,8 +244,8 @@ swap :: ( ObjectPair k a b, ObjectPair k b a ) => k (a,b) (b,a) - attachUnit :: ( u ~ UnitObject k, ObjectPair k a u ) => k a (a,u)- detachUnit :: ( u ~ UnitObject k, ObjectPair k a u ) => k (a,u) a+ attachUnit :: ( unit ~ UnitObject k, ObjectPair k a unit ) => k a (a,unit)+ detachUnit :: ( unit ~ UnitObject k, ObjectPair k a unit ) => k (a,unit) a regroup :: ( ObjectPair k a b, ObjectPair k b c , ObjectPair k a (b,c), ObjectPair k (a,b) c ) => k (a, (b, c)) ((a, b), c)@@ -234,10 +264,17 @@ detachUnit = \(a, ()) -> a regroup = \(a, (b, c)) -> ((a, b), c) regroup' = \((a, b), c) -> (a, (b, c))++instance Cartesian Hask.Op where+ swap = Hask.Op $ \(a,b) -> (b,a)+ attachUnit = Hask.Op $ \(a, ()) -> a+ detachUnit = Hask.Op $ \a -> (a, ())+ regroup = Hask.Op $ \((a, b), c) -> (a, (b, c))+ regroup' = Hask.Op $ \(a, (b, c)) -> ((a, b), c) -instance (Cartesian f, o (UnitObject f)) => Cartesian (ConstrainedCategory f o) where- type PairObjects (ConstrainedCategory f o) a b = (PairObjects f a b)- type UnitObject (ConstrainedCategory f o) = UnitObject f+instance (Cartesian f, o (UnitObject f)) => Cartesian (o⊢f) where+ type PairObjects (o⊢f) a b = (PairObjects f a b)+ type UnitObject (o⊢f) = UnitObject f swap = ConstrainedMorphism swap attachUnit = ConstrainedMorphism attachUnit@@ -272,8 +309,8 @@ coSwap :: ( ObjectSum k a b, ObjectSum k b a ) => k (a+b) (b+a) - attachZero :: ( Object k a, z ~ ZeroObject k, ObjectSum k a z ) => k a (a+z)- detachZero :: ( Object k a, z ~ ZeroObject k, ObjectSum k a z ) => k (a+z) a+ attachZero :: ( Object k a, zero ~ ZeroObject k, ObjectSum k a zero ) => k a (a+zero)+ detachZero :: ( Object k a, zero ~ ZeroObject k, ObjectSum k a zero ) => k (a+zero) a coRegroup :: ( Object k a, Object k c, ObjectSum k a b, ObjectSum k b c , ObjectSum k a (b+c), ObjectSum k (a+b) c ) => k (a+(b+c)) ((a+b)+c)@@ -319,10 +356,31 @@ -- boolFromSwitch (Left x) = (False,x) -- boolFromSwitch (Right x) = (True,x) -- -instance (CoCartesian f, o (ZeroObject f)) => CoCartesian (ConstrainedCategory f o) where- type SumObjects (ConstrainedCategory f o) a b = (SumObjects f a b)- type ZeroObject (ConstrainedCategory f o) = ZeroObject f+instance CoCartesian Hask.Op where+ coSwap = Hask.Op $ \case Right a -> Left a+ Left a -> Right a+ attachZero = Hask.Op $ \case Left a -> a+ Right void -> absurd void+ detachZero = Hask.Op Left+ coRegroup = Hask.Op $ \case Left (Left a) -> Left a+ Left (Right a) -> (Right (Left a))+ Right a -> Right (Right a)+ coRegroup' = Hask.Op $ \case (Left a) -> Left (Left a)+ Right (Left a) -> Left (Right a)+ Right (Right a) -> Right a+ maybeFromSum = Hask.Op $ \case Nothing -> Left ()+ Just x -> Right x+ maybeAsSum = Hask.Op $ \case Left () -> Nothing+ Right x -> Just x+ boolFromSum = Hask.Op $ \case False -> Left ()+ True -> Right ()+ boolAsSum = Hask.Op $ \case Left () -> False+ Right () -> True +instance (CoCartesian f, o (ZeroObject f)) => CoCartesian (o⊢f) where+ type SumObjects (o⊢f) a b = (SumObjects f a b)+ type ZeroObject (o⊢f) = ZeroObject f+ coSwap = ConstrainedMorphism coSwap attachZero = ConstrainedMorphism attachZero detachZero = ConstrainedMorphism detachZero@@ -369,8 +427,8 @@ apply (f,x) = f x -instance (Curry f, o (UnitObject f)) => Curry (ConstrainedCategory f o) where- type MorphObjects (ConstrainedCategory f o) a c = ( MorphObjects f a c, f ~ (->) )+instance (Curry f, o (UnitObject f)) => Curry (o⊢f) where+ type MorphObjects (o⊢f) a c = ( MorphObjects f a c, f ~ (->) ) uncurry (ConstrainedMorphism f) = ConstrainedMorphism $ \(a,b) -> unconstrained (f a) b curry (ConstrainedMorphism f) = ConstrainedMorphism $ \a -> ConstrainedMorphism $ \b -> f (a, b)
Control/Functor/Constrained.hs view
@@ -90,16 +90,14 @@ constrainedFmap :: (Category r, Category t, o a, o b, o (f a), o (f b)) - => ( r a b -> t (f a) (f b) ) - -> ConstrainedCategory r o a b -> ConstrainedCategory t o (f a) (f b)+ => ( r a b -> t (f a) (f b) ) + -> (o⊢r) a b -> (o⊢t) (f a) (f b) constrainedFmap q = constrained . q . unconstrained -instance (Functor [] k k, o [UnitObject k]) - => Functor [] (ConstrainedCategory k o) (ConstrainedCategory k o) where+instance (Functor [] k k, o [UnitObject k]) => Functor [] (o⊢k) (o⊢k) where fmap (ConstrainedMorphism f) = ConstrainedMorphism $ fmap f -instance (o (), o [()], o Void, o [Void]) => SumToProduct []- (ConstrainedCategory (->) o) (ConstrainedCategory (->) o) where+instance (o (), o [()], o Void, o [Void]) => SumToProduct [] (o⊢(->)) (o⊢(->)) where sum2product = ConstrainedMorphism sum2product mapEither (ConstrainedMorphism f) = ConstrainedMorphism $ mapEither f filter (ConstrainedMorphism f) = ConstrainedMorphism $ filter f
Data/Foldable/Constrained.hs view
@@ -127,9 +127,8 @@ ffoldl f (i,Just a) = f(i,a) -instance ( Foldable f s t, WellPointed s, WellPointed t- , Functor f (ConstrainedCategory s o) (ConstrainedCategory t o) - ) => Foldable f (ConstrainedCategory s o) (ConstrainedCategory t o) where+instance ( Foldable f s t, WellPointed s, WellPointed t, Functor f (o⊢s) (o⊢t) )+ => Foldable f (o⊢s) (o⊢t) where foldMap (ConstrainedMorphism f) = ConstrainedMorphism $ foldMap f ffoldl (ConstrainedMorphism f) = ConstrainedMorphism $ ffoldl f
Data/Traversable/Constrained.hs view
@@ -91,11 +91,6 @@ where mM Nothing = constPure Nothing `inCategoryOf` f $ mempty mM (Just x) = fmap (arr Just) . f $ x --- data Stupid a = Stupid a--- instance Functor Stupid (ConstrainedCategory (->) Num) (->) where--- fmap (Stupid (ConstrainedMorphism f)) (Stupid a) = Stupid (f a)--- - -- | Flipped version of 'traverse' / 'mapM'. forM :: forall s t k m a b l . ( Traversable s t k l, Monoidal m k l, Function l
constrained-categories.cabal view
@@ -1,5 +1,5 @@ Name: constrained-categories-Version: 0.3.1.1+Version: 0.4.0.0 Category: control Synopsis: Constrained clones of the category-theory type classes, using ConstraintKinds. Description: Haskell has, and makes great use of, powerful facilities from category@@ -44,6 +44,8 @@ , tagged , void , semigroups+ , contravariant+ , trivial-constraint >= 0.4 && < 0.5 Default-Extensions: ConstraintKinds TypeFamilies FlexibleInstances