packages feed

pandora 0.1.5 → 0.1.6

raw patch · 35 files changed

+326/−204 lines, 35 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Pandora.Core.Functor: type Natural t u = forall a. (Covariant t, Covariant u) => t a -> u a
- Pandora.Paradigm.Junction.Transformer: instance (forall (u :: * -> *). Pandora.Pattern.Functor.Extractable.Extractable u, Pandora.Pattern.Functor.Lowerable.Lowerable t) => Pandora.Pattern.Functor.Lowerable.Lowerable (Pandora.Paradigm.Junction.Transformer.Y t)
- Pandora.Paradigm.Junction.Transformer: instance (forall (u :: * -> *). Pandora.Pattern.Functor.Pointable.Pointable u, Pandora.Pattern.Functor.Liftable.Liftable t) => Pandora.Pattern.Functor.Liftable.Liftable (Pandora.Paradigm.Junction.Transformer.Y t)
- Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u1 :: k2 -> *). Pandora.Pattern.Object.Chain.Chain ((Pandora.Core.Functor.:.:) u1 (t u1) a)) => Pandora.Pattern.Object.Chain.Chain (Pandora.Paradigm.Junction.Transformer.Y t u a)
- Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u1 :: k2 -> *). Pandora.Pattern.Object.Monoid.Monoid ((Pandora.Core.Functor.:.:) u1 (t u1) a)) => Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Junction.Transformer.Y t u a)
- Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u1 :: k2 -> *). Pandora.Pattern.Object.Semigroup.Semigroup ((Pandora.Core.Functor.:.:) u1 (t u1) a)) => Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Junction.Transformer.Y t u a)
- Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u1 :: k2 -> *). Pandora.Pattern.Object.Setoid.Setoid ((Pandora.Core.Functor.:.:) u1 (t u1) a)) => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Junction.Transformer.Y t u a)
- Pandora.Pattern.Object.Monoid: unit :: Monoid a => a
- Pandora.Pattern.Object.Ringoid: (><) :: Ringoid a => a -> a -> a
- Pandora.Pattern.Object.Semigroup: (<>) :: Semigroup a => a -> a -> a
+ Pandora.Core.Transformation: type (~>) t u = Natural t u
+ Pandora.Core.Transformation: type Natural t u = forall a. (Covariant t, Covariant u) => t a -> u a
+ Pandora.Paradigm.Junction.Transformer: instance (forall (u' :: * -> *). Pandora.Pattern.Functor.Extractable.Extractable u', Pandora.Pattern.Functor.Lowerable.Lowerable t) => Pandora.Pattern.Functor.Lowerable.Lowerable (Pandora.Paradigm.Junction.Transformer.Y t)
+ Pandora.Paradigm.Junction.Transformer: instance (forall (u' :: * -> *). Pandora.Pattern.Functor.Pointable.Pointable u', Pandora.Pattern.Functor.Liftable.Liftable t) => Pandora.Pattern.Functor.Liftable.Liftable (Pandora.Paradigm.Junction.Transformer.Y t)
+ Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u' :: k2 -> *). Pandora.Pattern.Object.Chain.Chain ((Pandora.Core.Functor.:.:) u' (t u') a)) => Pandora.Pattern.Object.Chain.Chain (Pandora.Paradigm.Junction.Transformer.Y t u a)
+ Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u' :: k2 -> *). Pandora.Pattern.Object.Monoid.Monoid ((Pandora.Core.Functor.:.:) u' (t u') a)) => Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Junction.Transformer.Y t u a)
+ Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u' :: k2 -> *). Pandora.Pattern.Object.Semigroup.Semigroup ((Pandora.Core.Functor.:.:) u' (t u') a)) => Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Junction.Transformer.Y t u a)
+ Pandora.Paradigm.Junction.Transformer: instance forall k1 k2 (t :: (k2 -> *) -> k1 -> k2) (a :: k1) (u :: k2 -> *). (forall (u' :: k2 -> *). Pandora.Pattern.Object.Setoid.Setoid ((Pandora.Core.Functor.:.:) u' (t u') a)) => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Junction.Transformer.Y t u a)
+ Pandora.Pattern.Functor.Contravariant: (>$$$$<) :: (Contravariant t, Contravariant u, Contravariant v, Contravariant w) => (a -> b) -> (t :.: (u :.: (v :.: w))) a -> (t :.: (u :.: (v :.: w))) b
+ Pandora.Pattern.Functor.Contravariant: (>$$<) :: (Contravariant t, Contravariant u) => (a -> b) -> (t :.: u) a -> (t :.: u) b
+ Pandora.Pattern.Functor.Contravariant: (>&&&&<) :: (Contravariant t, Contravariant u, Contravariant v, Contravariant w) => (t :.: (u :.: (v :.: w))) a -> (a -> b) -> (t :.: (u :.: (v :.: w))) b
+ Pandora.Pattern.Functor.Contravariant: (>&&&<) :: (Contravariant t, Contravariant u, Contravariant v) => (t :.: (u :.: v)) b -> (a -> b) -> (t :.: (u :.: v)) a
+ Pandora.Pattern.Functor.Contravariant: (>&&<) :: (Contravariant t, Contravariant u) => (t :.: u) a -> (a -> b) -> (t :.: u) b
+ Pandora.Pattern.Functor.Covariant: (<&&&&>) :: (Covariant t, Covariant u, Covariant v, Covariant w) => (t :.: (u :.: (v :.: w))) a -> (a -> b) -> (t :.: (u :.: (v :.: w))) b
+ Pandora.Pattern.Functor.Covariant: (<&&&>) :: (Covariant t, Covariant u, Covariant v) => (t :.: (u :.: v)) a -> (a -> b) -> (t :.: (u :.: v)) b
+ Pandora.Pattern.Functor.Covariant: (<&&>) :: (Covariant t, Covariant u) => (t :.: u) a -> (a -> b) -> (t :.: u) b
+ Pandora.Pattern.Functor.Distributive: (>>>-) :: (Distributive u, Covariant t, Covariant v) => (t :.: v) a -> (a -> u b) -> (u :.: (t :.: v)) b
+ Pandora.Pattern.Functor.Distributive: (>>>>-) :: (Distributive u, Covariant t, Covariant v, Covariant w) => (t :.: (v :.: w)) a -> (a -> u b) -> (u :.: (t :.: (v :.: w))) b
+ Pandora.Pattern.Functor.Distributive: (>>>>>-) :: (Distributive u, Covariant t, Covariant v, Covariant w, Covariant j) => (t :.: (v :.: (w :.: j))) a -> (a -> u b) -> (u :.: (t :.: (v :.: (w :.: j)))) b
+ Pandora.Pattern.Functor.Distributive: infixl 5 >>>>>-
+ Pandora.Pattern.Functor.Traversable: (->>>) :: (Traversable t, Pointable u, Applicative u, Traversable v) => (v :.: t) a -> (a -> u b) -> (u :.: (v :.: t)) b
+ Pandora.Pattern.Functor.Traversable: (->>>>) :: (Traversable t, Pointable u, Applicative u, Traversable v, Traversable w) => (w :.: (v :.: t)) a -> (a -> u b) -> (u :.: (w :.: (v :.: t))) b
+ Pandora.Pattern.Functor.Traversable: (->>>>>) :: (Traversable t, Pointable u, Applicative u, Traversable v, Traversable w, Traversable j) => (j :.: (w :.: (v :.: t))) a -> (a -> u b) -> (u :.: (j :.: (w :.: (v :.: t)))) b
+ Pandora.Pattern.Functor.Traversable: infixl 5 ->>>>>
+ Pandora.Pattern.Object.Monoid: zero :: Monoid a => a
+ Pandora.Pattern.Object.Quasiring: class (Monoid a, Ringoid a) => Quasiring a
+ Pandora.Pattern.Object.Quasiring: one :: Quasiring a => a
+ Pandora.Pattern.Object.Ringoid: (*) :: Ringoid a => a -> a -> a
+ Pandora.Pattern.Object.Semigroup: (+) :: Semigroup a => a -> a -> a
- Pandora.Pattern.Functor.Contravariant: (>$$$<) :: (Contravariant t, Contravariant u, Contravariant v) => (a -> b) -> t (u (v b)) -> t (u (v a))
+ Pandora.Pattern.Functor.Contravariant: (>$$$<) :: (Contravariant t, Contravariant u, Contravariant v) => (a -> b) -> (t :.: (u :.: v)) b -> (t :.: (u :.: v)) a
- Pandora.Pattern.Functor.Covariant: (<$$$$>) :: (Covariant t, Covariant u, Covariant v, Covariant w) => (a -> b) -> t (u (v (w a))) -> t (u (v (w b)))
+ Pandora.Pattern.Functor.Covariant: (<$$$$>) :: (Covariant t, Covariant u, Covariant v, Covariant w) => (a -> b) -> (t :.: (u :.: (v :.: w))) a -> (t :.: (u :.: (v :.: w))) b
- Pandora.Pattern.Functor.Covariant: (<$$$>) :: (Covariant t, Covariant u, Covariant v) => (a -> b) -> t (u (v a)) -> t (u (v b))
+ Pandora.Pattern.Functor.Covariant: (<$$$>) :: (Covariant t, Covariant u, Covariant v) => (a -> b) -> (t :.: (u :.: v)) a -> (t :.: (u :.: v)) b
- Pandora.Pattern.Functor.Covariant: (<$$>) :: (Covariant t, Covariant u) => (a -> b) -> t (u a) -> t (u b)
+ Pandora.Pattern.Functor.Covariant: (<$$>) :: (Covariant t, Covariant u) => (a -> b) -> (t :.: u) a -> (t :.: u) b

Files

CHANGELOG.md view
@@ -49,3 +49,13 @@ * Define `Tagged` datatype for attaching type information to the value * Define `Proxy` datatype for holding no data, but having a phantom parameter * Define `Validation` datatype (similar to `Conclusion`, but can collect errors)++# 0.1.6+* Define `->>>`, `->>>>`, `->>>>>` methods for `Traversable` to compact expressions+* Move `Natural` transformation from `Functor` to `Transformation` module+* Define infix and infix flipped versions of methods of `Functor` typeclasses+* Define `>>>-`, `>>>>-`, `>>>>>-` methods for `Distributive` to compact expressions+* Rename `<>` method of `Semigroup` typeclass to `+`+* Rename `><` method of `Ringoid` typeclass to `*`+* Rename `unit` to `zero` method of `Monoid` typeclass+* Define `Quasiring` typeclass
Pandora/Core/Functor.hs view
@@ -1,10 +1,4 @@-module Pandora.Core.Functor (Variant (..), Natural, type (~>), type (:.:)) where--import Pandora.Pattern.Functor.Covariant (Covariant)--type Natural t u = forall a . (Covariant t, Covariant u) => t a -> u a--type (~>) t u = Natural t u+module Pandora.Core.Functor (Variant (..), type (:.:)) where  data Variant = Co | Contra 
Pandora/Core/Morphism.hs view
@@ -27,7 +27,7 @@  {-# INLINE (!) #-} (!) :: a -> b -> a-x ! y = x+x ! _ = x  {-# INLINE (?) #-} (?) :: (a -> b -> c) -> b -> a -> c
+ Pandora/Core/Transformation.hs view
@@ -0,0 +1,7 @@+module Pandora.Core.Transformation (Natural, type (~>)) where++import Pandora.Pattern.Functor.Covariant (Covariant)++type Natural t u = forall a . (Covariant t, Covariant u) => t a -> u a++type (~>) t u = Natural t u
Pandora/Paradigm/Basis.hs view
@@ -21,8 +21,8 @@ import Pandora.Paradigm.Basis.Constant as Exports import Pandora.Paradigm.Basis.Identity as Exports -import Pandora.Core.Functor (type (~>)) import Pandora.Core.Morphism ((!))+import Pandora.Core.Transformation (type (~>))  note :: e -> Maybe ~> Conclusion e note x = maybe (Failure x) Success
Pandora/Paradigm/Basis/Conclusion.hs view
@@ -11,7 +11,7 @@ import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (False)) import Pandora.Pattern.Object.Chain (Chain ((<=>)), Ordering (Less, Greater))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))  data Conclusion e a = Failure e | Success a @@ -57,10 +57,10 @@ 	Success _ <=> Failure _ = Greater  instance (Semigroup e, Semigroup a) => Semigroup (Conclusion e a) where-	Success x <> Success y = Success $ x <> y-	Failure x <> Failure y = Failure $ x <> y-	Failure _ <> Success y = Success y-	Success x <> Failure _ = Success x+	Success x + Success y = Success $ x + y+	Failure x + Failure y = Failure $ x + y+	Failure _ + Success y = Success y+	Success x + Failure _ = Success x  conclusion :: (e -> r) -> (a -> r) -> Conclusion e a -> r conclusion f _ (Failure x) = f x
Pandora/Paradigm/Basis/Constant.hs view
@@ -8,9 +8,9 @@ import Pandora.Pattern.Functor.Traversable (Traversable ((->>))) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>)))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))-import Pandora.Pattern.Object.Ringoid (Ringoid ((><)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Pattern.Object.Ringoid (Ringoid ((*))) import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (inverse))@@ -36,13 +36,13 @@ 	Constant x <=> Constant y = x <=> y  instance Semigroup a => Semigroup (Constant a b) where-	Constant x <> Constant y = Constant $ x <> y+	Constant x + Constant y = Constant $ x + y  instance Monoid a => Monoid (Constant a b) where-	 unit = Constant unit+	 zero = Constant zero  instance Ringoid a => Ringoid (Constant a b) where-	Constant x >< Constant y = Constant $ x >< y+	Constant x * Constant y = Constant $ x * y  instance Infimum a => Infimum (Constant a b) where 	Constant x /\ Constant y = Constant $ x /\ y
Pandora/Paradigm/Basis/Endo.hs view
@@ -2,8 +2,8 @@  import Pandora.Core.Morphism ((.), identity) import Pandora.Pattern.Functor.Invariant (Invariant (invmap))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))  newtype Endo a = Endo { endo :: a -> a } @@ -11,7 +11,7 @@ 	invmap f g (Endo x) = Endo (f . x . g)  instance Semigroup (Endo a) where-	Endo f <> Endo g = Endo (g . f)+	Endo f + Endo g = Endo (g . f)  instance Monoid (Endo a) where-	unit = Endo identity+	zero = Endo identity
Pandora/Paradigm/Basis/Free.hs view
@@ -1,20 +1,20 @@ module Pandora.Paradigm.Basis.Free (Free (..)) where  import Pandora.Core.Functor (type (:.:))-import Pandora.Core.Morphism ((.), ($))-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Core.Morphism (($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>))) import Pandora.Pattern.Functor.Avoidable (Avoidable (idle)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))-import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), (->>>))) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))  data Free t a = Pure a | Impure ((t :.: Free t) a)  instance Covariant t => Covariant (Free t) where 	f <$> Pure x = Pure $ f x-	f <$> Impure xs = Impure $ (comap . comap) f xs+	f <$> Impure xs = Impure $ f <$$> xs  instance Covariant t => Pointable (Free t) where 	point = Pure@@ -29,7 +29,7 @@  instance Covariant t => Applicative (Free t) where 	Pure f <*> Pure y = Pure $ f y-	Pure f <*> Impure y = Impure $ comap f <$> y+	Pure f <*> Impure y = Impure $ f <$$> y 	Impure f <*> y = Impure $ (<*> y) <$> f  instance Covariant t => Bindable (Free t) where@@ -38,4 +38,4 @@  instance Traversable t => Traversable (Free t) where 	Pure x ->> f = Pure <$> f x-	Impure xs ->> f = Impure <$> (traverse . traverse) f xs+	Impure xs ->> f = Impure <$> xs ->>> f
Pandora/Paradigm/Basis/Identity.hs view
@@ -14,9 +14,9 @@ import Pandora.Pattern.Functor.Adjoint (Adjoint (phi, psi)) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>)))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))-import Pandora.Pattern.Object.Ringoid (Ringoid ((><)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Pattern.Object.Ringoid (Ringoid ((*))) import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (inverse))@@ -62,13 +62,13 @@ 	Identity x <=> Identity y = x <=> y  instance Semigroup a => Semigroup (Identity a) where-	Identity x <> Identity y = Identity $ x <> y+	Identity x + Identity y = Identity $ x + y  instance Monoid a => Monoid (Identity a) where-	 unit = Identity unit+	 zero = Identity zero  instance Ringoid a => Ringoid (Identity a) where-	Identity x >< Identity y = Identity $ x >< y+	Identity x * Identity y = Identity $ x * y  instance Infimum a => Infimum (Identity a) where 	Identity x /\ Identity y = Identity $ x /\ y
Pandora/Paradigm/Basis/Jet.hs view
@@ -1,22 +1,21 @@ module Pandora.Paradigm.Basis.Jet (Jet (..)) where -import Pandora.Core.Morphism ((.))-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)), comap)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)), (<$$>)) import Pandora.Pattern.Functor.Avoidable (Avoidable (idle)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Extractable (Extractable (extract)) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))-import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), (->>>)))  infixr 5 :-  data Jet t a = a :- Jet t (t a)  instance Covariant t => Covariant (Jet t) where-	f <$> a :- as = f a :- (comap . comap) f as+	f <$> a :- as = f a :- (f <$$> as)  instance Traversable t => Traversable (Jet t) where-	(a :- as) ->> f = (:-) <$> f a <*> (traverse . traverse) f as+	(a :- as) ->> f = (:-) <$> f a <*> as ->>> f  instance (forall t' . Avoidable t') => Pointable (Jet t) where 	point x = x :- idle
Pandora/Paradigm/Basis/Maybe.hs view
@@ -12,8 +12,8 @@ import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (True, False)) import Pandora.Pattern.Object.Chain (Chain ((<=>)), Ordering (Less, Equal, Greater))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero)) import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) @@ -64,12 +64,12 @@ 	Just _ <=> Nothing = Greater  instance Semigroup a => Semigroup (Maybe a) where-	Just x <> Just y = Just $ x <> y-	Nothing <> x = x-	x <> Nothing = x+	Just x + Just y = Just $ x + y+	Nothing + x = x+	x + Nothing = x  instance Semigroup a => Monoid (Maybe a) where-	unit = Nothing+	zero = Nothing  instance Infimum a => Infimum (Maybe a) where 	Just x /\ Just y = Just $ x /\ y
Pandora/Paradigm/Basis/Product.hs view
@@ -9,9 +9,9 @@ import Pandora.Pattern.Functor.Comonad (Comonad) import Pandora.Pattern.Functor.Adjoint (Adjoint (phi, psi)) import Pandora.Pattern.Object.Setoid (Setoid ((==)), (&&))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))-import Pandora.Pattern.Object.Ringoid (Ringoid ((><)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Pattern.Object.Ringoid (Ringoid ((*))) import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (inverse))@@ -44,13 +44,13 @@ 	(x :*: y) == (x' :*: y') = x == x' && y == y'  instance (Semigroup a, Semigroup b) => Semigroup (Product a b) where-	(x :*: y) <> (x' :*: y') = x <> x' :*: y <> y'+	(x :*: y) + (x' :*: y') = x + x' :*: y + y'  instance (Monoid a, Monoid b) => Monoid (Product a b) where-	unit = unit :*: unit+	zero = zero :*: zero  instance (Ringoid a, Ringoid b) => Ringoid (Product a b) where-	(x :*: y) >< (x' :*: y') = x >< x' :*: y >< y'+	(x :*: y) * (x' :*: y') = x * x' :*: y * y'  instance (Infimum a, Infimum b) => Infimum (Product a b) where 	(x :*: y) /\ (x' :*: y') = x /\ x' :*: y /\ y'
Pandora/Paradigm/Basis/Tagged.hs view
@@ -13,9 +13,9 @@ import Pandora.Pattern.Functor.Comonad (Comonad) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>)))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))-import Pandora.Pattern.Object.Ringoid (Ringoid ((><)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Pattern.Object.Ringoid (Ringoid ((*))) import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (inverse))@@ -57,13 +57,13 @@ 	Tagged x <=> Tagged y = x <=> y  instance Semigroup a => Semigroup (Tagged tag a) where-	Tagged x <> Tagged y = Tagged $ x <> y+	Tagged x + Tagged y = Tagged $ x + y  instance Monoid a => Monoid (Tagged tag a) where-	 unit = Tagged unit+	 zero = Tagged zero  instance Ringoid a => Ringoid (Tagged tag a) where-	Tagged x >< Tagged y = Tagged $ x >< y+	Tagged x * Tagged y = Tagged $ x * y  instance Infimum a => Infimum (Tagged tag a) where 	Tagged x /\ Tagged y = Tagged $ x /\ y
Pandora/Paradigm/Basis/Twister.hs view
@@ -1,28 +1,28 @@ module Pandora.Paradigm.Basis.Twister (Twister (..), unwrap, coiterate, section) where -import Pandora.Core.Functor (type (:.:), type (~>))-import Pandora.Core.Morphism ((.))-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Transformation (type (~>))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>), comap)) import Pandora.Pattern.Functor.Avoidable (Avoidable (idle)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Extractable (Extractable (extract)) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))-import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), (->>>))) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Extendable (Extendable ((=>>), extend)) import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Comonad (Comonad) import Pandora.Pattern.Object.Setoid (Setoid ((==)), (&&))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))  infixr 5 :<  data Twister t a = a :< (t :.: Twister t) a  instance Covariant t => Covariant (Twister t) where-	f <$> (x :< xs) = f x :< ((comap . comap) f xs)+	f <$> (x :< xs) = f x :< (f <$$> xs)  instance Avoidable t => Pointable (Twister t) where 	point x = x :< idle@@ -34,14 +34,14 @@ 	(f :< fs) <*> (x :< xs) = f x :< ((<*>) <$> fs <*> xs)  instance Traversable t => Traversable (Twister t) where-	(x :< xs) ->> f = (:<) <$> f x <*> (traverse . traverse) f xs+	(x :< xs) ->> f = (:<) <$> f x <*> xs ->>> f  instance Alternative t => Bindable (Twister t) where 	(x :< xs) >>= f = case f x of 		y :< ys -> y :< (ys <+> comap (>>= f) xs)  instance Covariant t => Extendable (Twister t) where-	x =>> f = f x :< comap (extend f) (unwrap x)+	x =>> f = f x :< (extend f <$> unwrap x)  instance (Avoidable t, Alternative t) => Monad (Twister t) where @@ -51,10 +51,10 @@ 	(x :< xs) == (y :< ys) = x == y && xs == ys  instance (Semigroup a, forall b . Semigroup b => Semigroup (t b)) => Semigroup (Twister t a) where-	(x :< xs) <> (y :< ys) = (x <> y) :< (xs <> ys)+	(x :< xs) + (y :< ys) = (x + y) :< (xs + ys)  instance (Monoid a, forall b . Semigroup b => Monoid (t b)) => Monoid (Twister t a) where-	unit = unit :< unit+	zero = zero :< zero  unwrap :: Twister t a -> (t :.: Twister t) a unwrap (_ :< xs) = xs
Pandora/Paradigm/Basis/Validation.hs view
@@ -6,7 +6,7 @@ import Pandora.Pattern.Functor.Applicative (Applicative ((<*>))) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>))) import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))  data Validation e a = Flaws e | Validated a @@ -18,7 +18,7 @@ 	point = Validated  instance Semigroup e => Applicative (Validation e) where-	Flaws e <*> Flaws e' = Flaws $ e <> e'+	Flaws e <*> Flaws e' = Flaws $ e + e' 	Flaws e <*> Validated _ = Flaws e 	Validated _ <*> Flaws e2 = Flaws e2 	Validated f <*> Validated x = Validated $ f x
Pandora/Paradigm/Controlflow/Pipeline.hs view
@@ -14,10 +14,10 @@ newtype Pipe i o r t a = Pipe { pipe :: Producer i t r -> Consumer o t r -> t r }  instance Covariant (Pipe i o r t) where-	f <$> Pipe p = Pipe p+	_ <$> Pipe p = Pipe p  instance Contravariant (Pipe i o r t) where-	f >$< Pipe p = Pipe p+	_ >$< Pipe p = Pipe p  type Pipeline i o t a r = Continuation r (Pipe i o r t) a @@ -55,7 +55,7 @@ pipeline p = pipe (continue p (\r -> Pipe $ \_ _ -> point r)) i o where  	i :: Producer i t r-	i = Producer $ \o -> produce i o+	i = Producer $ \o' -> produce i o'  	o :: Consumer o t r-	o = Consumer $ \v i -> consume o v i+	o = Consumer $ \v i' -> consume o v i'
Pandora/Paradigm/Junction/Composition.hs view
@@ -2,14 +2,14 @@  import Pandora.Core.Functor (Variant (Co, Contra), type (:.:)) import Pandora.Core.Morphism ((.), ($))-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))-import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<), contramap))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>), (<$$$>), (<$$$$>), comap))+import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<), (>$$<), (>$$$<), (>$$$$<), contramap)) import Pandora.Pattern.Functor.Extractable (Extractable (extract)) import Pandora.Pattern.Functor.Avoidable (Avoidable (idle)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>), apply))-import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), (->>>), (->>>>), (->>>>>))) import Pandora.Pattern.Functor.Distributive (Distributive ((>>-), distribute)) import Pandora.Pattern.Functor.Adjoint (Adjoint (phi, psi)) @@ -18,167 +18,207 @@  newtype U ct cu t u a = U { u :: (t :.: u) a } -instance (Covariant t, Covariant u) => Covariant (U Co Co t u) where-	f <$> U x = U $ (comap . comap) f x+instance (Covariant t, Covariant u) => Covariant (U 'Co 'Co t u) where+	f <$> U x = U $ f <$$> x -instance (Covariant t, Contravariant u) => Contravariant (U Co Contra t u) where+instance (Covariant t, Contravariant u) => Contravariant (U 'Co 'Contra t u) where 	f >$< U x = U $ contramap f <$> x -instance (Contravariant t, Covariant u) => Contravariant (U Contra Co t u) where+instance (Contravariant t, Covariant u) => Contravariant (U 'Contra 'Co t u) where 	f >$< U x = U $ contramap (comap f) x -instance (Contravariant t, Contravariant u) => Covariant (U Contra Contra t u) where-	f <$> U x = U $ contramap (contramap f) x+instance (Contravariant t, Contravariant u) => Covariant (U 'Contra 'Contra t u) where+	f <$> U x = U $ f >$$< x -instance (Pointable t, Pointable u) => Pointable (U Co Co t u) where+instance (Pointable t, Pointable u) => Pointable (U 'Co 'Co t u) where 	point = U . point . point -instance (Extractable t, Extractable u) => Extractable (U Co Co t u) where+instance (Extractable t, Extractable u) => Extractable (U 'Co 'Co t u) where 	extract = extract . extract . u -instance (Avoidable t, Covariant u) => Avoidable (U Co Co t u) where+instance (Avoidable t, Covariant u) => Avoidable (U 'Co 'Co t u) where 	idle = U idle -instance (Applicative t, Applicative u) => Applicative (U Co Co t u) where+instance (Applicative t, Applicative u) => Applicative (U 'Co 'Co t u) where 	U f <*> U x = U $ apply <$> f <*> x -instance (Alternative t, Covariant u) => Alternative (U Co Co t u) where+instance (Alternative t, Covariant u) => Alternative (U 'Co 'Co t u) where 	U x <+> U y = U $ x <+> y -instance (Traversable t, Traversable u) => Traversable (U Co Co t u) where-	U x ->> f = U <$> (traverse . traverse) f x+instance (Traversable t, Traversable u) => Traversable (U 'Co 'Co t u) where+	U x ->> f = U <$> x ->>> f -instance (Distributive t, Distributive u) => Distributive (U Co Co t u) where+instance (Distributive t, Distributive u) => Distributive (U 'Co 'Co t u) where 	x >>- f = U . comap distribute . distribute $ u . f <$> x -instance (t :-|: u, v :-|: w) => Adjoint (U Co Co t v) (U Co Co u w) where+instance (t :-|: u, v :-|: w) => Adjoint (U 'Co 'Co t v) (U 'Co 'Co u w) where 	phi f = point . f . point 	psi f = extract . extract . comap f   newtype UU ct cu cv t u v a = UU { uu :: (t :.: u :.: v) a } -instance (Covariant t, Covariant u, Covariant v) => Covariant (UU Co Co Co t u v) where-	f <$> UU x = UU $ (comap . comap . comap) f x+instance (Covariant t, Covariant u, Covariant v)+	=> Covariant (UU 'Co 'Co 'Co t u v) where+	f <$> UU x = UU $ f <$$$> x -instance (Covariant t, Covariant u, Contravariant v) => Contravariant (UU Co Co Contra t u v) where-	f >$< UU x = UU $ (comap . comap) (contramap f) x+instance (Covariant t, Covariant u, Contravariant v)+	=> Contravariant (UU 'Co 'Co 'Contra t u v) where+	f >$< UU x = UU $ (f >$<) <$$> x -instance (Covariant t, Contravariant u, Covariant v) => Contravariant (UU Co Contra Co t u v) where+instance (Covariant t, Contravariant u, Covariant v)+	=> Contravariant (UU 'Co 'Contra 'Co t u v) where 	f >$< UU x = UU $ contramap (comap f) <$> x -instance (Contravariant t, Covariant u, Covariant v) => Contravariant (UU Contra Co Co t u v) where-	f >$< UU x = UU $ comap (comap f) >$< x+instance (Contravariant t, Covariant u, Covariant v)+	=> Contravariant (UU 'Contra 'Co 'Co t u v) where+	f >$< UU x = UU $ (f <$$>) >$< x -instance (Contravariant t, Contravariant u, Covariant v) => Covariant (UU Contra Contra Co t u v) where+instance (Contravariant t, Contravariant u, Covariant v)+	=> Covariant (UU 'Contra 'Contra 'Co t u v) where 	f <$> UU x = UU $ contramap (comap f) >$< x -instance (Covariant t, Contravariant u, Contravariant v) => Covariant (UU Co Contra Contra t u v) where-	f <$> UU x = UU $ contramap (contramap f) <$> x+instance (Covariant t, Contravariant u, Contravariant v)+	=> Covariant (UU 'Co 'Contra 'Contra t u v) where+	f <$> UU x = UU $ (f >$$<) <$> x -instance (Contravariant t, Covariant u, Contravariant v) => Covariant (UU Contra Co Contra t u v) where+instance (Contravariant t, Covariant u, Contravariant v)+	=> Covariant (UU 'Contra 'Co 'Contra t u v) where 	f <$> UU x = UU $ comap (contramap f) >$< x -instance (Contravariant t, Contravariant u, Contravariant v) => Contravariant (UU Contra Contra Contra t u v) where-	f >$< UU x = UU $ (contramap . contramap . contramap) f x+instance (Contravariant t, Contravariant u, Contravariant v)+	=> Contravariant (UU 'Contra 'Contra 'Contra t u v) where+	f >$< UU x = UU $ f >$$$< x -instance (Pointable t, Pointable u, Pointable v) => Pointable (UU Co Co Co t u v) where+instance (Pointable t, Pointable u, Pointable v)+	=> Pointable (UU 'Co 'Co 'Co t u v) where 	point = UU . point . point . point -instance (Extractable t, Extractable u, Extractable v) => Extractable (UU Co Co Co t u v) where+instance (Extractable t, Extractable u, Extractable v)+	=> Extractable (UU 'Co 'Co 'Co t u v) where 	extract = extract . extract . extract . uu -instance (Avoidable t, Covariant u, Covariant v) => Avoidable (UU Co Co Co t u v) where+instance (Avoidable t, Covariant u, Covariant v)+	=> Avoidable (UU 'Co 'Co 'Co t u v) where 	idle = UU idle -instance (Applicative t, Applicative u, Applicative v) => Applicative (UU Co Co Co t u v) where-	UU f <*> UU x = UU $ (comap apply . (comap . comap) apply $ f) <*> x+instance (Applicative t, Applicative u, Applicative v)+	=> Applicative (UU 'Co 'Co 'Co t u v) where+	UU f <*> UU x = UU $ ((apply <$>) . (apply <$$>) $ f) <*> x -instance (Alternative t, Covariant u, Covariant v) => Alternative (UU Co Co Co t u v) where+instance (Alternative t, Covariant u, Covariant v)+	=> Alternative (UU 'Co 'Co 'Co t u v) where 	UU x <+> UU y = UU $ x <+> y -instance (Traversable t, Traversable u, Traversable v) => Traversable (UU Co Co Co t u v) where-	UU x ->> f = UU <$> (traverse . traverse . traverse) f x+instance (Traversable t, Traversable u, Traversable v)+	=> Traversable (UU 'Co 'Co 'Co t u v) where+	UU x ->> f = UU <$> x ->>>> f -instance (Distributive t, Distributive u, Distributive v) => Distributive (UU Co Co Co t u v) where-	x >>- f = UU . (comap . comap) distribute . comap distribute . distribute $ uu . f <$> x+instance (Distributive t, Distributive u, Distributive v)+	=> Distributive (UU 'Co 'Co 'Co t u v) where+	x >>- f = UU . (distribute <$$>) . (distribute <$>) . distribute $ uu . f <$> x -instance (t :-|: w, v :-|: x, u :-|: y) => Adjoint (UU Co Co Co t v u) (UU Co Co Co w x y) where+instance (t :-|: w, v :-|: x, u :-|: y)+	=> Adjoint (UU 'Co 'Co 'Co t v u) (UU 'Co 'Co 'Co w x y) where 	phi f = point . f . point 	psi f = extract . extract . comap f   newtype UUU ct cu cv cw t u v w a = UUU { uuu :: (t :.: u :.: v :.: w) a } -instance (Covariant t, Covariant u, Covariant v, Covariant w) => Covariant (UUU Co Co Co Co t u v w) where-	f <$> UUU x = UUU $ (comap . comap . comap . comap) f x+instance (Covariant t, Covariant u, Covariant v, Covariant w)+	=> Covariant (UUU 'Co 'Co 'Co 'Co t u v w) where+	f <$> UUU x = UUU $ f <$$$$> x -instance (Covariant t, Covariant u, Covariant v, Contravariant w) => Contravariant (UUU Co Co Co Contra t u v w) where-	f >$< UUU x = UUU $ (comap . comap . comap) (contramap f) x+instance (Covariant t, Covariant u, Covariant v, Contravariant w)+	=> Contravariant (UUU 'Co 'Co 'Co 'Contra t u v w) where+	f >$< UUU x = UUU $ (f >$<) <$$$> x -instance (Covariant t, Covariant u, Contravariant v, Covariant w) => Contravariant (UUU Co Co Contra Co t u v w) where-	f >$< UUU x = UUU $ (comap . comap) (contramap (comap f)) x+instance (Covariant t, Covariant u, Contravariant v, Covariant w)+	=> Contravariant (UUU 'Co 'Co 'Contra 'Co t u v w) where+	f >$< UUU x = UUU $ (contramap (comap f)) <$$> x -instance (Covariant t, Contravariant u, Covariant v, Covariant w) => Contravariant (UUU Co Contra Co Co t u v w) where+instance (Covariant t, Contravariant u, Covariant v, Covariant w)+	=> Contravariant (UUU 'Co 'Contra 'Co 'Co t u v w) where 	f >$< UUU x = UUU $ (contramap (comap (comap f))) <$> x -instance (Contravariant t, Covariant u, Covariant v, Covariant w) => Contravariant (UUU Contra Co Co Co t u v w) where-	f >$< UUU x = UUU $ comap (comap (comap f)) >$< x+instance (Contravariant t, Covariant u, Covariant v, Covariant w)+	=> Contravariant (UUU 'Contra 'Co 'Co 'Co t u v w) where+	f >$< UUU x = UUU $ (f <$$$>) >$< x -instance (Contravariant t, Contravariant u, Covariant v, Covariant w) => Covariant (UUU Contra Contra Co Co t u v w) where+instance (Contravariant t, Contravariant u, Covariant v, Covariant w)+	=> Covariant (UUU 'Contra 'Contra 'Co 'Co t u v w) where 	f <$> UUU x = UUU $ (contramap . contramap . comap . comap $ f) x -instance (Covariant t, Contravariant u, Contravariant v, Covariant w) => Covariant (UUU Co Contra Contra Co t u v w) where+instance (Covariant t, Contravariant u, Contravariant v, Covariant w)+	=> Covariant (UUU 'Co 'Contra 'Contra 'Co t u v w) where 	f <$> UUU x = UUU $ (comap . contramap . contramap . comap $ f) x -instance (Covariant t, Covariant u, Contravariant v, Contravariant w) => Covariant (UUU Co Co Contra Contra t u v w) where-	f <$> UUU x = UUU $ (comap . comap) (contramap . contramap $ f) x+instance (Covariant t, Covariant u, Contravariant v, Contravariant w)+	=> Covariant (UUU 'Co 'Co 'Contra 'Contra t u v w) where+	f <$> UUU x = UUU $ (f >$$<) <$$> x -instance (Covariant t, Contravariant u, Covariant v, Contravariant w) => Covariant (UUU Co Contra Co Contra t u v w) where+instance (Covariant t, Contravariant u, Covariant v, Contravariant w)+	=> Covariant (UUU 'Co 'Contra 'Co 'Contra t u v w) where 	f <$> UUU x = UUU $ (comap . contramap . comap . contramap $ f) x -instance (Contravariant t, Covariant u, Contravariant v, Covariant w) => Covariant (UUU Contra Co Contra Co t u v w) where+instance (Contravariant t, Covariant u, Contravariant v, Covariant w)+	=> Covariant (UUU 'Contra 'Co 'Contra 'Co t u v w) where 	f <$> UUU x = UUU $ (contramap . comap . contramap . comap $ f) x -instance (Contravariant t, Covariant u, Covariant v, Contravariant w) => Covariant (UUU Contra Co Co Contra t u v w) where+instance (Contravariant t, Covariant u, Covariant v, Contravariant w)+	=> Covariant (UUU 'Contra 'Co 'Co 'Contra t u v w) where 	f <$> UUU x = UUU $ (contramap . comap . comap . contramap $ f) x -instance (Contravariant t, Contravariant u, Contravariant v, Covariant w) => Contravariant (UUU Contra Contra Contra Co t u v w) where-	f >$< UUU x = UUU $ (contramap . contramap . contramap . comap) f x+instance (Contravariant t, Contravariant u, Contravariant v, Covariant w)+	=> Contravariant (UUU 'Contra 'Contra 'Contra 'Co t u v w) where+	f >$< UUU x = UUU $ (f <$>) >$$$< x -instance (Covariant t, Contravariant u, Contravariant v, Contravariant w) => Contravariant (UUU Co Contra Contra Contra t u v w) where-	f >$< UUU x = UUU $ (comap . contramap . contramap . contramap) f x+instance (Covariant t, Contravariant u, Contravariant v, Contravariant w)+	=> Contravariant (UUU 'Co 'Contra 'Contra 'Contra t u v w) where+	f >$< UUU x = UUU $ (f >$$$<) <$> x -instance (Contravariant t, Covariant u, Contravariant v, Contravariant w) => Contravariant (UUU Contra Co Contra Contra t u v w) where+instance (Contravariant t, Covariant u, Contravariant v, Contravariant w)+	=> Contravariant (UUU 'Contra 'Co 'Contra 'Contra t u v w) where 	f >$< UUU x = UUU $ (contramap . comap . contramap . contramap) f x -instance (Contravariant t, Contravariant u, Covariant v, Contravariant w) => Contravariant (UUU Contra Contra Co Contra t u v w) where+instance (Contravariant t, Contravariant u, Covariant v, Contravariant w)+	=> Contravariant (UUU 'Contra 'Contra 'Co 'Contra t u v w) where 	f >$< UUU x = UUU $ (contramap . contramap . comap . contramap) f x -instance (Contravariant t, Contravariant u, Contravariant v, Contravariant w) => Covariant (UUU Contra Contra Contra Contra t u v w) where-	f <$> UUU x = UUU $ (contramap . contramap . contramap . contramap) f x+instance (Contravariant t, Contravariant u, Contravariant v, Contravariant w)+	=> Covariant (UUU 'Contra 'Contra 'Contra 'Contra t u v w) where+	f <$> UUU x = UUU $ f >$$$$< x -instance (Pointable t, Pointable u, Pointable v, Pointable w) => Pointable (UUU Co Co Co Co t u v w) where+instance (Pointable t, Pointable u, Pointable v, Pointable w)+	=> Pointable (UUU 'Co 'Co 'Co 'Co t u v w) where 	point = UUU . point . point . point . point -instance (Extractable t, Extractable u, Extractable v, Extractable w) => Extractable (UUU Co Co Co Co t u v w) where+instance (Extractable t, Extractable u, Extractable v, Extractable w)+	=> Extractable (UUU 'Co 'Co 'Co 'Co t u v w) where 	extract = extract . extract . extract . extract . uuu -instance (Avoidable t, Covariant u, Covariant v, Covariant w) => Avoidable (UUU Co Co Co Co t u v w) where+instance (Avoidable t, Covariant u, Covariant v, Covariant w)+	=> Avoidable (UUU 'Co 'Co 'Co 'Co t u v w) where 	idle = UUU idle -instance (Applicative t, Applicative u, Applicative v, Applicative w) => Applicative (UUU Co Co Co Co t u v w) where-	UUU f <*> UUU x = UUU $ (comap apply . (comap . comap) apply . (comap . comap . comap) apply $ f) <*> x+instance (Applicative t, Applicative u, Applicative v, Applicative w)+	=> Applicative (UUU 'Co 'Co 'Co 'Co t u v w) where+	UUU f <*> UUU x = UUU $ ((apply <$>) . (apply <$$>) . (apply <$$$>) $ f) <*> x -instance (Alternative t, Covariant u, Covariant v, Covariant w) => Alternative (UUU Co Co Co Co t u v w) where+instance (Alternative t, Covariant u, Covariant v, Covariant w)+	=> Alternative (UUU 'Co 'Co 'Co 'Co t u v w) where 	UUU x <+> UUU y = UUU $ x <+> y -instance (Traversable t, Traversable u, Traversable v, Traversable w) => Traversable (UUU Co Co Co Co t u v w) where-	UUU x ->> f = UUU <$> (traverse . traverse . traverse . traverse) f x+instance (Traversable t, Traversable u, Traversable v, Traversable w)+	=> Traversable (UUU 'Co 'Co 'Co 'Co t u v w) where+	UUU x ->> f = UUU <$> x ->>>>> f -instance (Distributive t, Distributive u, Distributive v, Distributive w) => Distributive (UUU Co Co Co Co t u v w) where-	x >>- f = UUU . (comap . comap . comap) distribute . (comap . comap) distribute . comap distribute . distribute $ uuu . f <$> x+instance (Distributive t, Distributive u, Distributive v, Distributive w)+	=> Distributive (UUU 'Co 'Co 'Co 'Co t u v w) where+	x >>- f = UUU . (distribute <$$$>) . (distribute <$$>) . (distribute <$>) . distribute $ uuu . f <$> x -instance (t :-|: u, v :-|: w, q :-|: q, r :-|: s) => Adjoint (UUU Co Co Co Co t v q r) (UUU Co Co Co Co u w q s) where+instance (t :-|: u, v :-|: w, q :-|: q, r :-|: s)+	=> Adjoint (UUU 'Co 'Co 'Co 'Co t v q r) (UUU 'Co 'Co 'Co 'Co u w q s) where 	phi f = point . f . point 	psi f = extract . extract . comap f
Pandora/Paradigm/Junction/Transformer.hs view
@@ -2,20 +2,20 @@  import Pandora.Core.Functor (type (:.:)) import Pandora.Core.Morphism ((.), ($))-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>), comap)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Extractable (Extractable (extract)) import Pandora.Pattern.Functor.Avoidable (Avoidable (idle)) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>), apply))-import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), (->>>))) import Pandora.Pattern.Functor.Distributive (Distributive ((>>-), distribute)) import Pandora.Pattern.Functor.Liftable (Liftable (lift)) import Pandora.Pattern.Functor.Lowerable (Lowerable (lower)) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>)))-import Pandora.Pattern.Object.Semigroup (Semigroup ((<>)))-import Pandora.Pattern.Object.Monoid (Monoid (unit))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))  infixr 0 :!:, :>: type (:!:) t u = T t u@@ -25,7 +25,7 @@ newtype T t u a = T { t :: (u :.: t) a }  instance (Covariant t, Covariant u) => Covariant (T t u) where-	f <$> T x = T $ (comap . comap) f x+	f <$> T x = T $ f <$$> x  instance (Pointable t, Pointable u) => Pointable (T t u) where 	point = T . point . point@@ -49,7 +49,7 @@ 	lower (T x) = extract <$> x  instance (Traversable t, Traversable u) => Traversable (T t u) where-	T x ->> f = T <$> (traverse . traverse) f x+	T x ->> f = T <$> x ->>> f  instance (Distributive t, Distributive u) => Distributive (T t u) where 	x >>- f = T . comap distribute . distribute $ t . f <$> x@@ -61,10 +61,10 @@ 	T x <=> T y = x <=> y  instance Semigroup ((u :.: t) a) => Semigroup (T t u a) where-	T x <> T y = T $ x <> y+	T x + T y = T $ x + y  instance Monoid ((u :.: t) a) => Monoid (T t u a) where-	unit = T unit+	zero = T zero  up :: Pointable u => t a -> T t u a up = T . point@@ -73,7 +73,7 @@ newtype Y t u a = Y { y :: (u :.: t u) a }  instance (Covariant (t u), Covariant u) => Covariant (Y t u) where-	f <$> Y x = Y $ (comap . comap) f x+	f <$> Y x = Y $ f <$$> x  instance (Pointable (t u), Pointable u) => Pointable (Y t u) where 	point = Y . point . point@@ -91,25 +91,25 @@ 	Y f <*> Y x = Y $ apply <$> f <*> x  instance (Traversable (t u), Traversable u) => Traversable (Y t u) where-	Y x ->> f = Y <$> (traverse . traverse) f x+	Y x ->> f = Y <$> x ->>> f  instance (Distributive (t u), Distributive u) => Distributive (Y t u) where 	x >>- f = Y . comap distribute . distribute $ y . f <$> x -instance (forall u . Pointable u, Liftable t) => Liftable (Y t) where+instance (forall u' . Pointable u', Liftable t) => Liftable (Y t) where 	lift = Y . point . lift -instance (forall u . Extractable u, Lowerable t) => Lowerable (Y t) where+instance (forall u' . Extractable u', Lowerable t) => Lowerable (Y t) where 	lower = lower . extract . y -instance (forall u . Setoid ((u :.: t u) a)) => Setoid (Y t u a) where+instance (forall u' . Setoid ((u' :.: t u') a)) => Setoid (Y t u a) where 	Y x == Y y = x == y -instance (forall u . Chain ((u :.: t u) a)) => Chain (Y t u a) where+instance (forall u' . Chain ((u' :.: t u') a)) => Chain (Y t u a) where 	Y x <=> Y y = x <=> y -instance (forall u . Semigroup ((u :.: t u) a)) => Semigroup (Y t u a) where-	Y x <> Y y = Y $ x <> y+instance (forall u' . Semigroup ((u' :.: t u') a)) => Semigroup (Y t u a) where+	Y x + Y y = Y $ x + y -instance (forall u . Monoid ((u :.: t u) a)) => Monoid (Y t u a) where-	unit = Y unit+instance (forall u' . Monoid ((u' :.: t u') a)) => Monoid (Y t u a) where+	zero = Y zero
Pandora/Pattern/Functor/Adjoint.hs view
@@ -6,8 +6,8 @@  {- | > When providing a new instance, you should ensure it satisfies the four laws:-> * Left adjunction identity: phi counit ≡ identity-> * Right adjunction identity: psi unit ≡ identity+> * Left adjunction identity: phi cozero ≡ identity+> * Right adjunction identity: psi zero ≡ identity > * Left adjunction interchange: phi f ≡ comap f . eta > * Right adjunction interchange: psi f ≡ epsilon . comap f -}
Pandora/Pattern/Functor/Bindable.hs view
@@ -1,8 +1,8 @@ module Pandora.Pattern.Functor.Bindable (Bindable (..)) where  import Pandora.Core.Functor (type (:.:))-import Pandora.Core.Morphism (($), (?), identity)-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Core.Morphism ((?), identity)+import Pandora.Pattern.Functor.Covariant (Covariant)  infixl 1 >>= infixr 1 =<<, <=<, >=>
Pandora/Pattern/Functor/Comonad.hs view
@@ -1,4 +1,4 @@-module Pandora.Pattern.Functor.Comonad (Comonad (..)) where+module Pandora.Pattern.Functor.Comonad (Comonad) where  import Pandora.Pattern.Functor.Extractable (Extractable) import Pandora.Pattern.Functor.Extendable (Extendable)
Pandora/Pattern/Functor/Contravariant.hs view
@@ -1,5 +1,6 @@ module Pandora.Pattern.Functor.Contravariant (Contravariant (..)) where +import Pandora.Core.Functor (type (:.:)) import Pandora.Core.Morphism ((.), (!), (?))  infixl 4 >$<, $<, >$@@ -27,9 +28,26 @@ 	-- | Fill the input of evaluation 	full :: t () -> t a 	full x = () >$ x-	-- | Infix versions of `contramap` with various nesting levels-	(>$$$<) :: (Contravariant u, Contravariant v) => (a -> b) -> t (u (v b)) -> t (u (v a))-	(>$$$<) = (>$<) . (>$<) . (>$<) 	-- | Flipped infix version of 'contramap' 	(>&<) :: t b -> (a -> b) -> t a 	x >&< f = f >$< x++	-- | Infix versions of `contramap` with various nesting levels+	(>$$<) :: Contravariant u => (a -> b) -> (t :.: u) a -> (t :.: u) b+	(>$$<) = (>$<) . (>$<)+	(>$$$<) :: (Contravariant u, Contravariant v)+		=> (a -> b) -> (t :.: u :.: v) b -> (t :.: u :.: v) a+	(>$$$<) = (>$<) . (>$<) . (>$<)+	(>$$$$<) :: (Contravariant u, Contravariant v, Contravariant w)+		=> (a -> b) -> (t :.: u :.: v :.: w) a -> (t :.: u :.: v :.: w) b+	(>$$$$<) = (>$<) . (>$<) . (>$<) . (>$<)++	-- | Infix flipped versions of `contramap` with various nesting levels+	(>&&<) :: Contravariant u => (t :.: u) a -> (a -> b) -> (t :.: u) b+	x >&&< f = f >$$< x+	(>&&&<) :: (Contravariant u, Contravariant v)+		=> (t :.: u :.: v) b -> (a -> b) -> (t :.: u :.: v) a+	x >&&&< f = f >$$$< x+	(>&&&&<) :: (Contravariant u, Contravariant v, Contravariant w)+		=> (t :.: u :.: v :.: w) a -> (a -> b) -> (t :.: u :.: v :.: w) b+	x >&&&&< f = f >$$$$< x
Pandora/Pattern/Functor/Covariant.hs view
@@ -1,5 +1,6 @@ module Pandora.Pattern.Functor.Covariant (Covariant (..)) where +import Pandora.Core.Functor (type (:.:)) import Pandora.Core.Morphism (fix, (.), ($), (!), (?))  infixl 4 <$>, <$, $>@@ -30,16 +31,29 @@ 	-- | Computing a value from a structure of values 	loeb :: t (t a -> a) -> t a 	loeb tt = fix $ \f -> ($ f) <$> tt+	-- | Flipped infix version of 'comap'+	(<&>) :: t a -> (a -> b) -> t b+	x <&> f = f <$> x+ 	-- | Infix versions of `comap` with various nesting levels-	(<$$>) :: Covariant u => (a -> b) -> t (u a) -> t (u b)+	(<$$>) :: Covariant u => (a -> b) -> (t :.: u) a -> (t :.: u) b 	(<$$>) = (<$>) . (<$>)-	(<$$$>) :: (Covariant u, Covariant v) => (a -> b) -> t (u (v a)) -> t (u (v b))+	(<$$$>) :: (Covariant u, Covariant v)+		=> (a -> b) -> (t :.: u :.: v) a -> (t :.: u :.: v) b 	(<$$$>) = (<$>) . (<$>) . (<$>)-	(<$$$$>) :: (Covariant u, Covariant v, Covariant w) => (a -> b) -> t (u (v ( w a))) -> t (u (v (w b)))+	(<$$$$>) :: (Covariant u, Covariant v, Covariant w)+		=> (a -> b) -> (t :.: u :.: v :.: w) a -> (t :.: u :.: v :.: w) b 	(<$$$$>) = (<$>) . (<$>) . (<$>) . (<$>)-	-- | Flipped infix version of 'comap'-	(<&>) :: t a -> (a -> b) -> t b-	x <&> f = f <$> x++	-- | Infix flipped versions of `comap` with various nesting levels+	(<&&>) :: Covariant u => (t :.: u) a -> (a -> b) -> (t :.: u) b+	x <&&> f = f <$$> x+	(<&&&>) :: (Covariant u, Covariant v)+		=> (t :.: u :.: v) a -> (a -> b) -> (t :.: u :.: v) b+	x <&&&> f = f <$$$> x+	(<&&&&>) :: (Covariant u, Covariant v, Covariant w)+		=> (t :.: u :.: v :.: w) a -> (a -> b) -> (t :.: u :.: v :.: w) b+	x <&&&&> f = f <$$$$> x  instance Covariant ((->) a) where 	(<$>) = (.)
Pandora/Pattern/Functor/Distributive.hs view
@@ -1,7 +1,7 @@ module Pandora.Pattern.Functor.Distributive (Distributive (..)) where  import Pandora.Core.Functor (type (:.:))-import Pandora.Core.Morphism (identity)+import Pandora.Core.Morphism (identity, (.)) import Pandora.Pattern.Functor.Covariant (Covariant)  {- |@@ -12,6 +12,8 @@ > * Interchange collection: collect f ≡ distribute . comap f -} +infixl 5 >>-, >>>-, >>>>-, >>>>>-+ class Covariant u => Distributive u where 	{-# MINIMAL (>>-) #-} 	-- | Infix version of 'collect'@@ -23,3 +25,14 @@ 	-- | The dual of 'sequence' 	distribute :: Covariant t => (t :.: u) a -> (u :.: t) a 	distribute t = t >>- identity++	-- | Infix versions of `collect` with various nesting levels+	(>>>-) :: (Covariant t, Covariant v)+		=> (t :.: v) a -> (a -> u b) -> (u :.: t :.: v) b+	x >>>- f = (collect . collect) f x+	(>>>>-) :: (Covariant t, Covariant v, Covariant w)+		=> (t :.: v :.: w) a -> (a -> u b) -> (u :.: t :.: v :.: w) b+	x >>>>- f = (collect . collect . collect) f x+	(>>>>>-) :: (Covariant t, Covariant v, Covariant w, Covariant j)+		=> (t :.: v :.: w :.: j) a -> (a -> u b) -> (u :.: t :.: v :.: w :.: j) b+	x >>>>>- f = (collect . collect . collect . collect) f x
Pandora/Pattern/Functor/Liftable.hs view
@@ -1,6 +1,6 @@ module Pandora.Pattern.Functor.Liftable (Liftable (..)) where -import Pandora.Core.Functor (type (~>))+import Pandora.Core.Transformation (type (~>)) import Pandora.Pattern.Functor.Covariant (Covariant)  class Liftable t where
Pandora/Pattern/Functor/Lowerable.hs view
@@ -1,6 +1,6 @@ module Pandora.Pattern.Functor.Lowerable (Lowerable (..)) where -import Pandora.Core.Functor (type (~>))+import Pandora.Core.Transformation (type (~>)) import Pandora.Pattern.Functor.Covariant (Covariant)  class Lowerable t where
Pandora/Pattern/Functor/Traversable.hs view
@@ -1,7 +1,7 @@ module Pandora.Pattern.Functor.Traversable (Traversable (..)) where  import Pandora.Core.Functor (type (:.:))-import Pandora.Core.Morphism (identity)+import Pandora.Core.Morphism (identity, (.)) import Pandora.Pattern.Functor.Covariant (Covariant) import Pandora.Pattern.Functor.Applicative (Applicative) import Pandora.Pattern.Functor.Pointable (Pointable)@@ -17,6 +17,8 @@ > * Preserving apply: f (x <*> y) ≡ f x <*> f y -} +infixl 5 ->>, ->>>, ->>>>, ->>>>>+ class Covariant t => Traversable t where 	{-# MINIMAL (->>) #-} 	-- | Infix version of 'traverse'@@ -28,3 +30,14 @@ 	-- | The dual of 'distribute' 	sequence :: (Pointable u, Applicative u) => (t :.: u) a -> (u :.: t) a 	sequence t = t ->> identity++	-- | Infix versions of `traverse` with various nesting levels+	(->>>) :: (Pointable u, Applicative u, Traversable v)+		=> (v :.: t) a -> (a -> u b) -> (u :.: v :.: t) b+	x ->>> f = (traverse . traverse) f x+	(->>>>) :: (Pointable u, Applicative u, Traversable v, Traversable w)+		=> (w :.: v :.: t) a -> (a -> u b) -> (u :.: w :.: v :.: t) b+	x ->>>> f = (traverse . traverse . traverse) f x+	(->>>>>) :: (Pointable u, Applicative u, Traversable v, Traversable w, Traversable j)+		=> (j :.: w :.: v :.: t) a -> (a -> u b) -> (u :.: j :.: w :.: v :.: t) b+	x ->>>>> f = (traverse . traverse . traverse . traverse) f x
Pandora/Pattern/Object.hs view
@@ -4,6 +4,7 @@ import Pandora.Pattern.Object.Semilattice as Exports import Pandora.Pattern.Object.Group as Exports import Pandora.Pattern.Object.Monoid as Exports+import Pandora.Pattern.Object.Quasiring as Exports import Pandora.Pattern.Object.Ringoid as Exports import Pandora.Pattern.Object.Semigroup as Exports import Pandora.Pattern.Object.Chain as Exports
Pandora/Pattern/Object/Group.hs view
@@ -4,8 +4,8 @@  {- | > When providing a new instance, you should ensure it satisfies the two laws:-> * Right absorption: x <> inverse x ≡ unit-> * Left absorption: inverse x <> x ≡ unit+> * Right absorption: x + inverse x ≡ zero+> * Left absorption: inverse x + x ≡ zero -}  class Monoid a => Group a where
Pandora/Pattern/Object/Monoid.hs view
@@ -4,10 +4,10 @@  {- | > When providing a new instance, you should ensure it satisfies the two laws:-> * Right absorption: unit <> x ≡ x-> * Left absorption: x <> unit ≡ x+> * Right absorption: zero + x ≡ x+> * Left absorption: x + zero ≡ x -}  class Semigroup a => Monoid a where-	{-# MINIMAL unit #-}-	unit :: a+	{-# MINIMAL zero #-}+	zero :: a
+ Pandora/Pattern/Object/Quasiring.hs view
@@ -0,0 +1,12 @@+module Pandora.Pattern.Object.Quasiring (Quasiring (..)) where++import Pandora.Pattern.Object.Monoid (Monoid)+import Pandora.Pattern.Object.Ringoid (Ringoid)++{- |+> When providing a new instance, you should ensure it satisfies the one law:+> * Additive identity is a multiplicative annihilator: zero * x = x  * zero = zero+-}++class (Monoid a, Ringoid a) => Quasiring a where+	one :: a
Pandora/Pattern/Object/Ringoid.hs view
@@ -4,10 +4,10 @@  {- | > When providing a new instance, you should ensure it satisfies the two laws:-> * Left distributivity: x <> (y >< z) ≡ x <> y >< x <> z-> * Right distributivity: (y >< z) <> x ≡ y <> x >< z <> x+> * Left distributivity: x * (y + z) ≡ x * y + x * z+> * Right distributivity: (y + z) * x ≡ y * x + z * x -}  class Semigroup a => Ringoid a where-	{-# MINIMAL (><) #-}-	(><) :: a -> a -> a+	{-# MINIMAL (*) #-}+	(*) :: a -> a -> a
Pandora/Pattern/Object/Semigroup.hs view
@@ -2,10 +2,9 @@  {- | > When providing a new instance, you should ensure it satisfies the one law:-> * Associativity: x <> (y <> z) ≡ (x <> y) <> z+> * Associativity: x + (y + z) ≡ (x + y) + z -}  class Semigroup a where-	{-# MINIMAL (<>) #-}-	-- | Infix version of 'append'-	(<>) :: a -> a -> a+	{-# MINIMAL (+) #-}+	(+) :: a -> a -> a
pandora.cabal view
@@ -1,5 +1,5 @@ name:                pandora-version:             0.1.5+version:             0.1.6 synopsis:            A box of patterns and paradigms description:         Humble attempt to define a library for problem solving based on math abstractions. homepage:            https://github.com/iokasimov/pandora@@ -22,6 +22,7 @@     -- Axioms set     Pandora.Core.Functor     Pandora.Core.Morphism+    Pandora.Core.Transformation     -- Basic constructions     Pandora.Paradigm.Basis     Pandora.Paradigm.Basis.Conclusion@@ -89,6 +90,7 @@     Pandora.Pattern.Object.Group     Pandora.Pattern.Object.Lattice     Pandora.Pattern.Object.Monoid+    Pandora.Pattern.Object.Quasiring     Pandora.Pattern.Object.Ringoid     Pandora.Pattern.Object.Semigroup     Pandora.Pattern.Object.Semilattice