packages feed

pandora (empty) → 0.1.0

raw patch · 60 files changed

+1848/−0 lines, 60 files

Files

+ CHANGELOG.md view
+ LICENSE view
@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2019 Murat Kasimov++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
+ Pandora/Core/Functor.hs view
@@ -0,0 +1,12 @@+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++data Variant = Co | Contra++infixr 0 :.:+type (:.:) t u a = t (u a)
+ Pandora/Core/Morphism.hs view
@@ -0,0 +1,33 @@+module Pandora.Core.Morphism (identity, flip, fix, (.), ($), (&), (!)) where++infixr 9 .+infixr 0 $+infixl 1 &+infixr 2 !++{-# INLINE identity #-}+identity :: a -> a+identity x = x++{-# INLINE flip #-}+flip :: (a -> b -> c) -> b -> a -> c+flip f x y = f y x++fix :: (a -> a) -> a+fix f = let x = f x in x++{-# INLINE (.) #-}+(.) :: (b -> c) -> (a -> b) -> a -> c+f . g = \x -> f (g x)++{-# INLINE ($) #-}+($) :: (a -> b) -> a -> b+f $ x = f x++{-# INLINE (&) #-}+(&) :: a -> (a -> b) -> b+x & f = f x++{-# INLINE (!) #-}+(!) :: a -> b -> a+x ! y = x
+ Pandora/Paradigm/Basis.hs view
@@ -0,0 +1,28 @@+module Pandora.Paradigm.Basis (module Exports, note, hush) where++import Pandora.Paradigm.Basis.Cofree as Exports+import Pandora.Paradigm.Basis.Free as Exports+import Pandora.Paradigm.Basis.Fix as Exports+import Pandora.Paradigm.Basis.Yoneda as Exports+import Pandora.Paradigm.Basis.Continuation as Exports+import Pandora.Paradigm.Basis.Predicate as Exports+import Pandora.Paradigm.Basis.Wye as Exports+import Pandora.Paradigm.Basis.Edges as Exports+import Pandora.Paradigm.Basis.Conclusion as Exports+import Pandora.Paradigm.Basis.Maybe as Exports+import Pandora.Paradigm.Basis.Jack as Exports+import Pandora.Paradigm.Basis.Product as Exports+import Pandora.Paradigm.Basis.Constant as Exports+import Pandora.Paradigm.Basis.Identity as Exports+import Pandora.Paradigm.Basis.Junction.Kan as Exports+import Pandora.Paradigm.Basis.Junction.Transformer as Exports+import Pandora.Paradigm.Basis.Junction.Composition as Exports++import Pandora.Core.Functor (type (~>))+import Pandora.Core.Morphism ((.), (!))++note :: e -> Maybe ~> Conclusion e+note x = maybe (Failure x) Success++hush :: Conclusion e ~> Maybe+hush = conclusion (Nothing !) Just
+ Pandora/Paradigm/Basis/Cofree.hs view
@@ -0,0 +1,52 @@+module Pandora.Paradigm.Basis.Cofree (Cofree (..), unwrap, coiterate, section) where++import Pandora.Core.Functor (type (:.:), type (~>))+import Pandora.Core.Morphism ((.))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Pattern.Functor.Exclusive (Exclusive (exclusive))+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.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Extendable (Extendable ((=>>), extend))+import Pandora.Pattern.Functor.Monad (Monad)+import Pandora.Pattern.Functor.Comonad (Comonad)++data Cofree t a = a :< (t :.: Cofree t) a++instance Covariant t => Covariant (Cofree t) where+	f <$> (x :< xs) = f x :< ((comap . comap) f xs)++instance Exclusive t => Pointable (Cofree t) where+	point x = x :< exclusive++instance Covariant t => Extractable (Cofree t) where+	extract (x :< _) = x++instance Applicative t => Applicative (Cofree t) where+	(f :< fs) <*> (x :< xs) = f x :< ((<*>) <$> fs <*> xs)++instance Traversable t => Traversable (Cofree t) where+	(x :< xs) ->> f = (:<) <$> f x <*> (traverse . traverse) f xs++instance Alternative t => Bindable (Cofree t) where+	(x :< xs) >>= f = case f x of+		y :< ys -> y :< (ys <+> comap (>>= f) xs)++instance Covariant t => Extendable (Cofree t) where+	x =>> f = f x :< comap (extend f) (unwrap x)++instance (Exclusive t, Alternative t) => Monad (Cofree t) where++instance Covariant t => Comonad (Cofree t) where++unwrap :: Cofree t a -> (t :.: Cofree t) a+unwrap (_ :< xs) = xs++coiterate :: Covariant t => (a -> t a) -> a -> Cofree t a+coiterate coalgebra x = x :< (coiterate coalgebra <$> coalgebra x)++section :: Comonad t => t ~> Cofree t+section as = extract as :< extend section as
+ Pandora/Paradigm/Basis/Conclusion.hs view
@@ -0,0 +1,67 @@+module Pandora.Paradigm.Basis.Conclusion (Conclusion (..), conclusion) where++import Pandora.Core.Morphism ((.), ($), (!))+import Pandora.Paradigm.Basis.Junction.Transformer (T (T, t), type (:!:))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+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 ((->>)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+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 ((<>)))++data Conclusion e a = Failure e | Success a++instance Covariant (Conclusion e) where+	f <$> Success x = Success $ f x+	_ <$> Failure y = Failure y++instance Pointable (Conclusion e) where+	point = Success++instance Applicative (Conclusion e) where+	Success f <*> x = f <$> x+	Failure y <*> x = Failure y++instance Alternative (Conclusion e) where+	Failure y <+> x = x+	Success x <+> y = Success x++instance Traversable (Conclusion e) where+	Failure y ->> _ = point $ Failure y+	Success x ->> f = Success <$> f x++instance Bindable (Conclusion e) where+	Success x >>= f = f x+	Failure y >>= _ = Failure y++instance Monad (Conclusion e) where++instance (Pointable t, Bindable t) => Bindable (Conclusion e :!: t) where+	T x >>= f = T $ x >>= conclusion (point . Failure) (t . f)++instance Monad t => Monad (Conclusion e :!: t) where++instance (Setoid e, Setoid a) => Setoid (Conclusion e a) where+	Success x == Success y = x == y+	Failure x == Failure y = x == y+	_ == _ = False++instance (Chain e, Chain a) => Chain (Conclusion e a) where+	Success x <=> Success y = x <=> y+	Failure x <=> Failure y = x <=> y+	Failure _ <=> Success _ = Less+	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 x <> Success y = Success y+	Success x <> Failure y = Success x++conclusion :: (e -> r) -> (a -> r) -> Conclusion e a -> r+conclusion f _ (Failure x) = f x+conclusion _ s (Success x) = s x
+ Pandora/Paradigm/Basis/Constant.hs view
@@ -0,0 +1,18 @@+module Pandora.Paradigm.Basis.Constant (Constant (..)) where++import Pandora.Core.Morphism (($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))++newtype Constant a b = Constant a++instance Covariant (Constant a) where+	_ <$> Constant x = Constant x++instance Contravariant (Constant a) where+	_ >$< Constant x = Constant x++instance Traversable (Constant a) where+	Constant x ->> _ = point (Constant x)
+ Pandora/Paradigm/Basis/Continuation.hs view
@@ -0,0 +1,32 @@+module Pandora.Paradigm.Basis.Continuation (Continuation (..), oblige, cwcc) where++import Pandora.Core.Morphism ((.), ($), (!), flip)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Monad (Monad)++newtype Continuation r t a = Continuation { continue :: (a -> t r) -> t r }++instance Covariant t => Covariant (Continuation r t) where+	f <$> Continuation continuation = Continuation $ continuation . (. f)++instance Covariant t => Pointable (Continuation r t) where+	point x = Continuation ($ x)++instance Covariant t => Applicative (Continuation r t) where+	f <*> x = Continuation $ \h -> continue f $ \g -> continue x (h . g)++instance Covariant t => Bindable (Continuation r t) where+	x >>= f = Continuation $ \g -> continue x $ \y -> continue (f y) g++instance Monad t => Monad (Continuation r t) where++-- | Make any bindable action continue+oblige :: Bindable t => t a -> Continuation r t a+oblige x = Continuation (x >>=)++-- | Call with current continuation+cwcc :: ((a -> Continuation r t b) -> Continuation r t a) -> Continuation r t a+cwcc f = Continuation $ \g -> flip continue g . f $ Continuation . (!) . g
+ Pandora/Paradigm/Basis/Edges.hs view
@@ -0,0 +1,23 @@+module Pandora.Paradigm.Basis.Edges (Edges (..), edges) where++import Pandora.Core.Morphism (($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))++data Edges a = Empty | Connect a | Overlay a++instance Covariant Edges where+	f <$> Empty = Empty+	f <$> Connect x = Connect $ f x+	f <$> Overlay x = Overlay $ f x++instance Traversable Edges where+	Empty ->> f = point Empty+	Connect x ->> f = Connect <$> f x+	Overlay x ->> f = Overlay <$> f x++edges :: r -> (a -> r) -> (a -> r) -> Edges a -> r+edges r _ _ Empty = r+edges _ f g (Connect x) = f x+edges _ f g (Overlay y) = g y
+ Pandora/Paradigm/Basis/Fix.hs view
@@ -0,0 +1,3 @@+module Pandora.Paradigm.Basis.Fix (Fix (..)) where++newtype Fix t = Fix { unfix :: t (Fix t) }
+ Pandora/Paradigm/Basis/Free.hs view
@@ -0,0 +1,41 @@+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.Pattern.Functor.Exclusive (Exclusive (exclusive))+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.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++instance Covariant t => Pointable (Free t) where+	point = Pure++instance Alternative t => Alternative (Free t) where+	Pure x <+> _ = Pure x+	_ <+> Pure y = Pure y+	Impure xs <+> Impure ys = Impure $ xs <+> ys++instance Exclusive t => Exclusive (Free t) where+	exclusive = Impure exclusive++instance Covariant t => Applicative (Free t) where+	Pure f <*> Pure y = Pure $ f y+	Pure f <*> Impure y = Impure $ comap f <$> y+	Impure f <*> y = Impure $ (<*> y) <$> f++instance Covariant t => Bindable (Free t) where+	Pure x >>= f = f x+	Impure xs >>= f = Impure $ (>>= f) <$> xs++instance Traversable t => Traversable (Free t) where+	Pure x ->> f = Pure <$> f x+	Impure xs ->> f = Impure <$> (traverse . traverse) f xs
+ Pandora/Paradigm/Basis/Identity.hs view
@@ -0,0 +1,82 @@+module Pandora.Paradigm.Basis.Identity (Identity (..)) where++import Pandora.Core.Morphism ((.), ($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Pattern.Functor.Distributive (Distributive ((>>-)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Extendable (Extendable ((=>>)))+import Pandora.Pattern.Functor.Monad (Monad)+import Pandora.Pattern.Functor.Comonad (Comonad)+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.Semilattice (Infimum ((/\)), Supremum ((\/)))+import Pandora.Pattern.Object.Lattice (Lattice)+import Pandora.Pattern.Object.Group (Group (inverse))++newtype Identity a = Identity a++instance Covariant Identity where+	f <$> Identity x = Identity $ f x++instance Pointable Identity where+	point = Identity++instance Extractable Identity where+	extract (Identity x) = x++instance Applicative Identity where+	Identity f <*> Identity x = Identity $ f x++instance Traversable Identity where+	Identity x ->> f = Identity <$> f x++instance Distributive Identity where+	x >>- f = Identity $ extract . f <$> x++instance Bindable Identity where+	Identity x >>= f = f x++instance Monad Identity++instance Extendable Identity where+	x =>> f = Identity . f $ x++instance Comonad Identity++instance Adjoint Identity Identity where+	phi f = Identity . f . Identity+	psi f = extract . extract . comap f++instance Setoid a => Setoid (Identity a) where+	Identity x == Identity y = x == y++instance Chain a => Chain (Identity a) where+	Identity x <=> Identity y = x <=> y++instance Semigroup a => Semigroup (Identity a) where+	Identity x <> Identity y = Identity $ x <> y++instance Monoid a => Monoid (Identity a) where+	 unit = Identity unit++instance Ringoid a => Ringoid (Identity a) where+	Identity x >< Identity y = Identity $ x >< y++instance Infimum a => Infimum (Identity a) where+	Identity x /\ Identity y = Identity $ x /\ y++instance Supremum a => Supremum (Identity a) where+	Identity x \/ Identity y = Identity $ x \/ y++instance Lattice a => Lattice (Identity a) where++instance Group a => Group (Identity a) where+	inverse (Identity x) = Identity $ inverse x
+ Pandora/Paradigm/Basis/Jack.hs view
@@ -0,0 +1,49 @@+module Pandora.Paradigm.Basis.Jack (Jack (..), jack) where++import Pandora.Core.Morphism ((.), ($))+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.Alternative (Alternative ((<+>)))+import Pandora.Pattern.Functor.Exclusive (Exclusive (exclusive))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Distributive (Distributive ((>>-), distribute))+import Pandora.Pattern.Functor.Liftable (Liftable (lift))++data Jack t a = It a | Other (t a)++instance Covariant t => Covariant (Jack t) where+	f <$> It x = It $ f x+	f <$> Other y = Other $ f <$> y++instance Covariant t => Pointable (Jack t) where+	point = It++instance Alternative t => Alternative (Jack t) where+	It x <+> _ = It x+	Other _ <+> It y = It y+	Other x <+> Other y = Other (x <+> y)++instance Exclusive t => Exclusive (Jack t) where+	exclusive = Other exclusive++instance Applicative t => Applicative (Jack t) where+	It f <*> It x = It $ f x+	It f <*> Other y = Other $ f <$> y+	Other f <*> It x = Other $ ($ x) <$> f+	Other f <*> Other y = Other $ f <*> y++instance Traversable t => Traversable (Jack t) where+	It x ->> f = It <$> f x+	Other y ->> f = comap Other . traverse f $ y++instance Distributive t => Distributive (Jack t) where+	x >>- f = distribute $ f <$> x++instance Liftable Jack where+	lift = Other++jack :: (a -> r) -> (t a -> r) -> Jack t a -> r+jack f _ (It x) = f x+jack _ g (Other y) = g y
+ Pandora/Paradigm/Basis/Junction/Composition.hs view
@@ -0,0 +1,184 @@+module Pandora.Paradigm.Basis.Junction.Composition (U (..), UU (..), UUU (..)) where++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.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Exclusive (Exclusive (exclusive))+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.Distributive (Distributive ((>>-), distribute))+import Pandora.Pattern.Functor.Adjoint (Adjoint (phi, psi))++type (:-|:) t u = (Extractable t, Pointable t, Extractable u, Pointable u, Adjoint t u)+++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, 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+	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 (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+	extract = extract . extract . u++instance (Exclusive t, Covariant u) => Exclusive (U Co Co t u) where+	exclusive = U exclusive++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+	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 (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+	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, Contravariant v) => Contravariant (UU Co Co Contra t u v) where+	f >$< UU x = UU $ (comap . comap) (contramap f) x++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, 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 (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 (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+	extract = extract . extract . extract . uu++instance (Exclusive t, Covariant u, Covariant v) => Exclusive (UU Co Co Co t u v) where+	exclusive = UU exclusive++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 (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 (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 (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, 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, 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, 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, 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+	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, 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+	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+	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 (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 (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+	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 (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+	extract = extract . extract . extract . extract . uuu++instance (Exclusive t, Covariant u, Covariant v, Covariant w) => Exclusive (UUU Co Co Co Co t u v w) where+	exclusive = UUU exclusive++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 (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 (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 (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/Basis/Junction/Kan.hs view
@@ -0,0 +1,17 @@+module Pandora.Paradigm.Basis.Junction.Kan (Lan (..), Ran (..)) where++import Pandora.Core.Morphism ((.), ($))+import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<)))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))++newtype Lan (t :: * -> *) (u :: * -> *) (b :: *) (a :: *) =+	Lan { lan :: (t b -> a) -> u b }++instance Contravariant (Lan t u b) where+	f >$< Lan x = Lan $ x . (f .)++newtype Ran (t :: * -> *) (u :: * -> *) (b :: *) (a :: *) =+	Ran { ran :: (a -> t b) -> u b }++instance Covariant (Ran t u b) where+	f <$> Ran x = Ran $ x . (. f)
+ Pandora/Paradigm/Basis/Junction/Transformer.hs view
@@ -0,0 +1,88 @@+module Pandora.Paradigm.Basis.Junction.Transformer (T (..), type (:!:), up, Y (..), type (:>:)) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism ((.), ($))+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.Exclusive (Exclusive (exclusive))+import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>), apply))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>), traverse))+import Pandora.Pattern.Functor.Distributive (Distributive ((>>-), distribute))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=), bind))+import Pandora.Pattern.Functor.Liftable (Liftable (lift))+import Pandora.Pattern.Functor.Lowerable (Lowerable (lower))++infixr 0 :!:, :>:+type (:!:) t u = T t u+type (:>:) t u = Y t u+++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++instance (Pointable t, Pointable u) => Pointable (T t u) where+	point = T . point . point++instance (Extractable t, Extractable u) => Extractable (T t u) where+	extract = extract . extract . t++instance (Covariant t, Exclusive u) => Exclusive (T t u) where+	exclusive = T exclusive++instance (Covariant t, Alternative u) => Alternative (T t u) where+	T x <+> T y = T $ x <+> y++instance (Applicative t, Applicative u) => Applicative (T t u) where+	T f <*> T x = T $ apply <$> f <*> x++instance Pointable t => Liftable (T t) where+	lift x = T $ point <$> x++instance Extractable t => Lowerable (T t) where+	lower (T x) = extract <$> x++instance (Traversable t, Traversable u) => Traversable (T t u) where+	T x ->> f = T <$> (traverse . traverse) f x++instance (Distributive t, Distributive u) => Distributive (T t u) where+	x >>- f = T . comap distribute . distribute $ t . f <$> x++up :: Pointable u => t a -> T t u a+up = T . point+++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++instance (Pointable (t u), Pointable u) => Pointable (Y t u) where+	point = Y . point . point++instance (Extractable (t u), Extractable u) => Extractable (Y t u) where+	extract = extract . extract . y++instance (Covariant (t u), Exclusive u) => Exclusive (Y t u) where+	exclusive = Y exclusive++instance (Covariant (t u), Alternative u) => Alternative (Y t u) where+	Y x <+> Y y = Y $ x <+> y++instance (Applicative (t u), Applicative u) => Applicative (Y t u) where+	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++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+	lift = Y . point . lift++instance (forall u . Extractable u, Lowerable t) => Lowerable (Y t) where+	lower = lower . extract . y
+ Pandora/Paradigm/Basis/Maybe.hs view
@@ -0,0 +1,91 @@+module Pandora.Paradigm.Basis.Maybe (Maybe (..), maybe) where++import Pandora.Core.Functor (Variant (Co))+import Pandora.Core.Morphism ((.), ($))+import Pandora.Paradigm.Basis.Identity (Identity (Identity))+import Pandora.Paradigm.Basis.Junction.Transformer (T (T, t), type (:!:))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Exclusive (Exclusive (exclusive))+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 ((->>)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Monad (Monad)+import Pandora.Pattern.Functor.Liftable (Liftable (lift))+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.Semilattice (Infimum ((/\)), Supremum ((\/)))+import Pandora.Pattern.Object.Lattice (Lattice)++data Maybe a = Nothing | Just a++instance Covariant Maybe where+	f <$> Just x = Just $ f x+	f <$> Nothing = Nothing++instance Pointable Maybe where+	point = Just++instance Exclusive Maybe where+	exclusive = Nothing++instance Applicative Maybe where+	Just f <*> x = f <$> x+	Nothing <*> x = Nothing++instance Alternative Maybe where+	Nothing <+> y = y+	Just x <+> y = Just x++instance Traversable Maybe where+	Nothing ->> _ = point Nothing+	Just x ->> f = Just <$> f x++instance Bindable Maybe where+	Just x >>= f = f x+	Nothing >>= _ = Nothing++instance Monad Maybe where++instance (Pointable t, Bindable t) => Bindable (Maybe :!: t) where+	T x >>= f = T $ x >>= maybe (point Nothing) (t . f)++instance Monad t => Monad (Maybe :!: t) where++instance Setoid a => Setoid (Maybe a) where+	Just x == Just y = x == y+	Nothing == Nothing = True+	_ == _ = False++instance Chain a => Chain (Maybe a) where+	Just x <=> Just y = x <=> y+	Nothing <=> Nothing = Equal+	Nothing <=> Just x = Less+	Just x <=> Nothing = Greater++instance Semigroup a => Semigroup (Maybe a) where+	Just x <> Just y = Just $ x <> y+	Nothing <> x = x+	x <> Nothing = x++instance Semigroup a => Monoid (Maybe a) where+	unit = Nothing++instance Infimum a => Infimum (Maybe a) where+	Just x /\ Just y = Just $ x /\ y+	_ /\ Nothing = Nothing+	Nothing /\ _ = Nothing++instance Supremum a => Supremum (Maybe a) where+	Just x \/ Just y = Just $ x \/ y+	x \/ Nothing = x+	Nothing \/ x = x++instance Lattice a => Lattice (Maybe a) where++maybe :: b -> (a -> b) -> Maybe a -> b+maybe x _ Nothing = x+maybe _ f (Just y) = f y
+ Pandora/Paradigm/Basis/Predicate.hs view
@@ -0,0 +1,10 @@+module Pandora.Paradigm.Basis.Predicate (Predicate (..)) where++import Pandora.Core.Morphism ((.), ($))+import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<)))+import Pandora.Pattern.Object.Setoid (Boolean)++newtype Predicate a = Predicate { predicate :: a -> Boolean }++instance Contravariant Predicate where+	f >$< g = Predicate $ predicate g . f
+ Pandora/Paradigm/Basis/Product.hs view
@@ -0,0 +1,35 @@+module Pandora.Paradigm.Basis.Product (Product (..), type (:*), delta, swap) where++import Pandora.Core.Morphism (($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Extendable (Extendable ((=>>)))+import Pandora.Pattern.Functor.Comonad (Comonad)+import Pandora.Pattern.Functor.Adjoint (Adjoint (phi, psi))++infixr 1 :*++data Product a b = a :* b++type (:*) = Product++instance Covariant (Product a) where+	f <$> (x :* y) = x :* f y++instance Extractable (Product a) where+	extract (x :* y) = y++instance Extendable (Product a) where+	(x :* y) =>> f = (:*) x $ f (x :* y)++instance Comonad (Product a) where++instance Adjoint (Product a) ((->) a) where+	phi f x y = f $ y :* x+	psi f (y :* x) = f x y++delta :: a -> a :* a+delta x = x :* x++swap :: a :* b -> b :* a+swap (x :* y) = y :* x
+ Pandora/Paradigm/Basis/Wye.hs view
@@ -0,0 +1,27 @@+module Pandora.Paradigm.Basis.Wye (Wye (..), wye) where++import Pandora.Core.Morphism (($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))++data Wye a = End | Left a | Right a | Both a a++instance Covariant Wye where+	f <$> End = End+	f <$> Left x = Left $ f x+	f <$> Right y = Right $ f y+	f <$> Both x y = Both (f x) (f y)++instance Traversable Wye where+	End ->> f = point End+	Left x ->> f = Left <$> f x+	Right y ->> f = Right <$> f y+	Both x y ->> f = Both <$> f x <*> f y++wye :: r -> (a -> r) -> (a -> r) -> (a -> a -> r) -> Wye a -> r+wye r _ _ _ End = r+wye _ f _ _ (Left x) = f x+wye _ _ g _ (Right y) = g y+wye _ _ _ h (Both x y) = h x y
+ Pandora/Paradigm/Basis/Yoneda.hs view
@@ -0,0 +1,35 @@+module Pandora.Paradigm.Basis.Yoneda (Yoneda (..)) where++import Pandora.Core.Morphism ((.), ($), (!), identity)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Exclusive (Exclusive (exclusive))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Adjoint (Adjoint (phi, psi))++newtype Yoneda t a = Yoneda+	{ yoneda :: forall b . (a -> b) -> t b }++instance Covariant (Yoneda t) where+	f <$> x = Yoneda (\k -> yoneda x (k . f))++instance Alternative t => Alternative (Yoneda t) where+	Yoneda f <+> Yoneda g = Yoneda (\k -> f k <+> g k)++instance Applicative t => Applicative (Yoneda t) where+	Yoneda f <*> Yoneda x = Yoneda (\g -> f (g .) <*> x identity)++instance Exclusive t => Exclusive (Yoneda t) where+	exclusive = Yoneda (exclusive !)++instance Pointable t => Pointable (Yoneda t) where+	point x = Yoneda (\f -> point $ f x)++instance Extractable t => Extractable (Yoneda t) where+	extract (Yoneda f) = extract $ f identity++instance (Extractable t, Pointable t, Extractable u, Pointable u) => Adjoint (Yoneda t) (Yoneda u) where+	phi f = point . f . point+	psi f = extract . extract . comap f
+ Pandora/Paradigm/Controlflow.hs view
@@ -0,0 +1,3 @@+module Pandora.Paradigm.Controlflow (module Exports) where++import Pandora.Paradigm.Controlflow.Observable as Exports
+ Pandora/Paradigm/Controlflow/Observable.hs view
@@ -0,0 +1,46 @@+module Pandora.Paradigm.Controlflow.Observable (Observable, observe,+	notify, follow, subscribe, watch, (.:~.), (.:~*), (*:~.), (*:~*)) where++import Pandora.Core.Morphism ((.), ($))+import Pandora.Paradigm.Basis.Continuation (Continuation (Continuation, continue))+import Pandora.Pattern.Functor.Applicative (Applicative (forever))++newtype Capture r t a = Capture { captured :: t r }++type Observable t a r = Continuation r (Capture r t) a++-- | Make continuation observable+observe :: Continuation r t a -> Observable t a r+observe f = Continuation $ \h -> Capture $ continue f (captured . h)++-- | Listen only first event, call back just once+notify :: Observable t a r -> (a -> t r) -> t r+notify r f = captured $ continue r (Capture . f)++-- | Infix version of 'notify'+(.:~.) :: Observable t a r -> (a -> t r) -> t r+(.:~.) = notify++-- | Listen only first event, call back forever+follow :: Applicative t => Observable t a r -> (a -> t r) -> t r+follow r f = captured $ continue r (Capture . forever . f)++-- | Infix version of 'follow'+(.:~*) :: Applicative t => Observable t a r -> (a -> t r) -> t r+(.:~*) = follow++-- | Listen all events from action, call back just once+subscribe :: Applicative t => Observable t a r -> (a -> t r) -> t r+subscribe r f = forever $ captured $ continue r (Capture . f)++-- | Infix version of 'subscribe'+(*:~.) :: Applicative t => Observable t a r -> (a -> t r) -> t r+(*:~.) = subscribe++-- | Listen all events from action, call back forever+watch :: Applicative t => Observable t a r -> (a -> t r) -> t r+watch r f = forever $ captured $ continue r (Capture . forever . f)++-- | Infix version of 'watch'+(*:~*) :: Applicative t => Observable t a r -> (a -> t r) -> t r+(*:~*) = watch
+ Pandora/Paradigm/Inventory.hs view
@@ -0,0 +1,6 @@+module Pandora.Paradigm.Inventory (module Exports) where++import Pandora.Paradigm.Inventory.Optics as Exports+import Pandora.Paradigm.Inventory.Storage as Exports+import Pandora.Paradigm.Inventory.Stateful as Exports+import Pandora.Paradigm.Inventory.Environmental as Exports
+ Pandora/Paradigm/Inventory/Environmental.hs view
@@ -0,0 +1,42 @@+module Pandora.Paradigm.Inventory.Environmental (Environmental (..), Environ, ask, local) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism ((.), ($), (!), flip)+import Pandora.Paradigm.Basis.Identity (Identity)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Monad (Monad)+import Pandora.Pattern.Functor.Liftable (Liftable (lift))++newtype Environmental e t a = Environmental { environmentally :: ((->) e :.: t) a }++type Environ e = Environmental e Identity++instance Covariant t => Covariant (Environmental e t) where+	f <$> Environmental x = Environmental $ comap f . x++instance Pointable t => Pointable (Environmental e t) where+	point x = Environmental $ (!) (point x)++instance Applicative t => Applicative (Environmental e t) where+	f <*> x = Environmental $ \e -> environmentally f e <*> environmentally x e++instance Alternative t => Alternative (Environmental e t) where+	x <+> y = Environmental $ \e -> environmentally x e <+> environmentally y e++instance Bindable t => Bindable (Environmental e t) where+	Environmental x >>= f = Environmental $ \e -> x e >>= flip environmentally e . f++instance Monad t => Monad (Environmental e t) where++instance Liftable (Environmental e) where+	lift = Environmental . (!)++ask :: Pointable t => Environmental e t e+ask = Environmental point++local :: (e -> e) -> Environmental e t a -> Environmental e t a+local f (Environmental x) = Environmental $ x . f
+ Pandora/Paradigm/Inventory/Optics.hs view
@@ -0,0 +1,37 @@+module Pandora.Paradigm.Inventory.Optics (Lens, (|>), view, set, over, (^.), (.~), (%~)) where++import Pandora.Core.Morphism ((.), ($))+import Pandora.Paradigm.Basis.Identity (Identity)+import Pandora.Paradigm.Inventory.Storage (Storage (Storage), access, position, retrofit)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$)))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))++type Lens src tgt = src -> Storage tgt Identity src++-- | Lens composition infix operator+(|>) :: Lens src btw -> Lens btw tgt -> Lens src tgt+from |> to = \x -> ((<$) x . to) . position . from $ x++-- | Get the target of a lens+view :: Lens src tgt -> src -> tgt+view lens = position . lens++-- | Infix version of `view`+(^.) :: Lens src tgt -> src -> tgt+(^.) = view++-- | Replace the target of a lens+set :: Lens src tgt -> tgt -> src -> src+set lens new = access new . lens++-- | Infix version of `set`+(.~) :: Lens src tgt -> tgt -> src -> src+lens .~ new = set lens new++-- | Modify the target of a lens+over :: Lens src tgt -> (tgt -> tgt) -> src -> src+over lens f = extract . retrofit f . lens++-- | Infix version of `over`+(%~) :: Lens src tgt -> (tgt -> tgt) -> src -> src+lens %~ f = over lens f
+ Pandora/Paradigm/Inventory/Stateful.hs view
@@ -0,0 +1,50 @@+module Pandora.Paradigm.Inventory.Stateful (Stateful (..), State, get, modify, put) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism ((.), ($))+import Pandora.Paradigm.Basis.Identity (Identity)+import Pandora.Paradigm.Basis.Product (Product ((:*)), type (:*), delta)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), ($>), comap))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>), (*>)))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Monad (Monad)+import Pandora.Pattern.Functor.Liftable (Liftable (lift))++newtype Stateful s t a = Stateful { statefully :: ((->) s :.: t :.: (:*) s) a }++type State s = Stateful s Identity++instance Covariant t => Covariant (Stateful s t) where+	f <$> Stateful x = Stateful $ \old -> (comap . comap) f $ x old++instance Bindable t => Applicative (Stateful s t) where+	Stateful f <*> Stateful x = Stateful $ \old ->+		f old >>= \(new :* g) -> comap g <$> x new++instance Pointable t => Pointable (Stateful s t) where+	point x = Stateful $ \s -> point $ s :* x++instance Bindable t => Bindable (Stateful s t) where+	Stateful x >>= f = Stateful $ \old ->+		x old >>= \(new :* y) -> statefully (f y) new++instance Monad t => Monad (Stateful s t) where++instance Liftable (Stateful s) where+	lift x = Stateful $ \s -> ((:*) s) <$> x++get :: Pointable t => Stateful s t s+get = Stateful $ point . delta++modify :: Pointable t => (s -> s) -> Stateful s t ()+modify f = Stateful $ \s -> point $ f s :* ()++put :: Pointable t => s -> Stateful s t ()+put s = Stateful $ \_ -> point $ s :* ()++fold :: Traversable t => s -> (a -> s -> s) -> t a -> s+fold start op struct = extract . extract @Identity $+	statefully (struct ->> (modify . op) $> () *> get) start
+ Pandora/Paradigm/Inventory/Storage.hs view
@@ -0,0 +1,40 @@+module Pandora.Paradigm.Inventory.Storage (Storage (..), Store, position, access, retrofit) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism ((.), ($), flip)+import Pandora.Paradigm.Basis.Identity (Identity)+import Pandora.Paradigm.Basis.Product (Product ((:*)), type (:*))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Extendable (Extendable ((=>>)))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Comonad (Comonad)++newtype Storage p t a = Storage { stored :: ((:*) p :.: t :.: (->) p) a }++instance Covariant t => Covariant (Storage p t) where+	f <$> Storage (p :* x) = Storage . (:*) p $ (f .) <$> x++instance Extractable t => Extractable (Storage p t) where+	extract (Storage (p :* x)) = extract x p++instance Extendable t => Extendable (Storage p t) where+	Storage (old :* x) =>> f = Storage . (:*) old . (=>>) x $+		\y -> \new -> f . Storage $ new :* y++instance Applicative t => Applicative (Storage p t) where+	Storage (p :* x) <*> Storage (q :* y) = Storage . (:*) q $+		(\f g x -> f x (g x)) <$> x <*> y++instance Comonad g => Comonad (Storage p g) where++type Store p = Storage p Identity++position :: Storage p t a -> p+position (Storage (p :* _)) = p++access :: Extractable t => p -> Storage p t a -> a+access p = flip extract p . extract . stored++retrofit :: Extractable t => (p -> p) -> Storage p t a -> Storage p t a+retrofit f (Storage (p :* x)) = Storage $ (f p) :* x
+ Pandora/Paradigm/Structure.hs view
@@ -0,0 +1,9 @@+module Pandora.Paradigm.Structure (Nonempty, module Exports) where++import Pandora.Paradigm.Structure.Stack as Exports++import Pandora.Paradigm.Basis.Cofree (Cofree)+import Pandora.Paradigm.Basis.Junction.Transformer (type (:>:))++type family Nonempty structure :: * where+	Nonempty ((Cofree :>: t) a) = Cofree t a
+ Pandora/Paradigm/Structure/Stack.hs view
@@ -0,0 +1,23 @@+module Pandora.Paradigm.Structure.Stack (Stack, push, top, pop) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism ((.), ($))+import Pandora.Paradigm.Basis.Cofree (Cofree ((:<)), unwrap)+import Pandora.Paradigm.Basis.Maybe (Maybe (Just))+import Pandora.Paradigm.Basis.Junction.Transformer (Y (Y, y), type (:>:))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Extractable (Extractable (extract))+import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))++type Stack a = (Cofree :>: Maybe) a++push :: a -> Stack a -> Stack a+push x (Y struct) = (Y $ (:<) x . Just <$> struct) <+> point x++top :: Stack a -> Maybe a+top (Y struct) = extract <$> struct++pop :: Stack a -> Stack a+pop (Y struct) = Y $ struct >>= unwrap
+ Pandora/Pattern/Functor.hs view
@@ -0,0 +1,19 @@+module Pandora.Pattern.Functor (module Exports) where++import Pandora.Pattern.Functor.Lowerable as Exports+import Pandora.Pattern.Functor.Liftable as Exports+import Pandora.Pattern.Functor.Comonad as Exports+import Pandora.Pattern.Functor.Monad as Exports+import Pandora.Pattern.Functor.Adjoint as Exports+import Pandora.Pattern.Functor.Extendable as Exports+import Pandora.Pattern.Functor.Bindable as Exports+import Pandora.Pattern.Functor.Distributive as Exports+import Pandora.Pattern.Functor.Traversable as Exports+import Pandora.Pattern.Functor.Extractable as Exports+import Pandora.Pattern.Functor.Pointable as Exports+import Pandora.Pattern.Functor.Exclusive as Exports+import Pandora.Pattern.Functor.Applicative as Exports+import Pandora.Pattern.Functor.Alternative as Exports+import Pandora.Pattern.Functor.Invariant as Exports+import Pandora.Pattern.Functor.Contravariant as Exports+import Pandora.Pattern.Functor.Covariant as Exports
+ Pandora/Pattern/Functor/Adjoint.hs view
@@ -0,0 +1,27 @@+module Pandora.Pattern.Functor.Adjoint (Adjoint (..), type (-|)) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism (identity)+import Pandora.Pattern.Functor.Covariant (Covariant)++{- |+> 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 interchange: phi f ≡ comap f . eta+> * Right adjunction interchange: psi f ≡ epsilon . comap f+-}++class (Covariant t, Covariant u) => Adjoint t u where+	{-# MINIMAL phi, psi #-}+	-- | Left adjunction+	phi :: (t a -> b) -> a -> u b+	-- | Right adjunction+	psi :: (a -> u b) -> t a -> b++	eta :: a -> (u :.: t) a+	eta = phi identity+	epsilon :: (t :.: u) a -> a+	epsilon = psi identity++type (-|) = Adjoint
+ Pandora/Pattern/Functor/Alternative.hs view
@@ -0,0 +1,20 @@+module Pandora.Pattern.Functor.Alternative (Alternative (..)) where++import Pandora.Pattern.Functor.Covariant (Covariant)++infixl 3 <+>++{- |+> When providing a new instance, you should ensure it satisfies the two laws:+> * Associativity of <+>: (x <+> y) <+> z ≡ x <+> (y <+> z)+> * Left-distributes <$> over <+>: f <$> (x <+> y) ≡ (f <$> x) <+> (f <$> y)+-}++class Covariant t => Alternative t where+	{-# MINIMAL (<+>) #-}+	-- | Infix version of 'alter'++	(<+>) :: t a -> t a -> t a+	-- | Prefix version of '<+>'+	alter :: t a -> t a -> t a+	alter f g = f <+> g
+ Pandora/Pattern/Functor/Applicative.hs view
@@ -0,0 +1,31 @@+module Pandora.Pattern.Functor.Applicative (Applicative (..)) where++import Pandora.Core.Morphism (identity)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$)))++infixl 4 <*>, <*, *>++{- |+> When providing a new instance, you should ensure it satisfies the three laws:+> * Composition: (.) <$> u <*> v <*> w ≡ u <*> (v <*> w)+> * Left interchange: x <*> (f <$> y) ≡ (. f) <$> x <*> y+> * Right interchange: f <$> (x <*> y) ≡ (f .) <$> x <*> y+-}++class Covariant t => Applicative t where+	{-# MINIMAL (<*>) #-}+	-- | Infix version of 'apply'+	(<*>) :: t (a -> b) -> t a -> t b++	-- | Prefix version of '<*>'+	apply :: t (a -> b) -> t a -> t b+	apply f x = f <*> x+	-- | Sequence actions, discarding the value of the first argument+	(*>) :: t a -> t b -> t b+	x *> y = (identity <$ x) <*> y+	-- | Sequence actions, discarding the value of the second argument+	(<*) :: t a -> t b -> t a+	x <* y = y *> x+	-- | Repeat an action indefinitely+	forever :: t a -> t b+	forever x = x *> forever x
+ Pandora/Pattern/Functor/Bindable.hs view
@@ -0,0 +1,34 @@+module Pandora.Pattern.Functor.Bindable (Bindable (..)) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism (($), flip, identity)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))++infixl 1 >>=+infixr 1 =<<, <=<, >=>++{- |+> When providing a new instance, you should ensure it satisfies the one law:+> * Interchange: t >>= f = join (f <$> t)+-}++class Covariant t => Bindable t where+	{-# MINIMAL (>>=) #-}+	-- | Infix and flipped version of 'bind', the dual of '=>>'+	(>>=) :: t a -> (a -> t b) -> t b++	-- | Flipped version of '>>=', the dual of '<<='+	(=<<) :: (a -> t b) -> t a -> t b+	(=<<) = flip (>>=)+	-- | Prefix and flipped version of '>>=', the dual of 'extend'+	bind :: (a -> t b) -> t a -> t b+	bind f t = t >>= f+	-- | Merge effects/contexts, the dual of 'duplicate'+	join :: (t :.: t) a -> t a+	join t = t >>= identity+	-- | Left-to-right Kleisli composition+	(>=>) :: (a -> t b) -> (b -> t c) -> (a -> t c)+	f >=> g = \x -> f x >>= g+	-- | Right-to-left Kleisli composition+	(<=<) :: (b -> t c) -> (a -> t b) -> (a -> t c)+	(<=<) = flip (>=>)
+ Pandora/Pattern/Functor/Comonad.hs view
@@ -0,0 +1,16 @@+module Pandora.Pattern.Functor.Comonad (Comonad (..)) where++import Pandora.Pattern.Functor.Extractable (Extractable)+import Pandora.Pattern.Functor.Extendable (Extendable)++{- |+> Let f :: (Pointable t, Bindable t) => t a -> b+> Let g :: (Pointable t, Bindable t) => t a -> b++> When providing a new instance, you should ensure it satisfies the three laws:+> * Left identity: extend extract ≡ identity+> * Right identity: extract . extend f ≡ f+> * Associativity: extend f . extend g ≡ extend (f . extend g)+-}++class (Extractable t, Extendable t) => Comonad t
+ Pandora/Pattern/Functor/Contravariant.hs view
@@ -0,0 +1,29 @@+module Pandora.Pattern.Functor.Contravariant (Contravariant (..)) where++import Pandora.Core.Morphism ((.), (!), flip)++infixl 4 >$<, $<, >$++{- |+> When providing a new instance, you should ensure it satisfies the two laws:+> * Identity morphism: contramap identity ≡ identity+> * Composition of morphisms: contramap f . contramap g ≡ contramap (g . f)+-}++class Contravariant (t :: * -> *) where+	{-# MINIMAL (>$<) #-}+	-- | Infix version of 'contramap'+	(>$<) :: (a -> b) -> t b -> t a++	-- | Prefix version of '>$<'+	contramap :: (a -> b) -> t b -> t a+	contramap f x = f >$< x+	-- | Replace all locations in the output with the same value+	(>$) :: b -> t b -> t a+	(>$) = contramap . (!)+	-- | Flipped version of '>$'+	($<) :: t b -> b -> t a+	($<) = flip (>$)+	-- | Fill the input of evaluation+	full :: t () -> t a+	full x = () >$ x
+ Pandora/Pattern/Functor/Covariant.hs view
@@ -0,0 +1,32 @@+module Pandora.Pattern.Functor.Covariant (Covariant (..)) where++import Pandora.Core.Morphism ((.), (!), flip)++infixl 4 <$>, <$, $>++{- |+> When providing a new instance, you should ensure it satisfies the two laws:+> * Identity morphism: comap identity ≡ identity+> * Composition of morphisms: comap (f . g) ≡ comap f . comap g+-}++class Covariant (t :: * -> *) where+	{-# MINIMAL (<$>) #-}+	-- | Infix version of 'comap'+	(<$>) :: (a -> b) -> t a -> t b++	-- | Prefix version of '<$>'+	comap :: (a -> b) -> t a -> t b+	comap f x = f <$> x+	-- | Replace all locations in the input with the same value+	(<$) :: a -> t b -> t a+	(<$) = comap . (!)+	-- | Flipped version of '<$'+	($>) :: t a -> b -> t b+	($>) = flip (<$)+	-- | Discards the result of evaluation+	void :: t a -> t ()+	void x = () <$ x++instance Covariant ((->) a) where+	(<$>) = (.)
+ Pandora/Pattern/Functor/Distributive.hs view
@@ -0,0 +1,25 @@+module Pandora.Pattern.Functor.Distributive (Distributive (..)) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism (identity)+import Pandora.Pattern.Functor.Covariant (Covariant)++{- |+> Let f :: Distributive g => (a -> g b)++> When providing a new instance, you should ensure it satisfies the two laws:+> * Identity morphism: distribute . distribute ≡ identity+> * Interchange collection: collect f ≡ distribute . comap f+-}++class Covariant u => Distributive u where+	{-# MINIMAL (>>-) #-}+	-- | Infix version of 'collect'+	(>>-) :: Covariant t => t a -> (a -> u b) -> (u :.: t) b++	-- | Prefix version of '>>-'+	collect :: Covariant t => (a -> u b) -> t a -> (u :.: t) b+	collect f t = t >>- f+	-- | The dual of 'sequence'+	distribute :: Covariant t => (t :.: u) a -> (u :.: t) a+	distribute t = t >>- identity
+ Pandora/Pattern/Functor/Exclusive.hs view
@@ -0,0 +1,12 @@+module Pandora.Pattern.Functor.Exclusive (Exclusive (..)) where++import Pandora.Pattern.Functor.Alternative (Alternative)++{- |+> When providing a new instance, you should ensure it satisfies the two laws:+> * Left absorption: x <+> exclusive ≡ x+> * Right absorption: exclusive <+> x ≡ x+-}++class Alternative t => Exclusive t where+	exclusive :: t a
+ Pandora/Pattern/Functor/Extendable.hs view
@@ -0,0 +1,35 @@+module Pandora.Pattern.Functor.Extendable (Extendable (..)) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism ((.), flip, identity)+import Pandora.Pattern.Functor.Covariant (Covariant)++infixl 1 =>>+infixr 1 <<=, =<=, =>=++{- |+> When providing a new instance, you should ensure it satisfies the three laws:+> * Duplication interchange: comap (comap f) . duplicate ≡ duplicate . comap f+> * Extension interchange: extend f ≡ comap f . duplicate+-}++class Covariant t => Extendable t where+	{-# MINIMAL (=>>) #-}+	-- | Infix and flipped version of 'extend', the dual of '>>='+	(=>>) :: t a -> (t a -> b) -> t b++	-- | Flipped version of '>>=', the dual of '=<<'+	(<<=) :: (t a -> b) -> t a -> t b+	(<<=) = flip (=>>)+	-- | Prefix and flipped version of '=>>', the dual of 'bind'+	extend :: (t a -> b) -> t a -> t b+	extend f t = t =>> f+	-- | Clone existing structure, the dual of 'join'+	duplicate :: t a -> (t :.: t) a+	duplicate t = t =>> identity+	-- | Right-to-left Cokleisli composition+	(=<=) :: (t b -> c) -> (t a -> b) -> t a -> c+	f =<= g = f . extend g+	-- | Left-to-right Cokleisli composition+	(=>=) :: (t a -> b) -> (t b -> c) -> t a -> c+	f =>= g = g . extend f
+ Pandora/Pattern/Functor/Extractable.hs view
@@ -0,0 +1,6 @@+module Pandora.Pattern.Functor.Extractable (Extractable (..)) where++import Pandora.Pattern.Functor.Covariant (Covariant)++class Covariant t => Extractable t where+	extract :: t a -> a
+ Pandora/Pattern/Functor/Invariant.hs view
@@ -0,0 +1,24 @@+module Pandora.Pattern.Functor.Invariant (Invariant (..)) where++import Pandora.Core.Morphism (flip)++infixl 4 >$>+infixr 4 <$<++{- |+> When providing a new instance, you should ensure it satisfies the two laws:+> Identity morphisms: invmap identity identity = identity+> Composition of morphisms: invmap g j . invmap f h = invmap (g . f) (h . j)+-}++class Invariant (t :: * -> *) where+	{-# MINIMAL (<$<) #-}+	-- | Infix version of 'invmap'+	(<$<) :: (a -> b) -> (b -> a) -> t a -> t b++	-- | Prefix version of '<$<'+	invmap :: (a -> b) -> (b -> a) -> t a -> t b+	invmap f x = f <$< x+	-- | Flipped version of '<$<'+	(>$>) :: (b -> a) -> (a -> b) -> t a -> t b+	(>$>) = flip (<$<)
+ Pandora/Pattern/Functor/Liftable.hs view
@@ -0,0 +1,7 @@+module Pandora.Pattern.Functor.Liftable (Liftable (..)) where++import Pandora.Core.Functor (type (~>))+import Pandora.Pattern.Functor.Covariant (Covariant)++class Liftable t where+	lift :: Covariant u => u ~> t u
+ Pandora/Pattern/Functor/Lowerable.hs view
@@ -0,0 +1,7 @@+module Pandora.Pattern.Functor.Lowerable (Lowerable (..)) where++import Pandora.Core.Functor (type (~>))+import Pandora.Pattern.Functor.Covariant (Covariant)++class Lowerable t where+	lower :: Covariant u => t u ~> u
+ Pandora/Pattern/Functor/Monad.hs view
@@ -0,0 +1,17 @@+module Pandora.Pattern.Functor.Monad (Monad) where++import Pandora.Pattern.Functor.Bindable (Bindable)+import Pandora.Pattern.Functor.Pointable (Pointable)++{- |+> Let f :: (Pointable t, Bindable t) => a -> t a+> Let g :: (Pointable t, Bindable t) => a -> t a+> Let h :: (Pointable t, Bindable t) => t a++> When providing a new instance, you should ensure it satisfies the three laws:+> * Left identity: point a >>= f ≡ f a+> * Right identity: h >>= point ≡ h+> * Associativity: h >>= (\x -> f x >>= g) ≡ (h >>= f) >>= g+-}++class (Pointable t, Bindable t) => Monad t
+ Pandora/Pattern/Functor/Pointable.hs view
@@ -0,0 +1,6 @@+module Pandora.Pattern.Functor.Pointable (Pointable (..)) where++import Pandora.Pattern.Functor.Covariant (Covariant)++class Covariant t => Pointable t where+	point :: a -> t a
+ Pandora/Pattern/Functor/Traversable.hs view
@@ -0,0 +1,30 @@+module Pandora.Pattern.Functor.Traversable (Traversable (..)) where++import Pandora.Core.Functor (type (:.:))+import Pandora.Core.Morphism (identity)+import Pandora.Pattern.Functor.Covariant (Covariant)+import Pandora.Pattern.Functor.Applicative (Applicative)+import Pandora.Pattern.Functor.Pointable (Pointable)++{- |+> Let f :: (Applicative t, Applicative g) => t a -> u a+> Let p :: (Pointable t, Pointable g) => t a -> u a++> When providing a new instance, you should ensure it satisfies the four laws:+> * Naturality of traversing: g . traverse f ≡ traverse (g . f)+> * Naturality of sequencing: f . sequence = sequence . comap f+> * Preserving point: p (point x) ≡ point x+> * Preserving apply: f (x <*> y) ≡ f x <*> f y+-}++class Covariant t => Traversable t where+	{-# MINIMAL (->>) #-}+	-- | Infix version of 'traverse'+	(->>) :: (Pointable u, Applicative u) => t a -> (a -> u b) -> (u :.: t) b++	-- | Prefix version of '->>'+	traverse :: (Pointable u, Applicative u) => (a -> u b) -> t a -> (u :.: t) b+	traverse f t = t ->> f+	-- | The dual of 'distribute'+	sequence :: (Pointable u, Applicative u) => (t :.: u) a -> (u :.: t) a+	sequence t = t ->> identity
+ Pandora/Pattern/Object.hs view
@@ -0,0 +1,10 @@+module Pandora.Pattern.Object (module Exports) where++import Pandora.Pattern.Object.Lattice as Exports+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.Ringoid as Exports+import Pandora.Pattern.Object.Semigroup as Exports+import Pandora.Pattern.Object.Chain as Exports+import Pandora.Pattern.Object.Setoid as Exports
+ Pandora/Pattern/Object/Chain.hs view
@@ -0,0 +1,31 @@+module Pandora.Pattern.Object.Chain (Ordering (..), order, Chain (..)) where++import Pandora.Core.Morphism (($), flip)+import Pandora.Pattern.Object.Setoid (Boolean (True, False), Setoid)++data Ordering = Less | Equal | Greater++order :: a -> a -> a -> Ordering -> a+order x _ _ Less = x+order _ y _ Equal = y+order _ _ z Greater = z++{- |+> When providing a new instance, you should ensure it satisfies the three laws:+> * Reflexivity: x <= x ≡ True+> * Transitivity: x <= y && y <= z ≡ True ===> x <= z ≡ True+> * Antisymmetry: x <= y && y <= x ≡ True ===> x == y ≡ True+-}++class Setoid a => Chain a where+	{-# MINIMAL (<=>) #-}+	(<=>) :: a -> a -> Ordering++	(<) :: a -> a -> Boolean+	x < y = order True False False $ x <=> y+	(<=) :: a -> a -> Boolean+	x <= y = order True True False $ x <=> y+	(>) :: a -> a -> Boolean+	x > y = order False False True $ x <=> y+	(>=) :: a -> a -> Boolean+	x >= y = order False True True $ x <=> y
+ Pandora/Pattern/Object/Group.hs view
@@ -0,0 +1,13 @@+module Pandora.Pattern.Object.Group (Group (..)) where++import Pandora.Pattern.Object.Monoid (Monoid)++{- |+> 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+-}++class Monoid a => Group a where+	{-# MINIMAL inverse #-}+	inverse :: a -> a
+ Pandora/Pattern/Object/Lattice.hs view
@@ -0,0 +1,10 @@+module Pandora.Pattern.Object.Lattice (Lattice (..)) where++import Pandora.Pattern.Object.Semilattice (Infimum, Supremum)++{- |+> When providing a new instance, you should ensure it satisfies the one law:+> * Absorption: a \/ (a /\ b) ≡ a /\ (a \/ b) ≡ a+-}++class (Infimum a, Supremum a) => Lattice a where
+ Pandora/Pattern/Object/Monoid.hs view
@@ -0,0 +1,13 @@+module Pandora.Pattern.Object.Monoid (Monoid (..)) where++import Pandora.Pattern.Object.Semigroup (Semigroup)++{- |+> When providing a new instance, you should ensure it satisfies the two laws:+> * Right absorption: unit <> x ≡ x+> * Left absorption: x <> unit ≡ x+-}++class Semigroup a => Monoid a where+	{-# MINIMAL unit #-}+	unit :: a
+ Pandora/Pattern/Object/Ringoid.hs view
@@ -0,0 +1,13 @@+module Pandora.Pattern.Object.Ringoid (Ringoid (..)) where++import Pandora.Pattern.Object.Semigroup (Semigroup)++{- |+> 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+-}++class Semigroup a => Ringoid a where+	{-# MINIMAL (><) #-}+	(><) :: a -> a -> a
+ Pandora/Pattern/Object/Semigroup.hs view
@@ -0,0 +1,11 @@+module Pandora.Pattern.Object.Semigroup (Semigroup (..)) where++{- |+> When providing a new instance, you should ensure it satisfies the one law:+> * Associativity: x <> (y <> z) ≡ (x <> y) <> z+-}++class Semigroup a where+	{-# MINIMAL (<>) #-}+	-- | Infix version of 'append'+	(<>) :: a -> a -> a
+ Pandora/Pattern/Object/Semilattice.hs view
@@ -0,0 +1,27 @@+module Pandora.Pattern.Object.Semilattice (Infimum (..), Supremum (..), Semilattice) where++{- |+> When providing a new instance, you should ensure it satisfies the three laws:+> * Associativity: x /\ (y /\ z) ≡ (x /\ y) /\ z+> * Commutativity: x /\ y ≡ y /\ x+> * Idempotency: x /\ x ≡ x+-}++class Infimum a where+	{-# MINIMAL (/\) #-}+	(/\) :: a -> a -> a++{- |+> When providing a new instance, you should ensure it satisfies the three laws:+> * Associativity: x \/ (y \/ z) ≡ (x \/ y) \/ z+> * Commutativity: x \/ y ≡ y \/ x+> * Idempotency: x \/ x ≡ x+-}++class Supremum a where+	{-# MINIMAL (\/) #-}+	(\/) :: a -> a -> a++type family Semilattice constraint where+	Semilattice Infimum = ()+	Semilattice Supremum = ()
+ Pandora/Pattern/Object/Setoid.hs view
@@ -0,0 +1,41 @@+module Pandora.Pattern.Object.Setoid (Boolean (..), (&&), (||), not, bool, Setoid (..)) where++import Pandora.Core.Morphism (($))++infixr ||+infixr 3 &&+infix 4 ==, /=++data Boolean = True | False++(&&) :: Boolean -> Boolean -> Boolean+True && True = True+_ && _ = False++(||) :: Boolean -> Boolean -> Boolean+True || _ = True+_ || True = True+_ || _ = False++not :: Boolean -> Boolean+not True = False+not False = True++bool :: a -> a -> Boolean -> a+bool x _ False = x+bool _ y True = y++{- |+> When providing a new instance, you should ensure it satisfies the four laws:+> * Reflexivity: x == x ≡ True+> * Symmetry: x == y ≡ y == x+> * Transitivity: x == y && y == z ≡ True ===> x == z ≡ True+> * Negation: x /= y ≡ not (x == y)+-}++class Setoid a where+	{-# MINIMAL (==) #-}+	(==) :: a -> a -> Boolean++	(/=) :: a -> a -> Boolean+	(/=) x y = not $ x == y
+ README.md view
@@ -0,0 +1,7 @@+# Pandora - the box of patterns and paradigms++## Diagram of functor patterns:+![Functors diagram](/Diagrams/Functors.png)++## Diagram of object patterns:+![Objects diagram](/Diagrams/Objects.png)
+ pandora.cabal view
@@ -0,0 +1,91 @@+name:                pandora+version:             0.1.0+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+license:             MIT+license-file:        LICENSE+extra-source-files:  CHANGELOG.md, README.md+author:              Murat Kasimov+maintainer:          Murat Kasimov <iokasimov.m@gmail.com>+copyright:           Copyright (c) 2019 Murat Kasimov+category:            Data, Control+build-type:          Simple+cabal-version:       >= 1.10++source-repository head+  type: git+  location: https://github.com/iokasimov/pandora.git++library+  exposed-modules:+    -- Axioms set+    Pandora.Core.Functor+    Pandora.Core.Morphism+    -- Basic constructions+    Pandora.Paradigm.Basis+    Pandora.Paradigm.Basis.Cofree+    Pandora.Paradigm.Basis.Conclusion+    Pandora.Paradigm.Basis.Constant+    Pandora.Paradigm.Basis.Continuation+    Pandora.Paradigm.Basis.Edges+    Pandora.Paradigm.Basis.Fix+    Pandora.Paradigm.Basis.Free+    Pandora.Paradigm.Basis.Identity+    Pandora.Paradigm.Basis.Jack+    Pandora.Paradigm.Basis.Junction.Composition+    Pandora.Paradigm.Basis.Junction.Transformer+    Pandora.Paradigm.Basis.Junction.Kan+    Pandora.Paradigm.Basis.Maybe+    Pandora.Paradigm.Basis.Predicate+    Pandora.Paradigm.Basis.Product+    Pandora.Paradigm.Basis.Wye+    Pandora.Paradigm.Basis.Yoneda+    -- Control flow primitives+    Pandora.Paradigm.Controlflow+    Pandora.Paradigm.Controlflow.Observable+    -- Tools for datastructures+    Pandora.Paradigm.Inventory+    Pandora.Paradigm.Inventory.Environmental+    Pandora.Paradigm.Inventory.Optics+    Pandora.Paradigm.Inventory.Stateful+    Pandora.Paradigm.Inventory.Storage+    -- Tree-based datastructures+    Pandora.Paradigm.Structure+    Pandora.Paradigm.Structure.Stack+    -- Functor typeclassess+    Pandora.Pattern.Functor+    Pandora.Pattern.Functor.Adjoint+    Pandora.Pattern.Functor.Alternative+    Pandora.Pattern.Functor.Applicative+    Pandora.Pattern.Functor.Bindable+    Pandora.Pattern.Functor.Comonad+    Pandora.Pattern.Functor.Contravariant+    Pandora.Pattern.Functor.Covariant+    Pandora.Pattern.Functor.Distributive+    Pandora.Pattern.Functor.Exclusive+    Pandora.Pattern.Functor.Extendable+    Pandora.Pattern.Functor.Extractable+    Pandora.Pattern.Functor.Invariant+    Pandora.Pattern.Functor.Liftable+    Pandora.Pattern.Functor.Lowerable+    Pandora.Pattern.Functor.Monad+    Pandora.Pattern.Functor.Pointable+    Pandora.Pattern.Functor.Traversable+    -- Typeclassess about object internals+    Pandora.Pattern.Object+    Pandora.Pattern.Object.Chain+    Pandora.Pattern.Object.Group+    Pandora.Pattern.Object.Lattice+    Pandora.Pattern.Object.Monoid+    Pandora.Pattern.Object.Ringoid+    Pandora.Pattern.Object.Semigroup+    Pandora.Pattern.Object.Semilattice+    Pandora.Pattern.Object.Setoid+  default-extensions:+    DataKinds, ConstraintKinds, ExistentialQuantification, QuantifiedConstraints+    FlexibleContexts, FlexibleInstances, KindSignatures, LiberalTypeSynonyms+    MultiParamTypeClasses, NoImplicitPrelude, PackageImports, PolyKinds, RankNTypes+    TypeApplications, TypeFamilies, TypeOperators+  default-language: Haskell2010+  ghc-options: -fno-warn-tabs