pandora 0.3.7 → 0.3.8
raw patch · 80 files changed
+622/−513 lines, 80 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Pandora.Paradigm.Controlflow.Pipeline: instance forall k i o (r :: k) (t :: k -> *). Pandora.Pattern.Functor.Contravariant.Contravariant (Pandora.Paradigm.Controlflow.Pipeline.Pipe i o r t)
- Pandora.Paradigm.Controlflow.Pipeline: instance forall k i o (r :: k) (t :: k -> *). Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Controlflow.Pipeline.Pipe i o r t)
- Pandora.Paradigm.Primary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Into Pandora.Paradigm.Primary.Functor.Wye.Wye) ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
- Pandora.Paradigm.Primary.Functor: branches :: Maybe a -> Maybe a -> Wye a
- Pandora.Paradigm.Primary.Transformer.Continuation: [continue] :: Continuation r t a -> (((->) ::|:. a) :. t) := r
- Pandora.Paradigm.Schemes.T_U: instance (Pandora.Pattern.Functor.Bivariant.Bivariant p, Pandora.Pattern.Functor.Covariant.Covariant t, Pandora.Pattern.Functor.Covariant.Covariant u) => Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant t p u)
- Pandora.Paradigm.Schemes.T_U: instance (Pandora.Pattern.Functor.Divariant.Divariant p, Pandora.Pattern.Functor.Contravariant.Contravariant t, Pandora.Pattern.Functor.Covariant.Covariant u) => Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Contravariant.Contravariant Pandora.Pattern.Functor.Covariant.Covariant t p u)
- Pandora.Paradigm.Schemes.T_U: instance forall k1 k2 k3 k4 (ct :: k1) (cu :: k2) (t :: * -> k3) (p :: k3 -> k4 -> *) (u :: * -> k4). Pandora.Paradigm.Controlflow.Effect.Interpreted.Interpreted (Pandora.Paradigm.Schemes.T_U.T_U ct cu t p u)
- Pandora.Paradigm.Structure.Ability.Insertable: (+=) :: Insertable t => a -> t a -> t a
- Pandora.Paradigm.Structure.Ability.Insertable: class Insertable t
- Pandora.Paradigm.Structure.Ability.Insertable: infixr 2 +=
- Pandora.Paradigm.Structure.Some.Binary: instance (forall a. Pandora.Pattern.Object.Chain.Chain a) => Pandora.Paradigm.Structure.Ability.Insertable.Insertable (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
- Pandora.Paradigm.Structure.Some.Binary: instance (forall a. Pandora.Pattern.Object.Chain.Chain a) => Pandora.Paradigm.Structure.Ability.Insertable.Insertable Pandora.Paradigm.Structure.Some.Binary.Binary
- Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Structure.Some.Binary.Up) (Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye) (Pandora.Paradigm.Primary.Functor.Product.:*:) ((Pandora.Paradigm.Structure.Some.Binary.Biforked Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.Binary.Biforked) Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant Pandora.Paradigm.Primary.Functor.Identity.Identity (Pandora.Paradigm.Primary.Functor.Product.:*:) (Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)))
- Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate ('Pandora.Paradigm.Structure.Some.Binary.Down 'Pandora.Paradigm.Primary.Functor.Wye.Left)) (Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye) (Pandora.Paradigm.Primary.Functor.Product.:*:) ((Pandora.Paradigm.Structure.Some.Binary.Biforked Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.Binary.Biforked) Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant Pandora.Paradigm.Primary.Functor.Identity.Identity (Pandora.Paradigm.Primary.Functor.Product.:*:) (Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)))
- Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate ('Pandora.Paradigm.Structure.Some.Binary.Down 'Pandora.Paradigm.Primary.Functor.Wye.Right)) (Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye) (Pandora.Paradigm.Primary.Functor.Product.:*:) ((Pandora.Paradigm.Structure.Some.Binary.Biforked Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.Binary.Biforked) Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Schemes.T_U.T_U Pandora.Pattern.Functor.Covariant.Covariant Pandora.Pattern.Functor.Covariant.Covariant Pandora.Paradigm.Primary.Functor.Identity.Identity (Pandora.Paradigm.Primary.Functor.Product.:*:) (Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)))
- Pandora.Paradigm.Structure.Some.Rose: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable 'Pandora.Paradigm.Structure.Ability.Focusable.Root (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.Stack.Stack)
- Pandora.Paradigm.Structure.Some.Rose: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Maybe.Just (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.Stack.Stack)
- Pandora.Paradigm.Structure.Some.Stack: filter :: forall a. Predicate a -> Stack a -> Stack a
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Deletable.Deletable Pandora.Paradigm.Structure.Some.Stack.Stack
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable 'Pandora.Paradigm.Structure.Ability.Focusable.Head (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable 'Pandora.Paradigm.Structure.Ability.Focusable.Head Pandora.Paradigm.Structure.Some.Stack.Stack
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Insertable.Insertable (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Insertable.Insertable Pandora.Paradigm.Structure.Some.Stack.Stack
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Measurable.Measurable 'Pandora.Paradigm.Structure.Ability.Measurable.Length (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Measurable.Measurable 'Pandora.Paradigm.Structure.Ability.Measurable.Length Pandora.Paradigm.Structure.Some.Stack.Stack
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a ((Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe) Pandora.Core.Functor.:= a)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe a)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Into Pandora.Paradigm.Structure.Some.Stack.Stack) (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Left) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe))
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Left) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stack.Stack))
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Right) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe))
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Right) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stack.Stack))
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Nullable.Nullable Pandora.Paradigm.Structure.Some.Stack.Stack
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Structure.Ability.Substructure.Tail (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Structure.Ability.Substructure.Tail Pandora.Paradigm.Structure.Some.Stack.Stack
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Pattern.Functor.Extendable.Extendable (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stack.Stack))
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Structure.Some.Stack.Stack a)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe a)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Structure.Some.Stack.Stack a)
- Pandora.Paradigm.Structure.Some.Stack: instance Pandora.Pattern.Object.Setoid.Setoid a => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Structure.Some.Stack.Stack a)
- Pandora.Paradigm.Structure.Some.Stack: linearize :: forall t a. Traversable t => t a -> Stack a
- Pandora.Paradigm.Structure.Some.Stack: type Stack = Maybe <:.> Construction Maybe
- Pandora.Paradigm.Structure.Some.Stream: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Left) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stream.Stream))
- Pandora.Paradigm.Structure.Some.Stream: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Right) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stream.Stream))
- Pandora.Paradigm.Structure.Some.Stream: instance Pandora.Pattern.Functor.Extendable.Extendable (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Functor.Product.:*:) Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stream.Stream))
- Pandora.Pattern.Category: instance Pandora.Pattern.Category.Category (->)
- Pandora.Pattern.Functor.Divariant: instance Pandora.Pattern.Functor.Divariant.Divariant (->)
- Pandora.Pattern.Functor.Traversable: infixl 3 ->>
+ Pandora.Paradigm.Controlflow.Pipeline: instance Pandora.Paradigm.Controlflow.Effect.Interpreted.Interpreted (Pandora.Paradigm.Controlflow.Pipeline.Consumer o t)
+ Pandora.Paradigm.Controlflow.Pipeline: instance Pandora.Paradigm.Controlflow.Effect.Interpreted.Interpreted (Pandora.Paradigm.Controlflow.Pipeline.Producer i t)
+ Pandora.Paradigm.Inventory.Environment: instance Pandora.Pattern.Functor.Divariant.Divariant Pandora.Paradigm.Inventory.Environment.Environment
+ Pandora.Paradigm.Inventory.Imprint: instance Pandora.Pattern.Functor.Divariant.Divariant Pandora.Paradigm.Inventory.Imprint.Imprint
+ Pandora.Paradigm.Primary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Into Pandora.Paradigm.Primary.Functor.Wye.Wye) ((Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Primary.Functor.Maybe.Maybe) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:))
+ Pandora.Paradigm.Primary: instance Pandora.Pattern.Category.Category (Pandora.Paradigm.Primary.Transformer.Flip.Flip (->))
+ Pandora.Paradigm.Primary.Functor.Function: (!!!) :: a -> b -> c -> d -> a
+ Pandora.Paradigm.Primary.Functor.Function: (!!) :: a -> b -> c -> a
+ Pandora.Paradigm.Primary.Functor.Function: instance Pandora.Pattern.Category.Category (->)
+ Pandora.Paradigm.Primary.Functor.Function: instance Pandora.Pattern.Functor.Divariant.Divariant (->)
+ Pandora.Paradigm.Primary.Functor.Predicate: instance Pandora.Paradigm.Controlflow.Effect.Interpreted.Interpreted Pandora.Paradigm.Primary.Functor.Predicate.Predicate
+ Pandora.Paradigm.Primary.Functor.Product: twosome :: t a -> u a -> (<:.:>) t u (:*:) a
+ Pandora.Paradigm.Primary.Functor.These: instance (Pandora.Pattern.Object.Semigroup.Semigroup e, Pandora.Pattern.Object.Semigroup.Semigroup a) => Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Functor.These.These e a)
+ Pandora.Paradigm.Primary.Transformer.Continuation: instance forall k (r :: k) (t :: k -> *). Pandora.Paradigm.Controlflow.Effect.Interpreted.Interpreted (Pandora.Paradigm.Primary.Transformer.Continuation.Continuation r t)
+ Pandora.Paradigm.Primary.Transformer.Instruction: instance (forall (t :: * -> *). Pandora.Pattern.Functor.Monad.Monad t) => Pandora.Pattern.Transformer.Lowerable.Lowerable Pandora.Paradigm.Primary.Transformer.Instruction.Instruction
+ Pandora.Paradigm.Primary.Transformer.Instruction: instance (forall (v :: * -> *). Pandora.Pattern.Functor.Covariant.Covariant v) => Pandora.Pattern.Transformer.Hoistable.Hoistable Pandora.Paradigm.Primary.Transformer.Instruction.Instruction
+ Pandora.Paradigm.Schemes.TU: infixr 3 >:.<
+ Pandora.Paradigm.Schemes.TUT: infix 3 >:>.<:<
+ Pandora.Paradigm.Schemes.T_U: infixr 2 >:.:<
+ Pandora.Paradigm.Schemes.T_U: instance (Pandora.Pattern.Functor.Bivariant.Bivariant p, Pandora.Pattern.Functor.Contravariant.Contravariant t, Pandora.Pattern.Functor.Contravariant.Contravariant u) => Pandora.Pattern.Functor.Contravariant.Contravariant ((t Pandora.Paradigm.Schemes.T_U.>:.:< u) Pandora.Core.Functor.:= p)
+ Pandora.Paradigm.Schemes.T_U: instance (Pandora.Pattern.Functor.Bivariant.Bivariant p, Pandora.Pattern.Functor.Covariant.Covariant t, Pandora.Pattern.Functor.Covariant.Covariant u) => Pandora.Pattern.Functor.Covariant.Covariant ((t Pandora.Paradigm.Schemes.T_U.<:.:> u) Pandora.Core.Functor.:= p)
+ Pandora.Paradigm.Schemes.T_U: instance (Pandora.Pattern.Functor.Divariant.Divariant p, Pandora.Pattern.Functor.Contravariant.Contravariant t, Pandora.Pattern.Functor.Covariant.Covariant u) => Pandora.Pattern.Functor.Covariant.Covariant ((t Pandora.Paradigm.Schemes.T_U.>:.:> u) Pandora.Core.Functor.:= p)
+ Pandora.Paradigm.Schemes.T_U: instance forall k1 k2 k3 k4 (ct :: k1) (cu :: k2) (p :: k3 -> k4 -> *) (t :: * -> k3) (u :: * -> k4). Pandora.Paradigm.Controlflow.Effect.Interpreted.Interpreted (Pandora.Paradigm.Schemes.T_U.T_U ct cu p t u)
+ Pandora.Paradigm.Schemes.UT: infixr 3 >.:<
+ Pandora.Paradigm.Structure.Ability.Morphable: Insert :: a -> Morph a
+ Pandora.Paradigm.Structure.Ability.Morphable: Pop :: a -> Morph a
+ Pandora.Paradigm.Structure.Ability.Morphable: Push :: a -> Morph a
+ Pandora.Paradigm.Structure.Ability.Morphable: collate :: forall f t a. (Chain a, Morphable f t, Morphing f t ~ ((Identity <:.:> t) := (->))) => a :=:=> t
+ Pandora.Paradigm.Structure.Ability.Morphable: insert :: forall f t a. (Morphable (Insert f) t, Morphing (Insert f) t ~ ((Identity <:.:> t) := (->))) => a :=:=> t
+ Pandora.Paradigm.Structure.Ability.Morphable: item :: forall f t a. (Morphable f t, Morphing f t ~ ((Identity <:.:> t) := (->))) => a :=:=> t
+ Pandora.Paradigm.Structure.Ability.Morphable: premorph :: Morphable f t => (Tagged f <:.> t) ~> t
+ Pandora.Paradigm.Structure.Interface.Stack: class (Morphable Push t, Morphable Pop t) => Stack t
+ Pandora.Paradigm.Structure.Some.Binary: instance (forall a1. Pandora.Pattern.Object.Chain.Chain a1) => Pandora.Paradigm.Structure.Ability.Morphable.Morphable 'Pandora.Paradigm.Structure.Ability.Morphable.Insert (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
+ Pandora.Paradigm.Structure.Some.Binary: instance (forall a1. Pandora.Pattern.Object.Chain.Chain a1) => Pandora.Paradigm.Structure.Ability.Morphable.Morphable 'Pandora.Paradigm.Structure.Ability.Morphable.Insert Pandora.Paradigm.Structure.Some.Binary.Binary
+ Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Structure.Some.Binary.Up) ((Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye Pandora.Paradigm.Schemes.T_U.<:.:> (Pandora.Paradigm.Structure.Some.Binary.Bifurcation Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Structure.Some.Binary.Bicursor)) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:))
+ Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate ('Pandora.Paradigm.Structure.Some.Binary.Down 'Pandora.Paradigm.Primary.Functor.Wye.Left)) ((Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye Pandora.Paradigm.Schemes.T_U.<:.:> (Pandora.Paradigm.Structure.Some.Binary.Bifurcation Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Structure.Some.Binary.Bicursor)) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:))
+ Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate ('Pandora.Paradigm.Structure.Some.Binary.Down 'Pandora.Paradigm.Primary.Functor.Wye.Right)) ((Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye Pandora.Paradigm.Schemes.T_U.<:.:> (Pandora.Paradigm.Structure.Some.Binary.Bifurcation Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Structure.Some.Binary.Bicursor)) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:))
+ Pandora.Paradigm.Structure.Some.Binary: type Bicursor = Identity <:.:> Binary := (:*:)
+ Pandora.Paradigm.Structure.Some.Binary: type Bifurcation = Biforked <:.> Construction Biforked
+ Pandora.Paradigm.Structure.Some.List: filter :: forall a. Predicate a -> List a -> List a
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Deletable.Deletable Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable 'Pandora.Paradigm.Structure.Ability.Focusable.Head (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable 'Pandora.Paradigm.Structure.Ability.Focusable.Head Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Measurable.Measurable 'Pandora.Paradigm.Structure.Ability.Measurable.Length (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Measurable.Measurable 'Pandora.Paradigm.Structure.Ability.Measurable.Length Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a ((Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.TU.<:.> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe) Pandora.Core.Functor.:= a)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe a)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable 'Pandora.Paradigm.Structure.Ability.Morphable.Pop Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable 'Pandora.Paradigm.Structure.Ability.Morphable.Push (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable 'Pandora.Paradigm.Structure.Ability.Morphable.Push Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Into Pandora.Paradigm.Structure.Some.List.List) (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Left) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Left) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Structure.Some.List.List Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.List.List) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Right) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Right) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Structure.Some.List.List Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.List.List) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Nullable.Nullable Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Structure.Ability.Substructure.Tail (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Structure.Ability.Substructure.Tail Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Paradigm.Structure.Interface.Stack.Stack Pandora.Paradigm.Structure.Some.List.List
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Pattern.Functor.Extendable.Extendable (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Structure.Some.List.List Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.List.List) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Structure.Some.List.List a)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe a)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Structure.Some.List.List a)
+ Pandora.Paradigm.Structure.Some.List: instance Pandora.Pattern.Object.Setoid.Setoid a => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Structure.Some.List.List a)
+ Pandora.Paradigm.Structure.Some.List: linearize :: forall t a. Traversable t => t a -> List a
+ Pandora.Paradigm.Structure.Some.List: type List = Maybe <:.> Construction Maybe
+ Pandora.Paradigm.Structure.Some.Rose: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable 'Pandora.Paradigm.Structure.Ability.Focusable.Root (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.List.List)
+ Pandora.Paradigm.Structure.Some.Rose: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Maybe.Just (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Some.List.List)
+ Pandora.Paradigm.Structure.Some.Stream: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Left) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Structure.Some.Stream.Stream Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stream.Stream) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.Stream: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Primary.Functor.Wye.Right) (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Structure.Some.Stream.Stream Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stream.Stream) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Paradigm.Structure.Some.Stream: instance Pandora.Pattern.Functor.Extendable.Extendable (Pandora.Paradigm.Primary.Transformer.Tap.Tap ((Pandora.Paradigm.Structure.Some.Stream.Stream Pandora.Paradigm.Schemes.T_U.<:.:> Pandora.Paradigm.Structure.Some.Stream.Stream) Pandora.Core.Functor.:= (Pandora.Paradigm.Primary.Functor.Product.:*:)))
+ Pandora.Pattern.Category: (/) :: Category m => m ~~> m
+ Pandora.Pattern.Category: infixl 1 /
+ Pandora.Pattern.Functor.Traversable: infixl 5 ->>
- Pandora.Paradigm.Controlflow.Pipeline: (=*=) :: forall i e a o t. Pointable t => Pipeline i e t () () -> Pipeline e o t () () -> Pipeline i o t a ()
+ Pandora.Paradigm.Controlflow.Pipeline: (=*=) :: forall i e o t. Pointable t => Pipeline i e t () () -> Pipeline e o t () () -> Pipeline i o t () ()
- Pandora.Paradigm.Controlflow.Pipeline: pipeline :: Pointable t => Pipeline i o t r r -> t r
+ Pandora.Paradigm.Controlflow.Pipeline: pipeline :: Pointable t => Pipeline i o t () () -> t ()
- Pandora.Paradigm.Inventory: (=<>) :: Stateful src t => (src :-. tgt) -> tgt -> t ()
+ Pandora.Paradigm.Inventory: (=<>) :: Stateful src t => (src :-. tgt) -> tgt -> t src
- Pandora.Paradigm.Inventory: (~<>) :: Stateful src t => (src :-. tgt) -> (tgt -> tgt) -> t ()
+ Pandora.Paradigm.Inventory: (~<>) :: Stateful src t => (src :-. tgt) -> (tgt -> tgt) -> t src
- Pandora.Paradigm.Inventory: adjust :: forall bg ls t. (Accessible ls bg, Stateful bg t) => (ls -> ls) -> t ()
+ Pandora.Paradigm.Inventory: adjust :: forall bg ls t. (Accessible ls bg, Stateful bg t) => (ls -> ls) -> t ls
- Pandora.Paradigm.Inventory.State: modify :: Stateful s t => (s -> s) -> t ()
+ Pandora.Paradigm.Inventory.State: modify :: Stateful s t => (s -> s) -> t s
- Pandora.Paradigm.Inventory.State: replace :: Stateful s t => s -> t ()
+ Pandora.Paradigm.Inventory.State: replace :: Stateful s t => s -> t s
- Pandora.Paradigm.Schemes.T_U: T_U :: p (t a) (u a) -> T_U ct cu t p u a
+ Pandora.Paradigm.Schemes.T_U: T_U :: p (t a) (u a) -> T_U ct cu p t u a
- Pandora.Paradigm.Schemes.T_U: newtype T_U ct cu t p u a
+ Pandora.Paradigm.Schemes.T_U: newtype T_U ct cu p t u a
- Pandora.Paradigm.Schemes.T_U: type (>:.:<) p t = T_U Contravariant Contravariant t p t
+ Pandora.Paradigm.Schemes.T_U: type (>:.:<) t u p = T_U Contravariant Contravariant p t u
- Pandora.Paradigm.Structure.Ability.Deletable: (-=) :: (Deletable t, Setoid a) => a -> t a -> t a
+ Pandora.Paradigm.Structure.Ability.Deletable: (-=) :: (Deletable t, Setoid a) => a :=:=> t
- Pandora.Paradigm.Structure.Ability.Morphable: class Morphable f t where {
+ Pandora.Paradigm.Structure.Ability.Morphable: class Morphable f t | f t -> t where {
- Pandora.Paradigm.Structure.Some.Rose: type Rose = Maybe <:.> Construction Stack
+ Pandora.Paradigm.Structure.Some.Rose: type Rose = Maybe <:.> Construction List
Files
- CHANGELOG.md +17/−0
- Pandora/Core/Functor.hs +3/−1
- Pandora/Paradigm/Controlflow/Effect/Interpreted.hs +1/−0
- Pandora/Paradigm/Controlflow/Effect/Transformer/Comonadic.hs +1/−1
- Pandora/Paradigm/Controlflow/Effect/Transformer/Monadic.hs +1/−1
- Pandora/Paradigm/Controlflow/Observable.hs +8/−7
- Pandora/Paradigm/Controlflow/Pipeline.hs +25/−21
- Pandora/Paradigm/Inventory.hs +5/−5
- Pandora/Paradigm/Inventory/Accumulator.hs +3/−3
- Pandora/Paradigm/Inventory/Environment.hs +4/−0
- Pandora/Paradigm/Inventory/Equipment.hs +1/−1
- Pandora/Paradigm/Inventory/Imprint.hs +4/−0
- Pandora/Paradigm/Inventory/State.hs +5/−5
- Pandora/Paradigm/Primary.hs +36/−32
- Pandora/Paradigm/Primary/Functor.hs +1/−7
- Pandora/Paradigm/Primary/Functor/Conclusion.hs +2/−2
- Pandora/Paradigm/Primary/Functor/Constant.hs +2/−1
- Pandora/Paradigm/Primary/Functor/Edges.hs +1/−1
- Pandora/Paradigm/Primary/Functor/Endo.hs +3/−2
- Pandora/Paradigm/Primary/Functor/Equivalence.hs +2/−2
- Pandora/Paradigm/Primary/Functor/Fix.hs +1/−0
- Pandora/Paradigm/Primary/Functor/Function.hs +19/−3
- Pandora/Paradigm/Primary/Functor/Identity.hs +1/−0
- Pandora/Paradigm/Primary/Functor/Maybe.hs +1/−0
- Pandora/Paradigm/Primary/Functor/Predicate.hs +7/−1
- Pandora/Paradigm/Primary/Functor/Product.hs +4/−0
- Pandora/Paradigm/Primary/Functor/Tagged.hs +1/−0
- Pandora/Paradigm/Primary/Functor/These.hs +14/−1
- Pandora/Paradigm/Primary/Functor/Validation.hs +3/−2
- Pandora/Paradigm/Primary/Functor/Wedge.hs +1/−0
- Pandora/Paradigm/Primary/Functor/Wye.hs +4/−4
- Pandora/Paradigm/Primary/Object/Denumerator.hs +1/−2
- Pandora/Paradigm/Primary/Object/Numerator.hs +2/−3
- Pandora/Paradigm/Primary/Transformer/Backwards.hs +3/−3
- Pandora/Paradigm/Primary/Transformer/Construction.hs +9/−8
- Pandora/Paradigm/Primary/Transformer/Continuation.hs +14/−8
- Pandora/Paradigm/Primary/Transformer/Day.hs +8/−8
- Pandora/Paradigm/Primary/Transformer/Instruction.hs +15/−1
- Pandora/Paradigm/Primary/Transformer/Jack.hs +4/−3
- Pandora/Paradigm/Primary/Transformer/Jet.hs +1/−1
- Pandora/Paradigm/Primary/Transformer/Outline.hs +5/−5
- Pandora/Paradigm/Primary/Transformer/Reverse.hs +5/−5
- Pandora/Paradigm/Primary/Transformer/Tap.hs +6/−6
- Pandora/Paradigm/Primary/Transformer/Yoneda.hs +3/−3
- Pandora/Paradigm/Schemes/TU.hs +3/−1
- Pandora/Paradigm/Schemes/TUT.hs +2/−0
- Pandora/Paradigm/Schemes/T_U.hs +17/−13
- Pandora/Paradigm/Schemes/UT.hs +3/−1
- Pandora/Paradigm/Structure.hs +15/−24
- Pandora/Paradigm/Structure/Ability.hs +0/−1
- Pandora/Paradigm/Structure/Ability/Deletable.hs +2/−1
- Pandora/Paradigm/Structure/Ability/Insertable.hs +0/−6
- Pandora/Paradigm/Structure/Ability/Monotonic.hs +2/−1
- Pandora/Paradigm/Structure/Ability/Morphable.hs +22/−4
- Pandora/Paradigm/Structure/Interface.hs +1/−0
- Pandora/Paradigm/Structure/Interface/Set.hs +4/−4
- Pandora/Paradigm/Structure/Interface/Stack.hs +10/−0
- Pandora/Paradigm/Structure/Modification/Comprehension.hs +1/−1
- Pandora/Paradigm/Structure/Modification/Prefixed.hs +1/−1
- Pandora/Paradigm/Structure/Some.hs +1/−1
- Pandora/Paradigm/Structure/Some/Binary.hs +47/−43
- Pandora/Paradigm/Structure/Some/List.hs +162/−0
- Pandora/Paradigm/Structure/Some/Rose.hs +8/−8
- Pandora/Paradigm/Structure/Some/Splay.hs +13/−14
- Pandora/Paradigm/Structure/Some/Stack.hs +0/−156
- Pandora/Paradigm/Structure/Some/Stream.hs +15/−16
- Pandora/Pattern/Category.hs +3/−3
- Pandora/Pattern/Functor/Adjoint.hs +2/−3
- Pandora/Pattern/Functor/Applicative.hs +1/−2
- Pandora/Pattern/Functor/Bindable.hs +1/−2
- Pandora/Pattern/Functor/Bivariant.hs +1/−3
- Pandora/Pattern/Functor/Contravariant.hs +4/−10
- Pandora/Pattern/Functor/Covariant.hs +5/−6
- Pandora/Pattern/Functor/Distributive.hs +4/−5
- Pandora/Pattern/Functor/Divariant.hs +1/−6
- Pandora/Pattern/Functor/Extendable.hs +4/−4
- Pandora/Pattern/Functor/Invariant.hs +1/−3
- Pandora/Pattern/Functor/Traversable.hs +5/−6
- Pandora/Pattern/Object/Setoid.hs +1/−2
- pandora.cabal +3/−3
CHANGELOG.md view
@@ -361,3 +361,20 @@ * Replace two parementers in `>->` method of `Divariant` with usual functions # 0.3.8+* Define `twosome` method to lift two parts to `<:.:> (:*:)` scheme+* Remove `branches` method in favor of `Morphable` instance+* Change order of type arguments in `T_U` scheme+* Define `!!` and `!!!` infix operators+* Define `premorph` to replace `extract . run` expressions for `Morphable` instances+* Define experimental `/` for providing arguments to function+* `modify` and `replaces` methods of `State` effect returns result of an applied function+* Change precedence of `->>` method of `Traversable` - from 3 to 5+* Rename `Stack` datastructure to `List`+* Define new type synonymous: `:=:=>`+* Define experimental `Insert`, `Push`, `Pop` verbs for `Morphable` ability+* Remove `Insertable` ability for datastructures+* Change order of arguments in `<:.:>`, `>:.:>`, `<:.:<`, `>:.:<` type synonyms+* Define fixity and precedence for `TU`, `UT`, `TUT` and `T_U` type synonyms+* Define `Stack` typeclass with no methods but with `Push` and `Pop` constraints++# 0.3.9
Pandora/Core/Functor.hs view
@@ -1,6 +1,6 @@ module Pandora.Core.Functor where -infixr 0 :=, <:=, :=>, ~>+infixr 0 :=, <:=, :=>, :=:=>, ~> infixr 1 .:, :. infixr 2 ::|:., ::|.:, ::|:: @@ -15,6 +15,8 @@ -- | Coalgebra's type operator type (:=>) a t = a -> t a++type (:=:=>) a t = a -> t a -> t a -- | Algebra's type operator type (<:=) a t = t a -> a
Pandora/Paradigm/Controlflow/Effect/Interpreted.hs view
@@ -3,6 +3,7 @@ import Pandora.Pattern.Category ((.)) import Pandora.Pattern.Functor.Covariant (Covariant) import Pandora.Pattern.Transformer.Liftable (Liftable (lift))+import Pandora.Paradigm.Primary.Functor.Function () type family Schematic (c :: (* -> *) -> k) (t :: * -> *) = (r :: (* -> *) -> * -> *) | r -> t
Pandora/Paradigm/Controlflow/Effect/Transformer/Comonadic.hs view
@@ -41,7 +41,7 @@ TC x <+> TC y = TC $ x <+> y instance Traversable (Schematic Comonad t u) => Traversable (t :< u) where- TC x ->> f = TC <$> (x ->> f)+ TC x ->> f = TC <$> x ->> f instance Distributive (Schematic Comonad t u) => Distributive (t :< u) where x >>- f = TC $ x >>- tc . f
Pandora/Paradigm/Controlflow/Effect/Transformer/Monadic.hs view
@@ -45,7 +45,7 @@ empty = TM empty instance Traversable (Schematic Monad t u) => Traversable (t :> u) where- TM x ->> f = TM <$> (x ->> f)+ TM x ->> f = TM <$> x ->> f instance Distributive (Schematic Monad t u) => Distributive (t :> u) where x >>- f = TM $ x >>- tm . f
Pandora/Paradigm/Controlflow/Observable.hs view
@@ -1,9 +1,10 @@ module Pandora.Paradigm.Controlflow.Observable (Observable, observe, notify, follow, subscribe, watch, (.:~.), (.:~*), (*:~.), (*:~*)) where -import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Applicative (Applicative (forever))-import Pandora.Paradigm.Primary.Transformer.Continuation (Continuation (Continuation, continue))+import Pandora.Paradigm.Primary.Transformer.Continuation (Continuation (Continuation))+import Pandora.Paradigm.Controlflow.Effect.Interpreted (run) newtype Capture r t a = Capture { captured :: t r } @@ -11,11 +12,11 @@ -- | Make continuation observable observe :: Continuation r t a -> Observable t a r-observe action = Continuation $ \h -> Capture $ continue action (captured . h)+observe action = Continuation $ \h -> Capture $ run action / captured . h -- | Listen only first event, call back just once notify :: Observable t a r -> (a -> t r) -> t r-notify r action = captured $ continue r (Capture . action)+notify r action = captured $ run r / Capture . action -- | Infix version of 'notify' (.:~.) :: Observable t a r -> (a -> t r) -> t r@@ -23,7 +24,7 @@ -- | Listen only first event, call back forever follow :: Applicative t => Observable t a r -> (a -> t r) -> t r-follow r action = captured $ continue r (Capture . forever . action)+follow r action = captured $ run r / Capture . forever . action -- | Infix version of 'follow' (.:~*) :: Applicative t => Observable t a r -> (a -> t r) -> t r@@ -31,7 +32,7 @@ -- | Listen all events from action, call back just once subscribe :: Applicative t => Observable t a r -> (a -> t r) -> t r-subscribe r action = forever $ captured $ continue r (Capture . action)+subscribe r action = forever $ captured $ run r / Capture . action -- | Infix version of 'subscribe' (*:~.) :: Applicative t => Observable t a r -> (a -> t r) -> t r@@ -39,7 +40,7 @@ -- | Listen all events from action, call back forever watch :: Applicative t => Observable t a r -> (a -> t r) -> t r-watch r action = forever $ captured $ continue r (Capture . forever . action)+watch r action = forever $ captured $ run r / Capture . forever . action -- | Infix version of 'watch' (*:~*) :: Applicative t => Observable t a r -> (a -> t r) -> t r
Pandora/Paradigm/Controlflow/Pipeline.hs view
@@ -1,23 +1,27 @@ module Pandora.Paradigm.Controlflow.Pipeline (Pipeline, await, yield, finish, impact, (=*=), pipeline) where -import Pandora.Pattern.Category (($))-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))-import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<)))+import Pandora.Pattern.Category (($), (.), (/)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))-import Pandora.Paradigm.Primary.Transformer.Continuation (Continuation (Continuation, continue))+import Pandora.Paradigm.Primary.Functor.Function ((!), (!!))+import Pandora.Paradigm.Controlflow.Effect.Interpreted (Interpreted (Primary, run, unite))+import Pandora.Paradigm.Primary.Transformer.Continuation (Continuation (Continuation)) newtype Producer i t r = Producer { produce :: Consumer i t r -> t r } -newtype Consumer o t r = Consumer { consume :: o -> Producer o t r -> t r }+instance Interpreted (Producer i t) where+ type Primary (Producer i t) a = Consumer i t a -> t a+ run ~(Producer f) = f+ unite = Producer -newtype Pipe i o r t a = Pipe { pipe :: Producer i t r -> Consumer o t r -> t r }+newtype Consumer o t r = Consumer { consume :: o -> Producer o t r -> t r } -instance Covariant (Pipe i o r t) where- _ <$> Pipe p = Pipe p+instance Interpreted (Consumer o t) where+ type Primary (Consumer o t) a = o -> Producer o t a -> t a+ run ~(Consumer f) = f+ unite = Consumer -instance Contravariant (Pipe i o r t) where- _ >$< Pipe p = Pipe p+newtype Pipe i o r t a = Pipe { pipe :: Producer i t r -> Consumer o t r -> t r } type Pipeline i o t a r = Continuation r (Pipe i o r t) a @@ -25,37 +29,37 @@ pause next ik = Producer $ \ok -> (pipe $ next ()) ik ok suspend :: (i -> Pipe i o r t a) -> Consumer o t r -> Consumer i t r-suspend next ok = Consumer $ \v ik -> pipe (next v) ik ok+suspend next ok = Consumer $ \v ik -> pipe / next v / ik / ok -- | Take incoming value from pipeline await :: Pipeline i o t i r-await = Continuation $ \next -> Pipe $ \i o -> produce i (suspend next o)+await = Continuation $ \next -> Pipe $ \(Producer i) o -> i / suspend next o -- | Give a value to the future consuming yield :: o -> Pipeline i o t () r-yield v = Continuation $ \next -> Pipe $ \i o -> consume o v (pause next i)+yield v = Continuation $ \next -> Pipe $ \i (Consumer o) -> o v / pause next i -- | Pipeline that does nothing finish :: Pointable t => Pipeline i o t () ()-finish = Continuation $ \_ -> Pipe $ \_ _ -> point ()+finish = Continuation (Pipe (point () !!) !) -- | Do some effectful computation within pipeline impact :: Bindable t => t a -> Pipeline i o t a a impact action = Continuation $ \next -> Pipe $ \i o -> action >>= \x -> pipe (next x) i o -- | Compose two pipelines into one-(=*=) :: forall i e a o t . Pointable t => Pipeline i e t () () -> Pipeline e o t () () -> Pipeline i o t a ()-p =*= q = Continuation $ \_ -> Pipe $ \i o -> pipe (continue q end) (pause (\() -> continue p end) i) o where+(=*=) :: forall i e o t . Pointable t => Pipeline i e t () () -> Pipeline e o t () () -> Pipeline i o t () ()+p =*= q = Continuation $ \_ -> Pipe $ \i -> pipe / run q end / pause (run p end !) i where end :: b -> Pipe c d () t ()- end _ = Pipe $ \_ _ -> point ()+ end _ = Pipe (point () !!) -- | Run pipeline and get result-pipeline :: Pointable t => Pipeline i o t r r -> t r-pipeline p = pipe (continue p (\r -> Pipe $ \_ _ -> point r)) i o where+pipeline :: Pointable t => Pipeline i o t () () -> t ()+pipeline p = pipe / run p (Pipe . (!!) . point) / i / o where - i :: Producer i t r+ i :: Producer i t () i = Producer $ \o' -> produce i o' - o :: Consumer o t r+ o :: Consumer o t () o = Consumer $ \v i' -> consume o v i'
Pandora/Paradigm/Inventory.hs view
@@ -12,7 +12,7 @@ import Pandora.Paradigm.Inventory.Accumulator as Exports import Pandora.Core.Functor (type (~>))-import Pandora.Pattern.Category ((.), ($), identity)+import Pandora.Pattern.Category ((.), ($), (/), identity) import Pandora.Pattern.Functor.Adjoint (Adjoint ((-|), (|-))) import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Pattern.Functor.Bivariant ((<->))@@ -40,14 +40,14 @@ zoom lens less = let restruct f v = f <-> identity $ run less v in adapt . State $ (|- restruct) . run . lens -(=<>) :: Stateful src t => src :-. tgt -> tgt -> t ()+(=<>) :: Stateful src t => src :-. tgt -> tgt -> t src lens =<> new = modify $ set lens new -(~<>) :: Stateful src t => src :-. tgt -> (tgt -> tgt) -> t ()+(~<>) :: Stateful src t => src :-. tgt -> (tgt -> tgt) -> t src lens ~<> f = modify $ over lens f magnify :: forall bg ls t . (Accessible ls bg, Stateful bg t) => t ls-magnify = zoom @bg (access @ls @bg) current+magnify = zoom @bg / access @ls @bg / current -adjust :: forall bg ls t . (Accessible ls bg, Stateful bg t) => (ls -> ls) -> t ()+adjust :: forall bg ls t . (Accessible ls bg, Stateful bg t) => (ls -> ls) -> t ls adjust = zoom @bg (access @ls @bg) . modify
Pandora/Paradigm/Inventory/Accumulator.hs view
@@ -2,7 +2,7 @@ module Pandora.Paradigm.Inventory.Accumulator (Accumulator (..), Accumulated, gather) where -import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))@@ -22,14 +22,14 @@ f <$> Accumulator x = Accumulator $ f <$> x instance Semigroup e => Applicative (Accumulator e) where- f <*> v = Accumulator $ k (run f) (run v) where+ f <*> v = Accumulator $ k / run f / run v where k ~(e :*: g) ~(e' :*: w) = e + e' :*: g w instance Monoid e => Pointable (Accumulator e) where point = Accumulator . (zero :*:) instance Semigroup e => Bindable (Accumulator e) where- Accumulator (e :*: x) >>= f = let (e' :*: b) = run $ f x in+ Accumulator (e :*: x) >>= f = let e' :*: b = run $ f x in Accumulator $ e + e':*: b type instance Schematic Monad (Accumulator e) = (<.:>) ((:*:) e)
Pandora/Paradigm/Inventory/Environment.hs view
@@ -9,6 +9,7 @@ import Pandora.Pattern.Functor.Distributive (Distributive ((>>-))) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Monad (Monad)+import Pandora.Pattern.Functor.Divariant (Divariant ((>->))) import Pandora.Paradigm.Primary.Functor.Function ((!), (%)) import Pandora.Paradigm.Controlflow.Effect.Interpreted (Schematic, Interpreted (Primary, run, unite)) import Pandora.Paradigm.Controlflow.Effect.Transformer.Monadic (Monadic (wrap), (:>) (TM))@@ -33,6 +34,9 @@ Environment x >>= f = Environment $ \e -> run % e . f . x $ e instance Monad (Environment e) where++instance Divariant Environment where+ (>->) ab cd bc = Environment $ ab >-> cd $ run bc instance Interpreted (Environment e) where type Primary (Environment e) a = (->) e a
Pandora/Paradigm/Inventory/Equipment.hs view
@@ -23,7 +23,7 @@ extract = extract . run instance Traversable (Equipment e) where- Equipment x ->> f = Equipment <$> (x ->> f)+ Equipment x ->> f = Equipment <$> x ->> f instance Extendable (Equipment e) where Equipment (e :*: x) =>> f = Equipment . (:*:) e . f . Equipment $ e :*: x
Pandora/Paradigm/Inventory/Imprint.hs view
@@ -8,6 +8,7 @@ import Pandora.Pattern.Functor.Distributive (Distributive ((>>-))) import Pandora.Pattern.Functor.Extendable (Extendable ((=>>))) import Pandora.Pattern.Functor.Comonad (Comonad)+import Pandora.Pattern.Functor.Divariant (Divariant ((>->))) import Pandora.Pattern.Object.Monoid (Monoid (zero)) import Pandora.Pattern.Object.Semigroup (Semigroup ((+))) import Pandora.Paradigm.Primary.Functor.Function ()@@ -26,6 +27,9 @@ instance Monoid e => Extractable (Imprint e) where extract (Imprint x) = x zero++instance Divariant Imprint where+ (>->) ab cd bc = Imprint $ ab >-> cd $ run bc instance Semigroup e => Extendable (Imprint e) where Imprint x =>> f = Imprint $ \e -> f $ Imprint $ x . (e +)
Pandora/Paradigm/Inventory/State.hs view
@@ -52,14 +52,14 @@ current = adapt $ State delta -- | Modify stored value with a function-modify :: Stateful s t => (s -> s) -> t ()-modify f = adapt . State $ (:*: ()) . f+modify :: Stateful s t => (s -> s) -> t s+modify f = adapt . State $ \s -> let r = f s in r :*: r -- | Replace current value with another one-replace :: Stateful s t => s -> t ()-replace s = adapt . State $ \_ -> s :*: ()+replace :: Stateful s t => s -> t s+replace s = adapt . State $ \_ -> s :*: s type Memorable s t = (Pointable t, Applicative t, Stateful s t) fold :: (Traversable t, Memorable s u) => (a -> s -> s) -> t a -> u s-fold op struct = (struct ->> modify . op) *> current+fold op struct = struct ->> modify . op *> current
Pandora/Paradigm/Primary.hs view
@@ -6,68 +6,72 @@ import Pandora.Paradigm.Primary.Functor as Exports import Pandora.Paradigm.Primary.Object as Exports -import Pandora.Pattern.Category ((.), ($))+import Pandora.Core.Functor (type (:=))+import Pandora.Pattern.Category (Category ((.), ($), identity)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<)))-import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Paradigm.Controlflow.Effect.Interpreted (run, (||=)) import Pandora.Paradigm.Schemes.TU (TU (TU), type (<:.>)) import Pandora.Paradigm.Schemes.T_U (type (<:.:>))-import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Into))+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Into), premorph) +instance Category (Flip (->)) where+ identity = Flip identity+ Flip f . Flip g = Flip $ \x -> g (f x)+ instance Contravariant (Flip (->) r) where f >$< g = (<$> f) ||= g instance Morphable (Into Maybe) (Conclusion e) where type Morphing (Into Maybe) (Conclusion e) = Maybe- morphing = conclusion (Nothing !) Just . extract . run+ morphing = conclusion (Nothing !) Just . premorph instance Morphable (Into (Conclusion e)) Maybe where type Morphing (Into (Conclusion e)) Maybe = (->) e <:.> Conclusion e- morphing (extract . run -> Just x) = TU $ \_ -> Success x- morphing (extract . run -> Nothing) = TU $ \e -> Failure e+ morphing (premorph -> Just x) = TU $ \_ -> Success x+ morphing (premorph -> Nothing) = TU $ \e -> Failure e instance Morphable (Into (Left Maybe)) Wye where type Morphing (Into (Left Maybe)) Wye = Maybe- morphing (extract . run -> Both ls _) = Just ls- morphing (extract . run -> Left ls) = Just ls- morphing (extract . run -> Right _) = Nothing- morphing (extract . run -> End) = Nothing+ morphing (premorph -> Both ls _) = Just ls+ morphing (premorph -> Left ls) = Just ls+ morphing (premorph -> Right _) = Nothing+ morphing (premorph -> End) = Nothing instance Morphable (Into (Right Maybe)) Wye where type Morphing (Into (Right Maybe)) Wye = Maybe- morphing (extract . run -> Both _ rs) = Just rs- morphing (extract . run -> Left _) = Nothing- morphing (extract . run -> Right rs) = Just rs- morphing (extract . run -> End) = Nothing+ morphing (premorph -> Both _ rs) = Just rs+ morphing (premorph -> Left _) = Nothing+ morphing (premorph -> Right rs) = Just rs+ morphing (premorph -> End) = Nothing instance Morphable (Into (This Maybe)) (These e) where type Morphing (Into (This Maybe)) (These e) = Maybe- morphing (extract . run -> This x) = Just x- morphing (extract . run -> That _) = Nothing- morphing (extract . run -> These _ x) = Just x+ morphing (premorph -> This x) = Just x+ morphing (premorph -> That _) = Nothing+ morphing (premorph -> These _ x) = Just x instance Morphable (Into (That Maybe)) (Flip These a) where type Morphing (Into (That Maybe)) (Flip These a) = Maybe- morphing (run . extract . run -> This _) = Nothing- morphing (run . extract . run -> That x) = Just x- morphing (run . extract . run -> These y _) = Just y+ morphing (run . premorph -> This _) = Nothing+ morphing (run . premorph -> That x) = Just x+ morphing (run . premorph -> These y _) = Just y instance Morphable (Into (Here Maybe)) (Flip Wedge a) where type Morphing (Into (Here Maybe)) (Flip Wedge a) = Maybe- morphing (run . extract . run -> Nowhere) = Nothing- morphing (run . extract . run -> Here x) = Just x- morphing (run . extract . run -> There _) = Nothing+ morphing (run . premorph -> Nowhere) = Nothing+ morphing (run . premorph -> Here x) = Just x+ morphing (run . premorph -> There _) = Nothing instance Morphable (Into (There Maybe)) (Wedge e) where type Morphing (Into (There Maybe)) (Wedge e) = Maybe- morphing (extract . run -> Nowhere) = Nothing- morphing (extract . run -> Here _) = Nothing- morphing (extract . run -> There x) = Just x+ morphing (premorph -> Nowhere) = Nothing+ morphing (premorph -> Here _) = Nothing+ morphing (premorph -> There x) = Just x -instance Morphable (Into Wye) ((<:.:>) (:*:) Maybe) where- type Morphing (Into Wye) ((<:.:>) (:*:) Maybe) = Wye- morphing (run . extract . run -> Just x :*: Just y) = Both x y- morphing (run . extract . run -> Nothing :*: Just y) = Right y- morphing (run . extract . run -> Just x :*: Nothing) = Left x- morphing (run . extract . run -> Nothing :*: Nothing) = End+instance Morphable (Into Wye) (Maybe <:.:> Maybe := (:*:)) where+ type Morphing (Into Wye) (Maybe <:.:> Maybe := (:*:)) = Wye+ morphing (run . premorph -> Just x :*: Just y) = Both x y+ morphing (run . premorph -> Nothing :*: Just y) = Right y+ morphing (run . premorph -> Just x :*: Nothing) = Left x+ morphing (run . premorph -> Nothing :*: Nothing) = End
Pandora/Paradigm/Primary/Functor.hs view
@@ -1,6 +1,6 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -module Pandora.Paradigm.Primary.Functor (module Exports, branches, match) where+module Pandora.Paradigm.Primary.Functor (module Exports, match) where import Pandora.Paradigm.Primary.Functor.Fix as Exports import Pandora.Paradigm.Primary.Functor.Equivalence as Exports@@ -29,12 +29,6 @@ x -| f = \s -> f $ s :*: x (|-) :: (s :*: a) -> (a -> s -> b) -> b ~(s :*: x) |- f = f x s--branches :: Maybe a -> Maybe a -> Wye a-branches (Just x) (Just y) = Both x y-branches Nothing (Just y) = Right y-branches (Just x) Nothing = Left x-branches Nothing Nothing = End match :: Predicate a -> (a -> r) -> a -> r -> r :*: a match (Predicate p) f x r = p x ? f x :*: x $ r :*: x
Pandora/Paradigm/Primary/Functor/Conclusion.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Primary.Functor.Conclusion where import Pandora.Core.Functor (type (~>))-import Pandora.Pattern.Category (identity, (.), ($))+import Pandora.Pattern.Category (identity, (.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))@@ -48,7 +48,7 @@ instance Monad (Conclusion e) where instance Bivariant Conclusion where- f <-> g = conclusion (Failure . f) (Success . g)+ f <-> g = conclusion / Failure . f / Success . g instance (Setoid e, Setoid a) => Setoid (Conclusion e a) where Success x == Success y = x == y
Pandora/Paradigm/Primary/Functor/Constant.hs view
@@ -16,6 +16,7 @@ import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (invert))+import Pandora.Paradigm.Primary.Functor.Function () newtype Constant a b = Constant a @@ -29,7 +30,7 @@ _ >-< _ = \(Constant x) -> Constant x instance Traversable (Constant a) where- Constant x ->> _ = point (Constant x)+ Constant x ->> _ = point $ Constant x instance Bivariant Constant where f <-> _ = \(Constant x) -> Constant $ f x
Pandora/Paradigm/Primary/Functor/Edges.hs view
@@ -4,7 +4,7 @@ import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))-+import Pandora.Paradigm.Primary.Functor.Function () data Edges a = Empty | Leap a | Connect a | Overlay a
Pandora/Paradigm/Primary/Functor/Endo.hs view
@@ -1,9 +1,10 @@ module Pandora.Paradigm.Primary.Functor.Endo where -import Pandora.Pattern.Category (identity, (.))+import Pandora.Pattern.Category (identity, (.), (/)) import Pandora.Pattern.Functor.Invariant (Invariant ((>-<))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+))) import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Paradigm.Primary.Functor.Function () newtype Endo a = Endo { endo :: a -> a } @@ -11,7 +12,7 @@ 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 zero = Endo identity
Pandora/Paradigm/Primary/Functor/Equivalence.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Functor.Equivalence where -import Pandora.Pattern.Category (($))+import Pandora.Pattern.Category (($), (/)) import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<))) import Pandora.Pattern.Functor.Divisible (Divisible ((>*<))) import Pandora.Pattern.Object.Ringoid (Ringoid ((*)))@@ -10,7 +10,7 @@ data Equivalence a = Equivalence (a -> a -> Boolean) instance Contravariant Equivalence where- f >$< Equivalence g = Equivalence $ \x y -> g (f x) (f y)+ f >$< Equivalence g = Equivalence $ \x y -> g / f x / f y instance Divisible Equivalence where Equivalence g >*< Equivalence h = Equivalence $
Pandora/Paradigm/Primary/Functor/Fix.hs view
@@ -3,6 +3,7 @@ import Pandora.Core.Functor (type (<:=), type (:=>)) import Pandora.Pattern.Category ((.)) import Pandora.Pattern.Functor.Covariant (Covariant (comap))+import Pandora.Paradigm.Primary.Functor.Function () newtype Fix t = Fix { unfix :: t (Fix t) }
Pandora/Paradigm/Primary/Functor/Function.hs view
@@ -2,23 +2,28 @@ module Pandora.Paradigm.Primary.Functor.Function where -import Pandora.Pattern.Category ((.), identity)+import Pandora.Pattern.Category (Category ((.), (/), identity)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>))) import Pandora.Pattern.Functor.Distributive (Distributive ((>>-))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Representable (Representable (Representation, (<#>), tabulate))+import Pandora.Pattern.Functor.Divariant (Divariant ((>->))) infixr 2 ! infixr 9 % infixl 1 & +instance Category (->) where+ identity x = x+ f . g = \x -> f (g x)+ instance Covariant ((->) a) where (<$>) = (.) instance Applicative ((->) e) where- (<*>) f g x = f x (g x)+ (<*>) f g x = f x / g x instance Distributive ((->) e) where g >>- f = \e -> (f % e) <$> g@@ -27,16 +32,27 @@ point = (!) instance Bindable ((->) e) where- f >>= g = \x -> g (f x) x+ f >>= g = \x -> g / f x / x instance Representable ((->) e) where type Representation ((->) e) = e (<#>) = (identity %) tabulate = identity +instance Divariant ((->)) where+ (>->) ab cd bc = cd . bc . ab+ {-# INLINE (!) #-} (!) :: a -> b -> a x ! _ = x++{-# INLINE (!!) #-}+(!!) :: a -> b -> c -> a+(!!) x _ _ = x++{-# INLINE (!!!) #-}+(!!!) :: a -> b -> c -> d -> a+(!!!) x _ _ _ = x {-# INLINE (%) #-} (%) :: (a -> b -> c) -> b -> a -> c
Pandora/Paradigm/Primary/Functor/Identity.hs view
@@ -22,6 +22,7 @@ import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (invert))+import Pandora.Paradigm.Primary.Functor.Function () newtype Identity a = Identity a
Pandora/Paradigm/Primary/Functor/Maybe.hs view
@@ -23,6 +23,7 @@ import Pandora.Paradigm.Controlflow.Effect.Adaptable (Adaptable (adapt)) import Pandora.Paradigm.Schemes.UT (UT (UT), type (<.:>)) import Pandora.Paradigm.Structure.Ability.Monotonic (Monotonic (reduce))+import Pandora.Paradigm.Primary.Functor.Function () data Maybe a = Nothing | Just a
Pandora/Paradigm/Primary/Functor/Predicate.hs view
@@ -12,9 +12,15 @@ import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False), bool, (?)) import Pandora.Paradigm.Primary.Functor.Function ((!)) import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)))+import Pandora.Paradigm.Controlflow.Effect.Interpreted (Interpreted (Primary, run, unite)) newtype Predicate a = Predicate (a -> Boolean) +instance Interpreted Predicate where+ type Primary Predicate a = a -> Boolean+ run ~(Predicate f) = f+ unite = Predicate+ instance Contravariant Predicate where f >$< Predicate g = Predicate $ g . f @@ -28,7 +34,7 @@ equate x = Predicate (== x) satisfy :: (Pointable t, Avoidable t) => Predicate a -> a -> t a-satisfy (Predicate p) x = p x ? point x $ empty+satisfy p x = run p x ? point x $ empty not :: Predicate ~> Predicate not (Predicate p) = Predicate $ bool True False . p
Pandora/Paradigm/Primary/Functor/Product.hs view
@@ -14,6 +14,7 @@ import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (invert))+import Pandora.Paradigm.Schemes.T_U (T_U (T_U), type (<:.:>)) infixr 1 :*: @@ -72,3 +73,6 @@ attached :: a :*: b -> a attached ~(x :*: _) = x++twosome :: t a -> u a -> (<:.:>) t u (:*:) a+twosome x y = T_U (x :*: y)
Pandora/Paradigm/Primary/Functor/Tagged.hs view
@@ -22,6 +22,7 @@ import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice) import Pandora.Pattern.Object.Group (Group (invert))+import Pandora.Paradigm.Primary.Functor.Function () newtype Tagged tag a = Tag a
Pandora/Paradigm/Primary/Functor/These.hs view
@@ -1,9 +1,11 @@ module Pandora.Paradigm.Primary.Functor.These where -import Pandora.Pattern.Category (($))+import Pandora.Pattern.Category (($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Paradigm.Primary.Functor.Function () data These e a = This a | That e | These e a @@ -19,6 +21,17 @@ This x ->> f = This <$> f x That y ->> _ = point $ That y These y x ->> f = These y <$> f x++instance (Semigroup e, Semigroup a) => Semigroup (These e a) where+ This x + This x' = This / x + x'+ This x + That y = These y x+ This x + These y x' = These y / x + x'+ That y + This x' = These y x'+ That y + That y' = That / y + y'+ That y + These y' x = These / y + y' / x+ These y x + This x' = These y / x + x'+ These y x + That y' = These / y + y' / x+ These y x + These y' x' = These / y + y' / x + x' these :: (a -> r) -> (e -> r) -> (e -> a -> r) -> These e a -> r these f _ _ (This x) = f x
Pandora/Paradigm/Primary/Functor/Validation.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Functor.Validation where -import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))@@ -10,6 +10,7 @@ import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Paradigm.Primary.Functor.Function () import Pandora.Paradigm.Primary.Object.Boolean (Boolean (False)) import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Greater)) @@ -37,7 +38,7 @@ Flaws e ->> _ = point $ Flaws e instance Bivariant Validation where- f <-> g = validation (Flaws . f) (Validated . g)+ f <-> g = validation / Flaws . f / Validated . g instance (Setoid e, Setoid a) => Setoid (Validation e a) where Validated x == Validated y = x == y
Pandora/Paradigm/Primary/Functor/Wedge.hs view
@@ -4,6 +4,7 @@ import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Paradigm.Primary.Functor.Function () data Wedge e a = Nowhere | Here e | There a
Pandora/Paradigm/Primary/Functor/Wye.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Primary.Functor.Wye where import Pandora.Core.Functor (type (~>))-import Pandora.Pattern.Category (($))+import Pandora.Pattern.Category ((/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))@@ -12,9 +12,9 @@ instance Covariant Wye where _ <$> End = End- f <$> Left x = Left $ f x- f <$> Right y = Right $ f y- f <$> Both x y = Both (f x) (f y)+ 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 ->> _ = point End
Pandora/Paradigm/Primary/Object/Denumerator.hs view
@@ -1,6 +1,5 @@ module Pandora.Paradigm.Primary.Object.Denumerator where -import Pandora.Pattern.Category (($)) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))@@ -23,7 +22,7 @@ instance Semigroup Denumerator where One + m = Denumerator m- Denumerator n + m = Denumerator $ n + m+ Denumerator n + m = Denumerator (n + m) instance Ringoid Denumerator where One * n = n
Pandora/Paradigm/Primary/Object/Numerator.hs view
@@ -1,6 +1,5 @@ module Pandora.Paradigm.Primary.Object.Numerator where -import Pandora.Pattern.Category (($)) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))@@ -27,12 +26,12 @@ instance Semigroup Numerator where Zero + m = m Numerator n + Zero = Numerator n- Numerator n + Numerator m = Numerator $ n + m+ Numerator n + Numerator m = Numerator (n + m) instance Ringoid Numerator where Zero * _ = Zero Numerator _ * Zero = Zero- Numerator n * Numerator m = Numerator $ m + n * m+ Numerator n * Numerator m = Numerator (m + n * m) instance Monoid Numerator where zero = Zero
Pandora/Paradigm/Primary/Transformer/Backwards.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Transformer.Backwards where -import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<))) import Pandora.Pattern.Functor.Extractable (Extractable (extract))@@ -26,10 +26,10 @@ extract (Backwards x) = extract x instance Applicative t => Applicative (Backwards t) where- Backwards f <*> Backwards x = Backwards ((&) <$> x <*> f)+ Backwards f <*> Backwards x = Backwards / (&) <$> x <*> f instance Traversable t => Traversable (Backwards t) where- Backwards x ->> f = Backwards <$> (x ->> f)+ Backwards x ->> f = Backwards <$> x ->> f instance Distributive t => Distributive (Backwards t) where x >>- f = Backwards $ x >>- run . f
Pandora/Paradigm/Primary/Transformer/Construction.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Primary.Transformer.Construction where import Pandora.Core.Functor (type (:.), type (:=), type (:=>), type (~>))-import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>))) import Pandora.Pattern.Functor.Avoidable (Avoidable (empty)) import Pandora.Pattern.Functor.Pointable (Pointable (point))@@ -19,13 +19,14 @@ import Pandora.Pattern.Object.Semigroup (Semigroup ((+))) import Pandora.Pattern.Object.Ringoid ((*)) import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Paradigm.Primary.Functor.Function () infixr 7 .-+ data Construction t a = Construct a (t :. Construction t := a) instance Covariant t => Covariant (Construction t) where- f <$> x = Construct (f $ extract x) $ f <$$> deconstruct x+ f <$> x = Construct / f (extract x) / f <$$> deconstruct x instance Avoidable t => Pointable (Construction t) where point x = Construct x empty@@ -34,18 +35,18 @@ extract ~(Construct x _) = x instance Applicative t => Applicative (Construction t) where- f <*> x = Construct (extract f $ extract x)+ f <*> x = Construct / extract f (extract x) $ deconstruct f <**> deconstruct x instance Traversable t => Traversable (Construction t) where- x ->> f = Construct <$> f (extract x) <*> (deconstruct x ->>> f)+ x ->> f = Construct <$> f (extract x) <*> deconstruct x ->>> f instance Alternative t => Bindable (Construction t) where x >>= f = Construct (extract . f $ extract x) $ (deconstruct . f $ extract x) <+> (>>= f) <$> deconstruct x instance Covariant t => Extendable (Construction t) where- x =>> f = Construct (f x) $ extend f <$> deconstruct x+ x =>> f = Construct / f x / extend f <$> deconstruct x instance (Avoidable t, Alternative t) => Monad (Construction t) where @@ -55,13 +56,13 @@ lower x = extract <$> deconstruct x instance Hoistable Construction where- hoist f x = Construct (extract x) . f $ hoist f <$> deconstruct x+ hoist f x = Construct / extract x $ f / hoist f <$> deconstruct x instance (Setoid a, forall b . Setoid b => Setoid (t b), Covariant t) => Setoid (Construction t a) where x == y = (extract x == extract y) * (deconstruct x == deconstruct y) instance (Semigroup a, forall b . Semigroup b => Semigroup (t b), Covariant t) => Semigroup (Construction t a) where- x + y = Construct (extract x + extract y) $ deconstruct x + deconstruct y+ x + y = Construct / extract x + extract y / deconstruct x + deconstruct y instance (Monoid a, forall b . Semigroup b => Monoid (t b), Covariant t) => Monoid (Construction t a) where zero = Construct zero zero@@ -74,4 +75,4 @@ f .-+ x = Construct x $ (f .-+) <$> f x section :: Comonad t => t ~> Construction t-section xs = Construct (extract xs) $ xs =>> section+section xs = Construct / extract xs / (xs =>> section)
Pandora/Paradigm/Primary/Transformer/Continuation.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Primary.Transformer.Continuation where import Pandora.Core.Functor (type (:.), type (:=), type (::|:.))-import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))@@ -9,10 +9,16 @@ import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Transformer.Liftable (Liftable (lift))+import Pandora.Paradigm.Controlflow.Effect.Interpreted (Interpreted (Primary, run, unite)) import Pandora.Paradigm.Primary.Functor.Function ((!), (%)) -newtype Continuation r t a = Continuation { continue :: (->) ::|:. a :. t := r }+newtype Continuation r t a = Continuation ((->) ::|:. a :. t := r) +instance Interpreted (Continuation r t) where+ type Primary (Continuation r t) a = (->) ::|:. a :. t := r+ run ~(Continuation x) = x+ unite = Continuation+ instance Covariant t => Covariant (Continuation r t) where f <$> Continuation continuation = Continuation $ continuation . (. f) @@ -20,10 +26,10 @@ point x = Continuation ($ x) instance Covariant t => Applicative (Continuation r t) where- f <*> x = Continuation $ \h -> continue f $ \g -> continue x (h . g)+ f <*> x = Continuation $ \h -> run f $ \g -> run x / h . g instance Covariant t => Bindable (Continuation r t) where- x >>= f = Continuation $ \g -> continue x $ \y -> continue (f y) g+ x >>= f = Continuation $ \g -> run x $ \y -> run / f y / g instance Monad t => Monad (Continuation r t) where @@ -32,15 +38,15 @@ -- | Call with current continuation cwcc :: ((a -> Continuation r t b) -> Continuation r t a) -> Continuation r t a-cwcc f = Continuation $ \g -> continue % g . f $ Continuation . (!) . g+cwcc f = Continuation $ \g -> run % g . f $ Continuation . (!) . g -- | Delimit the continuation of any 'shift' reset :: (forall u . Bindable u, Monad t, Traversable t) => Continuation r t r -> Continuation s t r-reset = lift . continue % point+reset = lift . run % point -- | Capture the continuation up to the nearest enclosing 'reset' and pass it shift :: Pointable t => ((a -> t r) -> Continuation r t r) -> Continuation r t a-shift f = Continuation $ continue % point . f+shift f = Continuation $ run % point . f interruptable :: Pointable t => ((a -> Continuation a t a) -> Continuation a t a) -> t a-interruptable = continue % point . cwcc+interruptable = run % point . cwcc
Pandora/Paradigm/Primary/Transformer/Day.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Primary.Transformer.Day where import Pandora.Pattern ((.|..))-import Pandora.Pattern.Category (($))+import Pandora.Pattern.Category (($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Extractable (Extractable (extract))@@ -9,29 +9,29 @@ import Pandora.Pattern.Functor.Extendable (Extendable ((=>>))) import Pandora.Pattern.Transformer.Lowerable (Lowerable (lower)) import Pandora.Pattern.Transformer.Hoistable (Hoistable (hoist))-import Pandora.Paradigm.Primary.Functor.Function ()+import Pandora.Paradigm.Primary.Functor.Function ((!!)) import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:))) data Day t u a = forall b c . Day (t b) (u c) (b -> c -> a) instance Covariant (Day t u) where- f <$> Day tb uc g = Day tb uc (f .|.. g)+ f <$> Day tb uc g = Day tb uc / f .|.. g instance (Pointable t, Pointable u) => Pointable (Day t u) where- point x = Day (point ()) (point ()) $ \_ _ -> x+ point x = Day / point () / point () / (x !!) instance (Applicative t, Applicative u) => Applicative (Day t u) where- Day tb uc bcad <*> Day vb wc bca = Day ((:*:) <$> tb <*> vb) ((:*:) <$> uc <*> wc)+ Day tb uc bcad <*> Day vb wc bca = Day / (:*:) <$> tb <*> vb / (:*:) <$> uc <*> wc $ \(b :*: b') (c :*: c') -> bcad b c $ bca b' c' instance (Extractable t, Extractable u) => Extractable (Day t u) where- extract (Day tb uc bcad) = bcad (extract tb) (extract uc)+ extract (Day tb uc bcad) = bcad / extract tb / extract uc instance (Extendable t, Extendable u) => Extendable (Day t u) where- day@(Day tb uc _) =>> f = Day tb uc (\_ _ -> f day)+ day@(Day tb uc _) =>> f = Day tb uc (f day !!) instance Extractable t => Lowerable (Day t) where lower (Day tb uc bca) = bca (extract tb) <$> uc instance Hoistable (Day t) where- hoist g (Day tb uc bca) = Day tb (g uc) bca+ hoist g (Day tb uc bca) = Day tb / g uc / bca
Pandora/Paradigm/Primary/Transformer/Instruction.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE UndecidableInstances #-}+ module Pandora.Paradigm.Primary.Transformer.Instruction where import Pandora.Core.Functor (type (:.), type (:=))@@ -9,7 +11,11 @@ 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.Transformer.Liftable (Liftable (lift))+import Pandora.Pattern.Transformer.Lowerable (Lowerable (lower))+import Pandora.Pattern.Transformer.Hoistable (Hoistable (hoist))+import Pandora.Paradigm.Primary.Functor.Function () data Instruction t a = Enter a | Instruct (t :. Instruction t := a) @@ -39,7 +45,15 @@ instance Traversable t => Traversable (Instruction t) where Enter x ->> f = Enter <$> f x- Instruct xs ->> f = Instruct <$> (xs ->>> f)+ Instruct xs ->> f = Instruct <$> xs ->>> f instance Liftable Instruction where lift x = Instruct $ Enter <$> x++instance (forall t . Monad t) => Lowerable Instruction where+ lower (Enter x) = point x+ lower (Instruct xs) = xs >>= lower++instance (forall v . Covariant v) => Hoistable Instruction where+ hoist _ (Enter x) = Enter x+ hoist f (Instruct xs) = Instruct $ hoist f <$> f xs
Pandora/Paradigm/Primary/Transformer/Jack.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Transformer.Jack where -import Pandora.Pattern.Category (identity, (.), ($))+import Pandora.Pattern.Category (identity, (.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Extractable (Extractable (extract))@@ -15,6 +15,7 @@ import Pandora.Pattern.Transformer.Hoistable (Hoistable (hoist)) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Chain (Chain ((<=>)))+import Pandora.Paradigm.Primary.Functor.Function () import Pandora.Paradigm.Primary.Object.Boolean (Boolean (False)) import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Greater)) @@ -30,7 +31,7 @@ instance Alternative t => Alternative (Jack t) where It x <+> _ = It x Other _ <+> It y = It y- Other x <+> Other y = Other (x <+> y)+ Other x <+> Other y = Other / x <+> y instance Avoidable t => Avoidable (Jack t) where empty = Other empty@@ -47,7 +48,7 @@ instance Traversable t => Traversable (Jack t) where It x ->> f = It <$> f x- Other y ->> f = Other <$> (y ->> f)+ Other y ->> f = Other <$> y ->> f instance Distributive t => Distributive (Jack t) where x >>- f = distribute $ f <$> x
Pandora/Paradigm/Primary/Transformer/Jet.hs view
@@ -13,7 +13,7 @@ f <$> Jet x xs = Jet (f x) (f <$$> xs) instance Traversable t => Traversable (Jet t) where- Jet x xs ->> f = Jet <$> f x <*> (xs ->>> f)+ Jet x xs ->> f = Jet <$> f x <*> xs ->>> f instance (forall u . Avoidable u) => Pointable (Jet t) where point x = Jet x empty
Pandora/Paradigm/Primary/Transformer/Outline.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Transformer.Outline where -import Pandora.Pattern.Category (identity, (.), ($))+import Pandora.Pattern.Category (identity, (.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Extractable (Extractable (extract))@@ -16,25 +16,25 @@ instance Covariant (Outline t) where f <$> Line a = Line $ f a- f <$> Outlined x y = Outlined x ((.) f <$> y)+ f <$> Outlined x y = Outlined x / (.) f <$> y instance Pointable (Outline t) where point = Line instance Extractable t => Extractable (Outline t) where extract (Line x) = x- extract (Outlined x y) = extract y $ extract x+ extract (Outlined x y) = extract y / extract x instance Applicative (Outline f) where Line f <*> y = f <$> y- Outlined x y <*> z = Outlined x ((%) <$> y <*> z)+ Outlined x y <*> z = Outlined x / (%) <$> y <*> z instance Liftable Outline where lift t = Outlined t (Line identity) instance Hoistable Outline where hoist _ (Line x) = Line x- hoist f (Outlined x y) = Outlined (f x) (hoist f y)+ hoist f (Outlined x y) = Outlined / f x / hoist f y instance (Extractable t, Pointable t, Applicative t) => Interpreted (Outline t) where type Primary (Outline t) a = t a
Pandora/Paradigm/Primary/Transformer/Reverse.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Transformer.Reverse where -import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<))) import Pandora.Pattern.Functor.Extractable (Extractable (extract))@@ -17,7 +17,7 @@ newtype Reverse t a = Reverse (t a) instance Covariant t => Covariant (Reverse t) where- f <$> Reverse x = Reverse $ f <$> x+ f <$> Reverse x = Reverse / f <$> x instance Pointable t => Pointable (Reverse t) where point = Reverse . point@@ -26,7 +26,7 @@ extract (Reverse x) = extract x instance Applicative t => Applicative (Reverse t) where- Reverse f <*> Reverse x = Reverse (f <*> x)+ Reverse f <*> Reverse x = Reverse / f <*> x instance Traversable t => Traversable (Reverse t) where Reverse x ->> f = Reverse <$> run (x ->> Backwards . f)@@ -35,7 +35,7 @@ x >>- f = Reverse $ x >>- run . f instance Contravariant t => Contravariant (Reverse t) where- f >$< Reverse x = Reverse $ f >$< x+ f >$< Reverse x = Reverse / f >$< x instance Interpreted (Reverse t) where type Primary (Reverse t) a = t a@@ -49,4 +49,4 @@ lower = run instance Hoistable Reverse where- hoist f (Reverse x) = Reverse $ f x+ hoist f (Reverse x) = Reverse / f x
Pandora/Paradigm/Primary/Transformer/Tap.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Transformer.Tap where -import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Avoidable (Avoidable (empty)) import Pandora.Pattern.Functor.Pointable (Pointable (point))@@ -17,7 +17,7 @@ data Tap t a = Tap a (t a) instance Covariant t => Covariant (Tap t) where- f <$> Tap x xs = Tap (f x) $ f <$> xs+ f <$> Tap x xs = Tap / f x / f <$> xs instance Avoidable t => Pointable (Tap t) where point = Tap % empty@@ -26,19 +26,19 @@ extract (Tap x _) = x instance Applicative t => Applicative (Tap t) where- Tap f fs <*> Tap x xs = Tap (f x) $ fs <*> xs+ Tap f fs <*> Tap x xs = Tap / f x / fs <*> xs instance Traversable t => Traversable (Tap t) where- Tap x xs ->> f = Tap <$> f x <*> (xs ->> f)+ Tap x xs ->> f = Tap <$> f x <*> xs ->> f instance (Extractable t, Alternative t, Bindable t) => Bindable (Tap t) where Tap x xs >>= f = case f x of ~(Tap y ys) -> Tap y $ ys <+> (xs >>= lower . f) instance Extendable t => Extendable (Tap t) where- x =>> f = Tap (f x) $ lower x =>> f . Tap (extract x)+ x =>> f = Tap / f x $ lower x =>> f . Tap (extract x) instance Lowerable Tap where lower (Tap _ xs) = xs instance Hoistable Tap where- hoist f (Tap x xs) = Tap x $ f xs+ hoist f (Tap x xs) = Tap x / f xs
Pandora/Paradigm/Primary/Transformer/Yoneda.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Transformer.Yoneda where -import Pandora.Pattern.Category (identity, (.), ($))+import Pandora.Pattern.Category (identity, (.), ($), (/)) import Pandora.Pattern.Functor ((<*+>)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))@@ -37,5 +37,5 @@ lift x = Yoneda (<$> x) instance (Extractable t, Pointable t, Extractable u, Pointable u) => Adjoint (Yoneda t) (Yoneda u) where- x -| f = point . f . point $ x- x |- g = extract . extract $ g <$> x+ x -| f = point . f . point / x+ x |- g = extract . extract / g <$> x
Pandora/Paradigm/Schemes/TU.hs view
@@ -19,6 +19,8 @@ newtype TU ct cu t u a = TU (t :. u := a) +infixr 3 <:.>, >:.>, <:.<, >:.<+ type (<:.>) = TU Covariant Covariant type (>:.>) = TU Contravariant Covariant type (<:.<) = TU Covariant Contravariant@@ -48,7 +50,7 @@ extract = extract . extract . run instance (Traversable t, Traversable u) => Traversable (t <:.> u) where- x ->> f = TU <$> (run x ->>> f)+ x ->> f = TU <$> run x ->>> f instance (Bindable t, Distributive t, Bindable u) => Bindable (t <:.> u) where TU x >>= f = TU $ x >>= \i -> join <$> i >>- run . f
Pandora/Paradigm/Schemes/TUT.hs view
@@ -20,6 +20,8 @@ newtype TUT ct ct' cu t t' u a = TUT (t :. u :. t' := a) +infix 3 <:<.>:>, >:<.>:>, <:<.>:<, >:<.>:<, <:>.<:>, >:>.<:>, <:>.<:<, >:>.<:<+ type (<:<.>:>) = TUT Covariant Covariant Covariant type (>:<.>:>) = TUT Contravariant Covariant Covariant type (<:<.>:<) = TUT Covariant Covariant Contravariant
Pandora/Paradigm/Schemes/T_U.hs view
@@ -1,27 +1,31 @@ module Pandora.Paradigm.Schemes.T_U where +import Pandora.Core.Functor (type (:=)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<))) import Pandora.Pattern.Functor.Bivariant (Bivariant ((<->))) import Pandora.Pattern.Functor.Divariant (Divariant ((>->))) import Pandora.Paradigm.Controlflow.Effect.Interpreted (Interpreted (Primary, run, unite, (||=))) -newtype T_U ct cu t p u a = T_U (p (t a) (u a))+newtype T_U ct cu p t u a = T_U (p (t a) (u a)) -type (<:.:>) p t = T_U Covariant Covariant t p t-type (>:.:>) p t = T_U Contravariant Covariant t p t-type (<:.:<) p t = T_U Covariant Contravariant t p t-type (>:.:<) p t = T_U Contravariant Contravariant t p t+infixr 2 <:.:>, >:.:>, <:.:<, >:.:< -instance Interpreted (T_U ct cu t p u) where- type Primary (T_U ct cu t p u) a = p (t a) (u a)+type (<:.:>) t u p = T_U Covariant Covariant p t u+type (>:.:>) t u p = T_U Contravariant Covariant p t u+type (<:.:<) t u p = T_U Covariant Contravariant p t u+type (>:.:<) t u p = T_U Contravariant Contravariant p t u++instance Interpreted (T_U ct cu p t u) where+ type Primary (T_U ct cu p t u) a = p (t a) (u a) run ~(T_U x) = x unite = T_U -instance (Bivariant p, Covariant t, Covariant u)- => Covariant (T_U Covariant Covariant t p u) where- f <$> x = ((f <$>) <-> (f <$>)) ||= x+instance (Bivariant p, Covariant t, Covariant u) => Covariant (t <:.:> u := p) where+ f <$> x = ((f <$>) <-> (f <$>)) ||= x -instance (Divariant p, Contravariant t, Covariant u)- => Covariant (T_U Contravariant Covariant t p u) where- f <$> x = ((f >$<) >-> (f <$>)) ||= x+instance (Divariant p, Contravariant t, Covariant u) => Covariant (t >:.:> u := p) where+ f <$> x = ((f >$<) >-> (f <$>)) ||= x++instance (Bivariant p, Contravariant t, Contravariant u) => Contravariant (t >:.:< u := p) where+ f >$< x = ((f >$<) <-> (f >$<)) ||= x
Pandora/Paradigm/Schemes/UT.hs view
@@ -16,6 +16,8 @@ newtype UT ct cu t u a = UT (u :. t := a) +infixr 3 <.:>, >.:>, <.:<, >.:<+ type (<.:>) = UT Covariant Covariant type (>.:>) = UT Contravariant Covariant type (<.:<) = UT Covariant Contravariant@@ -36,7 +38,7 @@ point = UT . point . point instance (Traversable t, Bindable t, Applicative u, Monad u) => Bindable (t <.:> u) where- UT x >>= f = UT $ x >>= \i -> join <$> (i ->> run . f)+ UT x >>= f = UT $ x >>= \i -> join <$> i ->> run . f instance (Extractable t, Extractable u) => Extractable (t <.:> u) where extract = extract . extract . run
Pandora/Paradigm/Structure.hs view
@@ -7,7 +7,7 @@ import Pandora.Paradigm.Structure.Modification as Exports import Pandora.Paradigm.Structure.Some as Exports -import Pandora.Pattern.Category (($), (.))+import Pandora.Pattern.Category (($), (.), (/)) import Pandora.Pattern.Functor.Covariant (Covariant (comap)) import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Pattern.Functor.Pointable (point)@@ -28,7 +28,7 @@ import Pandora.Paradigm.Schemes.TU (type (<:.>)) instance Monotonic s a => Monotonic s (s :*: a) where- reduce f r x = reduce f (f (attached x) r) $ extract x+ reduce f r x = reduce f / f (attached x) r / extract x instance Nullable Maybe where null = Predicate $ \case { Just _ -> True ; _ -> False }@@ -45,37 +45,28 @@ instance Morphable (Into (Preorder (Construction Maybe))) (Construction Wye) where type Morphing (Into (Preorder (Construction Maybe))) (Construction Wye) = Construction Maybe- morphing (extract . run -> Construct x End) = Construct x Nothing- morphing (extract . run -> Construct x (Left lst)) = Construct x . Just $ into @(Preorder (Nonempty Stack)) lst- morphing (extract . run -> Construct x (Right rst)) = Construct x . Just $ into @(Preorder (Nonempty Stack)) rst- morphing (extract . run -> Construct x (Both lst rst)) = Construct x . Just $ into @(Preorder (Nonempty Stack)) lst + into @(Preorder (Nonempty Stack)) rst+ morphing (premorph -> Construct x End) = Construct x Nothing+ morphing (premorph -> Construct x (Left lst)) = Construct x . Just $ into @(Preorder (Nonempty List)) lst+ morphing (premorph -> Construct x (Right rst)) = Construct x . Just $ into @(Preorder (Nonempty List)) rst+ morphing (premorph -> Construct x (Both lst rst)) = Construct x . Just $ into @(Preorder (Nonempty List)) lst + into @(Preorder (Nonempty List)) rst instance Morphable (Into (Inorder (Construction Maybe))) (Construction Wye) where type Morphing (Into (Inorder (Construction Maybe))) (Construction Wye) = Construction Maybe- morphing (extract . run -> Construct x End) = point x- morphing (extract . run -> Construct x (Left lst)) = into @(Inorder (Nonempty Stack)) lst + point x- morphing (extract . run -> Construct x (Right rst)) = point x + into @(Inorder (Nonempty Stack)) rst- morphing (extract . run -> Construct x (Both lst rst)) = into @(Inorder (Nonempty Stack)) lst + point x + into @(Inorder (Nonempty Stack)) rst+ morphing (premorph -> Construct x End) = point x+ morphing (premorph -> Construct x (Left lst)) = into @(Inorder (Nonempty List)) lst + point x+ morphing (premorph -> Construct x (Right rst)) = point x + into @(Inorder (Nonempty List)) rst+ morphing (premorph -> Construct x (Both lst rst)) = into @(Inorder (Nonempty List)) lst + point x + into @(Inorder (Nonempty List)) rst instance Morphable (Into (Postorder (Construction Maybe))) (Construction Wye) where type Morphing (Into (Postorder (Construction Maybe))) (Construction Wye) = Construction Maybe- morphing (extract . run -> Construct x End) = point x- morphing (extract . run -> Construct x (Left lst)) = into @(Postorder (Nonempty Stack)) lst + point x- morphing (extract . run -> Construct x (Right rst)) = into @(Postorder (Nonempty Stack)) rst + point x- morphing (extract . run -> Construct x (Both lst rst)) = into @(Postorder (Nonempty Stack)) lst + into @(Postorder (Nonempty Stack)) rst + point x---- instance Morphable (Into (Levelorder (Construction Maybe))) (Construction Wye) where--- type Morphing (Into (Levelorder (Construction Maybe))) (Construction Wye) = Construction Maybe--- morphing (extract . run -> Construct x End) = point x--- morphing (extract . run -> Construct x (Left lst)) = point x + into @(Levelorder (Nonempty Stack)) lst--- morphing (extract . run -> Construct x (Right rst)) = point x + into @(Levelorder (Nonempty Stack)) lst--- morphing (extract . run -> Construct x (Both lst rst)) = point x + extract lst + extract rst +-- -- (deconstruct lst :: )+ morphing (premorph -> Construct x End) = point x+ morphing (premorph -> Construct x (Left lst)) = into @(Postorder (Nonempty List)) lst + point x+ morphing (premorph -> Construct x (Right rst)) = into @(Postorder (Nonempty List)) rst + point x+ morphing (premorph -> Construct x (Both lst rst)) = into @(Postorder (Nonempty List)) lst + into @(Postorder (Nonempty List)) rst + point x instance Morphable (Into (o ds)) (Construction Wye) => Morphable (Into (o ds)) Binary where type Morphing (Into (o ds)) Binary = Maybe <:.> Morphing (Into (o ds)) (Construction Wye)- morphing = unite . comap (into @(o ds)) . run . extract . run+ morphing = unite . comap (into @(o ds)) . run . premorph instance Focusable Left (Product s) where type Focusing Left (Product s) a = s
Pandora/Paradigm/Structure/Ability.hs view
@@ -3,7 +3,6 @@ import Pandora.Paradigm.Structure.Ability.Monotonic as Exports import Pandora.Paradigm.Structure.Ability.Zipper as Exports import Pandora.Paradigm.Structure.Ability.Substructure as Exports-import Pandora.Paradigm.Structure.Ability.Insertable as Exports import Pandora.Paradigm.Structure.Ability.Measurable as Exports import Pandora.Paradigm.Structure.Ability.Focusable as Exports import Pandora.Paradigm.Structure.Ability.Deletable as Exports
Pandora/Paradigm/Structure/Ability/Deletable.hs view
@@ -1,8 +1,9 @@ module Pandora.Paradigm.Structure.Ability.Deletable where +import Pandora.Core.Functor (type (:=:=>)) import Pandora.Pattern.Object.Setoid (Setoid) infixr 3 -= class Deletable t where- (-=) :: Setoid a => a -> t a -> t a+ (-=) :: Setoid a => a :=:=> t
− Pandora/Paradigm/Structure/Ability/Insertable.hs
@@ -1,6 +0,0 @@-module Pandora.Paradigm.Structure.Ability.Insertable where--infixr 2 +=--class Insertable t where- (+=) :: a -> t a -> t a
Pandora/Paradigm/Structure/Ability/Monotonic.hs view
@@ -1,6 +1,7 @@ module Pandora.Paradigm.Structure.Ability.Monotonic where import Pandora.Pattern ((.|..))+import Pandora.Pattern.Category ((/)) import Pandora.Pattern.Functor ((<+>)) import Pandora.Pattern.Functor.Pointable (Pointable) import Pandora.Pattern.Functor.Avoidable (Avoidable (empty))@@ -13,7 +14,7 @@ -- | Version of `reduce` which ignores accumulator resolve :: (a -> r) -> r -> e -> r- resolve g = reduce (g .|.. (!))+ resolve g = reduce / g .|.. (!) instance Monotonic a a where reduce f r x = f x r
Pandora/Paradigm/Structure/Ability/Morphable.hs view
@@ -2,24 +2,42 @@ module Pandora.Paradigm.Structure.Ability.Morphable where -import Pandora.Core.Functor (type (~>))-import Pandora.Pattern.Category ((.))+import Pandora.Core.Functor (type (:=), type (~>), type (:=:=>))+import Pandora.Pattern.Category ((.), (/))+import Pandora.Pattern.Functor.Extractable (extract)+import Pandora.Pattern.Object.Chain (Chain)+import Pandora.Paradigm.Primary.Functor.Identity (Identity (Identity)) import Pandora.Paradigm.Primary.Functor.Tagged (Tagged (Tag))+import Pandora.Paradigm.Controlflow.Effect.Interpreted (run) import Pandora.Paradigm.Schemes.TU (TU (TU), type (<:.>))+import Pandora.Paradigm.Schemes.T_U (type (<:.:>)) -class Morphable f t where+class Morphable f t | f t -> t where type Morphing (f :: k) (t :: * -> *) :: * -> * morphing :: Tagged f <:.> t ~> Morphing f t morph :: forall f t . Morphable f t => t ~> Morphing f t morph = morphing . TU . Tag @f +premorph :: Morphable f t => Tagged f <:.> t ~> t+premorph = extract . run+ data Walk a = Preorder a | Inorder a | Postorder a | Levelorder a -data Morph a = Rotate a | Into a+data Morph a = Rotate a | Into a | Insert a | Push a | Pop a rotate :: forall f t . Morphable (Rotate f) t => t ~> Morphing (Rotate f) t rotate = morphing . TU . Tag @(Rotate f) into :: forall f t . Morphable (Into f) t => t ~> Morphing (Into f) t into = morphing . TU . Tag @(Into f)++insert :: forall f t a . (Morphable (Insert f) t, Morphing (Insert f) t ~ (Identity <:.:> t := (->))) => a :=:=> t+insert new xs = run / morph @(Insert f) xs / Identity new++item :: forall f t a . (Morphable f t, Morphing f t ~ (Identity <:.:> t := (->))) => a :=:=> t+item new xs = run / morph @f xs / Identity new++-- FIXME: doesn't work right now, quantified constraints in instances for Binary have ambigous variables+collate :: forall f t a . (Chain a, Morphable f t, Morphing f t ~ (Identity <:.:> t := (->))) => a :=:=> t+collate new xs = run / morph @f xs / Identity new
Pandora/Paradigm/Structure/Interface.hs view
@@ -1,4 +1,5 @@ module Pandora.Paradigm.Structure.Interface (module Exports) where +import Pandora.Paradigm.Structure.Interface.Stack as Exports import Pandora.Paradigm.Structure.Interface.Dictionary as Exports import Pandora.Paradigm.Structure.Interface.Set as Exports
Pandora/Paradigm/Structure/Interface/Set.hs view
@@ -5,7 +5,7 @@ import Pandora.Pattern.Object.Setoid (Setoid ((!=))) import Pandora.Pattern.Object.Semigroup ((+)) import Pandora.Pattern.Object.Quasiring (one)-import Pandora.Paradigm.Primary.Functor.Function ((!), (%))+import Pandora.Paradigm.Primary.Functor.Function ((!), (!!), (%)) import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Nothing)) import Pandora.Paradigm.Primary.Functor.Predicate (equate) import Pandora.Paradigm.Primary.Functor.Product (attached)@@ -16,10 +16,10 @@ import Pandora.Paradigm.Controlflow.Effect (run) member :: forall e a . (Setoid a, Monotonic a e) => a -> e -> Boolean-member x = reduce @a @(Maybe a) (\_ _ -> True) False . find (equate x)+member x = reduce @a @(Maybe a) (True !!) False . find (equate x) subset :: (Monotonic a (t a), Traversable t, Setoid a, Setoid (t a)) => t a -> t a -> Boolean-subset ss s = Nothing != (ss ->> find % s . equate)+subset ss s = Nothing != ss ->> find % s . equate cardinality :: Traversable t => t a -> Numerator-cardinality s = attached . run @(State _) % Zero $ s ->> (!) (modify @Numerator (+ one))+cardinality s = attached . run @(State _) % Zero $ s ->> (modify @Numerator (+ one) !)
+ Pandora/Paradigm/Structure/Interface/Stack.hs view
@@ -0,0 +1,10 @@+module Pandora.Paradigm.Structure.Interface.Stack where++import Pandora.Paradigm.Structure.Ability.Morphable (Morphable, Morph (Push, Pop))++{- |+> When providing a new instance, you should ensure it satisfies this one law:+> * Idempotency: item @Push x . morph @Pop ≡ identity+-}++class (Morphable Push t, Morphable Pop t) => Stack t where
Pandora/Paradigm/Structure/Modification/Comprehension.hs view
@@ -30,7 +30,7 @@ point = Comprehension . TU . point . Construct % empty instance Traversable (t <:.> Construction t) => Traversable (Comprehension t) where- Comprehension x ->> f = Comprehension <$> (x ->> f)+ Comprehension x ->> f = Comprehension <$> x ->> f instance (forall a . Semigroup (t <:.> Construction t := a), Bindable t, Pointable t, Avoidable t) => Applicative (Comprehension t) where fs <*> xs = fs >>= \f -> xs >>= Comprehension . TU . point . point . f
Pandora/Paradigm/Structure/Modification/Prefixed.hs view
@@ -34,7 +34,7 @@ f <$> Prefixed x = Prefixed $ f <$> x instance Traversable t => Traversable (Prefixed t k) where- Prefixed x ->> f = Prefixed <$> (x ->> f)+ Prefixed x ->> f = Prefixed <$> x ->> f instance (Monoid k, Pointable t) => Pointable (Prefixed t k) where point = Prefixed . lift . TU . (:*:) zero . Just
Pandora/Paradigm/Structure/Some.hs view
@@ -3,5 +3,5 @@ import Pandora.Paradigm.Structure.Some.Rose as Exports import Pandora.Paradigm.Structure.Some.Splay as Exports import Pandora.Paradigm.Structure.Some.Binary as Exports-import Pandora.Paradigm.Structure.Some.Stack as Exports+import Pandora.Paradigm.Structure.Some.List as Exports import Pandora.Paradigm.Structure.Some.Stream as Exports
Pandora/Paradigm/Structure/Some/Binary.hs view
@@ -3,7 +3,7 @@ module Pandora.Paradigm.Structure.Some.Binary where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap)) import Pandora.Pattern.Functor.Traversable (Traversable ((->>))) import Pandora.Pattern.Functor.Extractable (extract)@@ -19,11 +19,11 @@ import Pandora.Paradigm.Primary.Functor.Identity (Identity (Identity)) import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing)) import Pandora.Paradigm.Primary.Functor.Predicate (Predicate (Predicate))-import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:), attached)+import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:), attached, twosome) import Pandora.Paradigm.Primary.Functor.Wye (Wye (End, Left, Right, Both)) import Pandora.Paradigm.Primary.Functor.Tagged (Tagged (Tag)) import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct)-import Pandora.Paradigm.Schemes (TU (TU), T_U (T_U), type (<:.>))+import Pandora.Paradigm.Schemes (TU (TU), T_U (T_U), type (<:.>), type (<:.:>)) import Pandora.Paradigm.Controlflow.Effect.Interpreted (run) import Pandora.Paradigm.Inventory.State (State, modify) import Pandora.Paradigm.Inventory.Store (Store (Store))@@ -33,8 +33,7 @@ import Pandora.Paradigm.Structure.Ability.Focusable (Focusable (Focusing, focusing), Location (Root)) import Pandora.Paradigm.Structure.Ability.Measurable (Measurable (Measural, measurement), Scale (Heighth), measure) import Pandora.Paradigm.Structure.Ability.Monotonic (Monotonic (resolve))-import Pandora.Paradigm.Structure.Ability.Insertable (Insertable ((+=)))-import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into))+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into, Insert), premorph, collate) import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure), sub, substitute) import Pandora.Paradigm.Structure.Ability.Zipper (Zipper) @@ -42,14 +41,15 @@ rebalance :: Chain a => (Wye :. Construction Wye := a) -> Nonempty Binary a rebalance (Both x y) = extract x <=> extract y & order- (Construct (extract y) $ Both x (rebalance $ deconstruct y))- (Construct (extract x) $ Both (rebalance $ deconstruct x) (rebalance $ deconstruct y))- (Construct (extract x) $ Both (rebalance $ deconstruct x) y)+ (Construct / extract y $ Both / x / rebalance (deconstruct y))+ (Construct / extract x $ Both / rebalance (deconstruct x) / rebalance (deconstruct y))+ (Construct / extract x $ Both / rebalance (deconstruct x) / y) -instance (forall a . Chain a) => Insertable Binary where- x += (run -> Nothing) = lift . Construct x $ End- x += tree@(run -> Just nonempty) = x <=> extract nonempty & order- (tree & substitute @Left (x +=)) tree (tree & substitute @Right (x +=))+instance (forall a . Chain a) => Morphable Insert Binary where+ type Morphing Insert Binary = Identity <:.:> Binary := (->)+ morphing (run . premorph -> Nothing) = T_U $ \(Identity x) -> lift . Construct x $ End+ morphing (run . premorph -> Just ne) = T_U $ \(Identity x) -> lift $ x <=> extract ne+ & order (ne & substitute @Left (collate @Insert x)) ne (ne & substitute @Right (collate @Insert x)) instance (forall a . Chain a) => Focusable Root Binary where type Focusing Root Binary a = Maybe a@@ -86,16 +86,17 @@ instance Morphable (Into Binary) (Construction Wye) where type Morphing (Into Binary) (Construction Wye) = Binary- morphing = lift . extract . run+ morphing = lift . premorph +instance (forall a . Chain a) => Morphable Insert (Construction Wye) where+ type Morphing Insert (Construction Wye) = Identity <:.:> Construction Wye := (->)+ morphing (premorph -> xs) = T_U $ \(Identity x) -> let change = lift . resolve (collate @Insert x) (Construct x End) . run in+ x <=> extract xs & order (over / sub @Left / change / xs) xs (over / sub @Right / change / xs)+ instance Focusable Root (Construction Wye) where type Focusing Root (Construction Wye) a = a focusing (extract -> Construct x xs) = Store $ x :*: Tag . Construct % xs -instance (forall a . Chain a) => Insertable (Construction Wye) where- x += b = let change = lift . resolve (x +=) (Construct x End) . run in- x <=> extract b & order (over (sub @Left) change $ b) b (over (sub @Right) change $ b)- instance Measurable Heighth (Construction Wye) where type Measural Heighth (Construction Wye) a = Denumerator measurement (deconstruct . extract -> End) = One@@ -134,34 +135,37 @@ f <$> Leftward l = Leftward $ f l f <$> Rightward r = Rightward $ f r -type instance Zipper (Construction Wye) = T_U Covariant Covariant (Construction Wye) (:*:)- ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye))+type Bifurcation = Biforked <:.> Construction Biforked +type Bicursor = Identity <:.:> Binary := (:*:)++type instance Zipper (Construction Wye) = Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:)+ data Vertical a = Up a | Down a -instance Morphable (Rotate Up) (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye))) where- type Morphing (Rotate Up) (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye)))- = Maybe <:.> (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye)))- morphing (run . extract . run -> focused :*: TU (TU (Rightward (Construct (T_U (Identity parent :*: rest)) next)))) =- lift . T_U $ Construct parent (resolve (Both focused) (Left focused) $ run rest) :*: TU (TU next)- morphing (run . extract . run -> focused :*: TU (TU (Rightward (Construct (T_U (Identity parent :*: rest)) next)))) =- lift . T_U $ Construct parent (resolve (Both % focused) (Right focused) $ run rest) :*: TU (TU next)- morphing (extract . run -> T_U (_ :*: TU (TU Top))) = empty+instance Morphable (Rotate Up) (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:)) where+ type Morphing (Rotate Up) (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:))+ = Maybe <:.> (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:))+ morphing (run . premorph -> focused :*: TU (TU (Rightward (Construct (T_U (Identity parent :*: rest)) next)))) =+ lift $ twosome / Construct parent (resolve / Both focused / Left focused / run rest) / TU (TU next)+ morphing (run . premorph -> focused :*: TU (TU (Rightward (Construct (T_U (Identity parent :*: rest)) next)))) =+ lift $ twosome / Construct parent (resolve / Both % focused / Right focused / run rest) / TU (TU next)+ morphing (premorph -> T_U (_ :*: TU (TU Top))) = empty -instance Morphable (Rotate (Down Left)) (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye))) where- type Morphing (Rotate (Down Left)) (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye)))- = Maybe <:.> (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye)))- morphing (run . extract . run -> Construct x (Left lst) :*: TU (TU next)) =- lift . T_U . (:*:) lst . TU . TU . Leftward . Construct (T_U $ Identity x :*: empty) $ next- morphing (run . extract . run -> Construct x (Both lst rst) :*: TU (TU next)) =- lift . T_U . (:*:) lst . TU . TU . Leftward . Construct (T_U $ Identity x :*: lift rst) $ next- morphing (run . extract . run -> Construct _ (Right _) :*: _) = empty- morphing (run . extract . run -> Construct _ End :*: _) = empty+instance Morphable (Rotate (Down Left)) (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:)) where+ type Morphing (Rotate (Down Left)) (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:))+ = Maybe <:.> (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:))+ morphing (run . premorph -> Construct x (Left lst) :*: TU (TU next)) =+ lift . twosome lst . TU . TU . Leftward . Construct (twosome / Identity x / empty) $ next+ morphing (run . premorph -> Construct x (Both lst rst) :*: TU (TU next)) =+ lift . twosome lst . TU . TU . Leftward . Construct (twosome / Identity x / lift rst) $ next+ morphing (run . premorph -> Construct _ (Right _) :*: _) = empty+ morphing (run . premorph -> Construct _ End :*: _) = empty -instance Morphable (Rotate (Down Right)) (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye))) where- type Morphing (Rotate (Down Right)) (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye)))- = Maybe <:.> (T_U Covariant Covariant (Construction Wye) (:*:) ((Biforked <:.> Construction Biforked) <:.> T_U Covariant Covariant Identity (:*:) (Maybe <:.> Construction Wye)))- morphing (run . extract . run -> Construct x (Right rst) :*: TU (TU next)) = lift . T_U . (:*:) rst . TU . TU . Rightward . Construct (T_U $ Identity x :*: empty) $ next- morphing (run . extract . run -> Construct x (Both lst rst) :*: TU (TU next)) = lift . T_U . (:*:) rst . TU . TU . Rightward . Construct (T_U $ Identity x :*: lift lst) $ next- morphing (run . extract . run -> Construct _ (Left _) :*: _) = empty- morphing (run . extract . run -> Construct _ End :*: _) = empty+instance Morphable (Rotate (Down Right)) (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:)) where+ type Morphing (Rotate (Down Right)) (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:))+ = Maybe <:.> (Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:))+ morphing (run . premorph -> Construct x (Right rst) :*: TU (TU next)) = lift . twosome rst . TU . TU . Rightward . Construct (twosome / Identity x / empty) $ next+ morphing (run . premorph -> Construct x (Both lst rst) :*: TU (TU next)) = lift . twosome rst . TU . TU . Rightward . Construct (twosome / Identity x / lift lst) $ next+ morphing (run . premorph -> Construct _ (Left _) :*: _) = empty+ morphing (run . premorph -> Construct _ End :*: _) = empty
+ Pandora/Paradigm/Structure/Some/List.hs view
@@ -0,0 +1,162 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Pandora.Paradigm.Structure.Some.List where++import Pandora.Core.Functor (type (:.), type (:=))+import Pandora.Pattern ((.|..))+import Pandora.Pattern.Category ((.), ($), identity)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Extractable (extract)+import Pandora.Pattern.Functor.Avoidable (empty)+import Pandora.Pattern.Functor.Traversable (Traversable)+import Pandora.Pattern.Functor.Extendable (Extendable ((=>>)))+import Pandora.Pattern.Transformer.Liftable (lift)+import Pandora.Pattern.Object.Setoid (Setoid ((==)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False), (?))+import Pandora.Paradigm.Primary.Object.Numerator (Numerator (Numerator))+import Pandora.Paradigm.Primary.Object.Denumerator (Denumerator (One))+import Pandora.Paradigm.Primary.Functor.Function ((%), (&))+import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing))+import Pandora.Paradigm.Primary.Functor.Identity (Identity (Identity))+import Pandora.Paradigm.Primary.Functor.Predicate (Predicate (Predicate))+import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:), twosome)+import Pandora.Paradigm.Primary.Functor.Tagged (Tagged (Tag))+import Pandora.Paradigm.Primary.Functor.Wye (Wye (Left, Right))+import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct, (.-+))+import Pandora.Paradigm.Primary.Transformer.Tap (Tap (Tap))+import Pandora.Paradigm.Inventory.State (State, fold)+import Pandora.Paradigm.Inventory.Store (Store (Store))+import Pandora.Paradigm.Inventory.Optics (view)+import Pandora.Paradigm.Controlflow.Effect.Interpreted (run, (||=))+import Pandora.Paradigm.Schemes.TU (TU (TU), type (<:.>))+import Pandora.Paradigm.Schemes.T_U (T_U (T_U), type (<:.:>))+import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty)+import Pandora.Paradigm.Structure.Ability.Nullable (Nullable (null))+import Pandora.Paradigm.Structure.Ability.Zipper (Zipper)+import Pandora.Paradigm.Structure.Ability.Focusable (Focusable (Focusing, focusing), Location (Head), focus)+import Pandora.Paradigm.Structure.Ability.Deletable (Deletable ((-=)))+import Pandora.Paradigm.Structure.Ability.Measurable (Measurable (Measural, measurement), Scale (Length), measure)+import Pandora.Paradigm.Structure.Ability.Monotonic (Monotonic (reduce, resolve))+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into, Push, Pop), premorph, rotate, item)+import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure), Segment (Tail), sub, subview)+import Pandora.Paradigm.Structure.Interface.Stack (Stack)++-- | Linear data structure that serves as a collection of elements+type List = Maybe <:.> Construction Maybe++instance Setoid a => Setoid (List a) where+ TU ls == TU rs = ls == rs++instance Semigroup (List a) where+ TU Nothing + TU ys = TU ys+ TU (Just (Construct x xs)) + TU ys = lift . Construct x . run+ $ TU @Covariant @Covariant xs + TU @Covariant @Covariant ys++instance Monoid (List a) where+ zero = empty++instance Morphable Push List where+ type Morphing Push List = Identity <:.:> List := (->)+ morphing (premorph -> xs) = T_U $ \(Identity x) -> lift . Construct x . run $ xs++instance Morphable Pop List where+ type Morphing Pop List = List+ morphing (premorph -> xs) = resolve deconstruct Nothing ||= xs++instance Stack List where++instance Focusable Head List where+ type Focusing Head List a = Maybe a+ focusing (extract -> stack) = Store $ extract <$> run stack :*: \case+ Just x -> stack & subview @Tail & item @Push x & Tag+ Nothing -> stack & subview @Tail & Tag++instance Measurable Length List where+ type Measural Length List a = Numerator+ measurement (run . extract -> Nothing) = zero+ measurement (run . extract -> Just xs) = Numerator $ measure @Length xs++instance Nullable List where+ null = Predicate $ \case { TU Nothing -> True ; _ -> False }++instance Substructure Tail List where+ type Substructural Tail List = List+ substructure (run . extract . run -> Just ns) = lift . lift <$> sub @Tail ns+ substructure (run . extract . run -> Nothing) = Store $ empty :*: lift . identity++instance Deletable List where+ _ -= TU Nothing = TU Nothing+ x -= TU (Just (Construct y ys)) = x == y ? TU ys+ $ lift . Construct y . run . (-=) @List x $ TU ys++filter :: forall a . Predicate a -> List a -> List a+filter (Predicate p) = TU . extract+ . run @(State (Maybe :. Nonempty List := a)) % Nothing+ . fold (\now new -> p now ? Just (Construct now new) $ new)++-- | Transform any traversable structure into a stack+linearize :: forall t a . Traversable t => t a -> List a+linearize = TU . extract . run @(State (Maybe :. Nonempty List := a)) % Nothing . fold (Just .|.. Construct)++type instance Nonempty List = Construction Maybe++instance {-# OVERLAPS #-} Semigroup (Construction Maybe a) where+ Construct x Nothing + ys = Construct x $ Just ys+ Construct x (Just xs) + ys = Construct x . Just $ xs + ys++instance Morphable (Into List) (Construction Maybe) where+ type Morphing (Into List) (Construction Maybe) = List+ morphing = lift . premorph++instance Focusable Head (Construction Maybe) where+ type Focusing Head (Construction Maybe) a = a+ focusing (extract -> stack) = Store $ extract stack :*: Tag . Construct % deconstruct stack++instance Morphable Push (Construction Maybe) where+ type Morphing Push (Construction Maybe) = Identity <:.:> Construction Maybe := (->)+ morphing (premorph -> xs) = T_U $ \(Identity x) -> Construct x $ Just xs++instance Measurable Length (Construction Maybe) where+ type Measural Length (Construction Maybe) a = Denumerator+ measurement (deconstruct . extract -> Nothing) = One+ measurement (deconstruct . extract -> Just xs) = One + measure @Length xs++instance Monotonic a (Construction Maybe a) where+ reduce f r ~(Construct x xs) = f x $ reduce f r xs++instance Substructure Tail (Construction Maybe) where+ type Substructural Tail (Construction Maybe) = List+ substructure (extract . run -> Construct x xs) =+ Store $ TU xs :*: lift . Construct x . run++type instance Zipper List = Tap (List <:.:> List := (:*:))++instance {-# OVERLAPS #-} Extendable (Tap (List <:.:> List := (:*:))) where+ z =>> f = let move rtt = TU . deconstruct $ rtt .-+ z+ in f <$> Tap z (twosome (move $ run . rotate @Left) (move $ run . rotate @Right))++instance Morphable (Rotate Left) (Tap (List <:.:> List := (:*:))) where+ type Morphing (Rotate Left) (Tap (List <:.:> List := (:*:))) = Maybe <:.> Zipper List+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = TU+ $ Tap % twosome (subview @Tail bs) (item @Push x fs) <$> view (focus @Head) bs++instance Morphable (Rotate Right) (Tap (List <:.:> List := (:*:))) where+ type Morphing (Rotate Right) (Tap (List <:.:> List := (:*:))) = Maybe <:.> Zipper List+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = TU+ $ Tap % twosome (item @Push x bs) (subview @Tail fs) <$> view (focus @Head) fs++type instance Zipper (Construction Maybe) = Tap (Construction Maybe <:.:> Construction Maybe := (:*:))++instance Morphable (Rotate Left) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where+ type Morphing (Rotate Left) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) = Maybe <:.> Zipper (Construction Maybe)+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = TU+ $ Tap (extract bs) . twosome % (item @Push x fs) <$> deconstruct bs++instance Morphable (Rotate Right) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where+ type Morphing (Rotate Right) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) = Maybe <:.> Zipper (Construction Maybe)+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = TU $ Tap (extract fs) . twosome (item @Push x bs) <$> deconstruct fs++instance Monotonic a (Maybe <:.> Construction Maybe := a) where+ reduce f r = reduce f r . run
Pandora/Paradigm/Structure/Some/Rose.hs view
@@ -22,9 +22,9 @@ import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty) import Pandora.Paradigm.Structure.Ability.Nullable (Nullable (null)) import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure))-import Pandora.Paradigm.Structure.Some.Stack (Stack)+import Pandora.Paradigm.Structure.Some.List (List) -type Rose = Maybe <:.> Construction Stack+type Rose = Maybe <:.> Construction List instance Focusable Root Rose where type Focusing Root Rose a = Maybe a@@ -36,18 +36,18 @@ null = Predicate $ \case { TU Nothing -> True ; _ -> False } instance Substructure Just Rose where- type Substructural Just Rose = Stack <:.> Construction Stack+ type Substructural Just Rose = List <:.> Construction List substructure (run . extract . run -> Nothing) = Store $ empty :*: (lift empty !) substructure (run . extract . run -> Just (Construct x xs)) = Store $ TU xs :*: lift . lift . Construct x . run -type instance Nonempty Rose = Construction Stack+type instance Nonempty Rose = Construction List -instance Focusable Root (Construction Stack) where- type Focusing Root (Construction Stack) a = a+instance Focusable Root (Construction List) where+ type Focusing Root (Construction List) a = a focusing (Tag rose) = Store $ extract rose :*: Tag . Construct % deconstruct rose -instance Substructure Just (Construction Stack) where- type Substructural Just (Construction Stack) = Stack <:.> Construction Stack+instance Substructure Just (Construction List) where+ type Substructural Just (Construction List) = List <:.> Construction List substructure (extract . run -> Construct x xs) = Store $ TU xs :*: lift . Construct x . run
Pandora/Paradigm/Structure/Some/Splay.hs view
@@ -4,21 +4,20 @@ module Pandora.Paradigm.Structure.Some.Splay where import Pandora.Core.Functor (type (~>), type (:.), type (:=))-import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Applicative ((<*>)) import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Paradigm.Primary ()-import Pandora.Paradigm.Primary.Functor (branches)-import Pandora.Paradigm.Primary.Functor.Function ((%)) import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just))+import Pandora.Paradigm.Primary.Functor.Product (twosome) import Pandora.Paradigm.Primary.Functor.Tagged (type (:#)) import Pandora.Paradigm.Primary.Functor.Wye (Wye (Left, Right)) import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct) import Pandora.Paradigm.Controlflow.Effect.Interpreted (run, (||=)) import Pandora.Paradigm.Schemes (TU (TU), type (<:.>))-import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into), rotate, into)+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into), premorph, rotate, into) import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty) import Pandora.Paradigm.Structure.Ability.Substructure (substitute) import Pandora.Paradigm.Structure.Some.Binary (Binary)@@ -28,11 +27,11 @@ instance Morphable (Rotate (Left Zig)) (Construction Wye) where type Morphing (Rotate (Left Zig)) (Construction Wye) = Binary morphing :: forall a . (:#) (Rotate (Left Zig)) <:.> Construction Wye := a -> Binary a- morphing (extract . run -> Construct x xs) = TU $ Construct <$> parent <*> Just nodes where+ morphing (premorph -> Construct x xs) = TU $ Construct <$> parent <*> Just nodes where nodes :: Wye :. Nonempty Binary := a- nodes = branches (branch @Left xs) . Just . Construct x- $ branches (deconstruct <$> branch @Right xs >>= branch @Left)+ nodes = into @Wye . twosome (branch @Left xs) . Just . Construct x+ . into @Wye $ twosome (deconstruct <$> branch @Right xs >>= branch @Left) (deconstruct <$> branch @Right xs >>= branch @Right) parent :: Maybe a@@ -41,30 +40,30 @@ instance Morphable (Rotate (Right Zig)) (Construction Wye) where type Morphing (Rotate (Right Zig)) (Construction Wye) = Binary morphing :: forall a . (:#) (Rotate (Right Zig)) <:.> Construction Wye := a -> Binary a- morphing (extract . run -> Construct x xs) = TU $ Construct <$> parent <*> Just nodes where+ morphing (premorph -> Construct x xs) = TU $ Construct <$> parent <*> Just nodes where nodes :: Wye :. Nonempty Binary := a- nodes = branches (deconstruct <$> branch @Left xs >>= branch @Left) . Just . Construct x- $ branches (deconstruct <$> branch @Left xs >>= branch @Right) (branch @Right xs)+ nodes = into @Wye . twosome (deconstruct <$> branch @Left xs >>= branch @Left) . Just . Construct x+ . into @Wye $ twosome (deconstruct <$> branch @Left xs >>= branch @Right) / branch @Right xs parent :: Maybe a parent = extract <$> branch @Left xs instance Morphable (Rotate (Left (Zig Zig))) (Construction Wye) where type Morphing (Rotate (Left (Zig Zig))) (Construction Wye) = Binary- morphing (extract . run -> tree) = TU $ run (rotate @(Left Zig) tree) >>= run . rotate @(Left Zig)+ morphing (premorph -> tree) = TU $ run / rotate @(Left Zig) tree >>= run . rotate @(Left Zig) instance Morphable (Rotate (Right (Zig Zig))) (Construction Wye) where type Morphing (Rotate (Right (Zig Zig))) (Construction Wye) = Binary- morphing (extract . run -> tree) = TU $ run (rotate @(Right Zig) tree) >>= run . rotate @(Right Zig)+ morphing (premorph -> tree) = TU $ run / rotate @(Right Zig) tree >>= run . rotate @(Right Zig) instance Morphable (Rotate (Left (Zig Zag))) (Construction Wye) where type Morphing (Rotate (Left (Zig Zag))) (Construction Wye) = Binary- morphing = rotate @(Left Zig) . substitute @Left ((>>= run . rotate @(Right Zig)) ||=) . extract . run+ morphing = rotate @(Left Zig) . substitute @Left ((>>= run . rotate @(Right Zig)) ||=) . premorph instance Morphable (Rotate (Right (Zig Zag))) (Construction Wye) where type Morphing (Rotate (Right (Zig Zag))) (Construction Wye) = Binary- morphing = rotate @(Right Zig) . substitute @Right ((>>= run . rotate @(Left Zig)) ||=) . extract . run+ morphing = rotate @(Right Zig) . substitute @Right ((>>= run . rotate @(Left Zig)) ||=) . premorph branch :: forall b . Morphable (Into (b Maybe)) Wye => Wye ~> Morphing (Into (b Maybe)) Wye branch = into @(b Maybe)
− Pandora/Paradigm/Structure/Some/Stack.hs
@@ -1,156 +0,0 @@-{-# OPTIONS_GHC -fno-warn-orphans #-}--module Pandora.Paradigm.Structure.Some.Stack where--import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern ((.|..))-import Pandora.Pattern.Category ((.), ($), identity)-import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))-import Pandora.Pattern.Functor.Alternative ((<+>))-import Pandora.Pattern.Functor.Pointable (point)-import Pandora.Pattern.Functor.Extractable (extract)-import Pandora.Pattern.Functor.Avoidable (empty)-import Pandora.Pattern.Functor.Traversable (Traversable)-import Pandora.Pattern.Functor.Extendable (Extendable ((=>>)))-import Pandora.Pattern.Transformer.Liftable (lift)-import Pandora.Pattern.Object.Setoid (Setoid ((==)))-import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))-import Pandora.Pattern.Object.Monoid (Monoid (zero))-import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False), (?))-import Pandora.Paradigm.Primary.Object.Numerator (Numerator (Numerator))-import Pandora.Paradigm.Primary.Object.Denumerator (Denumerator (One))-import Pandora.Paradigm.Primary.Functor.Function ((%), (&))-import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing))-import Pandora.Paradigm.Primary.Functor.Predicate (Predicate (Predicate))-import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:))-import Pandora.Paradigm.Primary.Functor.Tagged (Tagged (Tag))-import Pandora.Paradigm.Primary.Functor.Wye (Wye (Left, Right))-import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct, (.-+))-import Pandora.Paradigm.Primary.Transformer.Tap (Tap (Tap))-import Pandora.Paradigm.Inventory.State (State, fold)-import Pandora.Paradigm.Inventory.Store (Store (Store))-import Pandora.Paradigm.Inventory.Optics (view)-import Pandora.Paradigm.Controlflow.Effect.Interpreted (run)-import Pandora.Paradigm.Schemes.TU (TU (TU), type (<:.>))-import Pandora.Paradigm.Schemes.T_U (T_U (T_U), type (<:.:>))-import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty)-import Pandora.Paradigm.Structure.Ability.Nullable (Nullable (null))-import Pandora.Paradigm.Structure.Ability.Zipper (Zipper)-import Pandora.Paradigm.Structure.Ability.Focusable (Focusable (Focusing, focusing), Location (Head), focus)-import Pandora.Paradigm.Structure.Ability.Deletable (Deletable ((-=)))-import Pandora.Paradigm.Structure.Ability.Insertable (Insertable ((+=)))-import Pandora.Paradigm.Structure.Ability.Measurable (Measurable (Measural, measurement), Scale (Length), measure)-import Pandora.Paradigm.Structure.Ability.Monotonic (Monotonic (reduce))-import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into), rotate)-import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure), Segment (Tail), sub, subview)---- | Linear data structure that serves as a collection of elements-type Stack = Maybe <:.> Construction Maybe--instance Setoid a => Setoid (Stack a) where- TU ls == TU rs = ls == rs--instance Semigroup (Stack a) where- TU Nothing + TU ys = TU ys- TU (Just (Construct x xs)) + TU ys = lift . Construct x . run- $ TU @Covariant @Covariant xs + TU @Covariant @Covariant ys--instance Monoid (Stack a) where- zero = empty--instance Focusable Head Stack where- type Focusing Head Stack a = Maybe a- focusing (extract -> stack) = Store $ extract <$> run stack :*: \case- Just x -> stack & subview @Tail & (x +=) & Tag- Nothing -> stack & subview @Tail & Tag--instance Insertable Stack where- x += (run -> stack) = TU $ (Construct x . Just <$> stack) <+> (point . point) x--instance Measurable Length Stack where- type Measural Length Stack a = Numerator- measurement (run . extract -> Nothing) = zero- measurement (run . extract -> Just xs) = Numerator $ measure @Length xs--instance Nullable Stack where- null = Predicate $ \case { TU Nothing -> True ; _ -> False }--instance Substructure Tail Stack where- type Substructural Tail Stack = Stack- substructure (run . extract . run -> Just ns) = lift . lift <$> sub @Tail ns- substructure (run . extract . run -> Nothing) = Store $ empty :*: lift . identity--instance Deletable Stack where- _ -= TU Nothing = TU Nothing- x -= TU (Just (Construct y ys)) = x == y ? TU ys- $ lift . Construct y . run . (-=) @Stack x $ TU ys--filter :: forall a . Predicate a -> Stack a -> Stack a-filter (Predicate p) = TU . extract- . run @(State (Maybe :. Nonempty Stack := a)) % Nothing- . fold (\now new -> p now ? Just (Construct now new) $ new)---- | Transform any traversable structure into a stack-linearize :: forall t a . Traversable t => t a -> Stack a-linearize = TU . extract . run @(State (Maybe :. Nonempty Stack := a)) % Nothing . fold (Just .|.. Construct)--type instance Nonempty Stack = Construction Maybe--instance {-# OVERLAPS #-} Semigroup (Construction Maybe a) where- Construct x Nothing + ys = Construct x $ Just ys- Construct x (Just xs) + ys = Construct x . Just $ xs + ys--instance Morphable (Into Stack) (Construction Maybe) where- type Morphing (Into Stack) (Construction Maybe) = Stack- morphing = lift . extract . run--instance Focusable Head (Construction Maybe) where- type Focusing Head (Construction Maybe) a = a- focusing (extract -> stack) = Store $ extract stack :*: Tag . Construct % deconstruct stack--instance Insertable (Construction Maybe) where- (+=) x = Construct x . Just--instance Measurable Length (Construction Maybe) where- type Measural Length (Construction Maybe) a = Denumerator- measurement (deconstruct . extract -> Nothing) = One- measurement (deconstruct . extract -> Just xs) = One + measure @Length xs--instance Monotonic a (Construction Maybe a) where- reduce f r ~(Construct x xs) = f x $ reduce f r xs--instance Substructure Tail (Construction Maybe) where- type Substructural Tail (Construction Maybe) = Stack- substructure (extract . run -> Construct x xs) =- Store $ TU xs :*: lift . Construct x . run--type instance Zipper Stack = Tap ((:*:) <:.:> Stack)--instance {-# OVERLAPS #-} Extendable (Tap ((:*:) <:.:> Stack)) where- z =>> f = let move rtt = TU . deconstruct $ rtt .-+ z- in f <$> Tap z (T_U $ move (run . rotate @Left) :*: move (run . rotate @Right))--instance Morphable (Rotate Left) (Tap ((:*:) <:.:> Stack)) where- type Morphing (Rotate Left) (Tap ((:*:) <:.:> Stack)) = Maybe <:.> Zipper Stack- morphing (extract . run -> Tap x (T_U (bs :*: fs))) = TU- $ Tap % (T_U $ subview @Tail bs :*: x += fs) <$> view (focus @Head) bs--instance Morphable (Rotate Right) (Tap ((:*:) <:.:> Stack)) where- type Morphing (Rotate Right) (Tap ((:*:) <:.:> Stack)) = Maybe <:.> Zipper Stack- morphing (extract . run -> Tap x (T_U (bs :*: fs))) = TU- $ Tap % (T_U $ x += bs :*: subview @Tail fs) <$> view (focus @Head) fs--type instance Zipper (Construction Maybe) = Tap ((:*:) <:.:> Construction Maybe)--instance Morphable (Rotate Left) (Tap ((:*:) <:.:> Construction Maybe)) where- type Morphing (Rotate Left) (Tap ((:*:) <:.:> Construction Maybe)) = Maybe <:.> Zipper (Construction Maybe)- morphing (extract . run -> Tap x (T_U (bs :*: fs))) = TU- $ Tap (extract bs) . T_U . (:*: x += fs) <$> deconstruct bs--instance Morphable (Rotate Right) (Tap ((:*:) <:.:> Construction Maybe)) where- type Morphing (Rotate Right) (Tap ((:*:) <:.:> Construction Maybe)) = Maybe <:.> Zipper (Construction Maybe)- morphing (extract . run -> Tap x (T_U (bs :*: fs))) = TU- $ Tap (extract fs) . T_U . (x += bs :*:) <$> deconstruct fs--instance Monotonic a (Maybe <:.> Construction Maybe := a) where- reduce f r = reduce f r . run
Pandora/Paradigm/Structure/Some/Stream.hs view
@@ -2,39 +2,38 @@ module Pandora.Paradigm.Structure.Some.Stream where -import Pandora.Core.Functor (type (:=>))-import Pandora.Pattern.Category ((.), ($))+import Pandora.Core.Functor (type (:=), type (:=>))+import Pandora.Pattern.Category ((.), ($), (/)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (point) import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Pattern.Functor.Extendable (Extendable ((=>>)))-import Pandora.Paradigm.Controlflow.Effect.Interpreted (run)-import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:))+import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:), twosome) import Pandora.Paradigm.Primary.Functor.Identity (Identity (Identity)) import Pandora.Paradigm.Primary.Functor.Wye (Wye (Left, Right)) import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct, (.-+)) import Pandora.Paradigm.Primary.Transformer.Tap (Tap (Tap))-import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate), rotate)+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate), premorph, rotate) import Pandora.Paradigm.Structure.Ability.Zipper (Zipper) import Pandora.Paradigm.Schemes.T_U (T_U (T_U), type (<:.:>)) type Stream = Construction Identity -type instance Zipper Stream = Tap ((:*:) <:.:> Stream)+type instance Zipper Stream = Tap (Stream <:.:> Stream := (:*:)) -instance Morphable (Rotate Left) (Tap ((:*:) <:.:> Stream)) where- type Morphing (Rotate Left) (Tap ((:*:) <:.:> Stream)) = Tap ((:*:) <:.:> Stream)- morphing (extract . run -> Tap x (T_U (bs :*: fs))) = Tap (extract bs) . T_U- $ extract (deconstruct bs) :*: Construct x (point fs)+instance Morphable (Rotate Left) (Tap (Stream <:.:> Stream := (:*:))) where+ type Morphing (Rotate Left) (Tap (Stream <:.:> Stream := (:*:))) = Tap (Stream <:.:> Stream := (:*:))+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = Tap (extract bs)+ $ twosome / extract (deconstruct bs) / Construct x (point fs) -instance Morphable (Rotate Right) (Tap ((:*:) <:.:> Stream)) where- type Morphing (Rotate Right) (Tap ((:*:) <:.:> Stream)) = Tap ((:*:) <:.:> Stream)- morphing (extract . run -> Tap x (T_U (bs :*: fs))) = Tap (extract fs) . T_U- $ Construct x (point bs) :*: extract (deconstruct fs)+instance Morphable (Rotate Right) (Tap (Stream <:.:> Stream := (:*:))) where+ type Morphing (Rotate Right) (Tap (Stream <:.:> Stream := (:*:))) = Tap (Stream <:.:> Stream := (:*:))+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = Tap / extract fs+ $ twosome / Construct x (point bs) / extract (deconstruct fs) -instance {-# OVERLAPS #-} Extendable (Tap ((:*:) <:.:> Stream)) where+instance {-# OVERLAPS #-} Extendable (Tap (Stream <:.:> Stream := (:*:))) where z =>> f = let move rtt = extract . deconstruct $ point . rtt .-+ z- in f <$> Tap z (T_U $ move (rotate @Left) :*: move (rotate @Right))+ in f <$> Tap z (twosome / move (rotate @Left) / move (rotate @Right)) repeat :: a :=> Stream repeat x = Construct x . Identity $ repeat x
Pandora/Pattern/Category.hs view
@@ -3,6 +3,7 @@ import Pandora.Core.Functor (type (~~>)) infixr 8 .+infixl 1 / infixr 0 $ class Category (m :: * -> * -> *) where@@ -12,6 +13,5 @@ ($) :: m ~~> m ($) f = identity . f -instance Category (->) where- identity x = x- f . g = \x -> f (g x)+ (/) :: m ~~> m+ (/) f = identity . f
Pandora/Pattern/Functor/Adjoint.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Adjoint where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category (identity) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>), (<$$$>), (<$$$$>))) type (-|) = Adjoint@@ -31,10 +30,10 @@ psi g x = x |- g -- | Also known as 'unit' eta :: a -> u :. t := a- eta = phi identity+ eta = phi (\x -> x) -- | Also known as 'counit' epsilon :: t :. u := a -> a- epsilon = psi identity+ epsilon = psi (\x -> x) (-|$) :: Covariant v => v a -> (t a -> b) -> v (u b) x -|$ f = (-| f) <$> x
Pandora/Pattern/Functor/Applicative.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Applicative where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category (identity) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$))) infixl 4 <*>, <*, *>@@ -26,7 +25,7 @@ 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+ x *> y = ((\z -> z) <$ x) <*> y -- | Sequence actions, discarding the value of the second argument (<*) :: t a -> t b -> t a x <* y = y *> x
Pandora/Pattern/Functor/Bindable.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Bindable where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category (identity) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) infixl 1 >>=@@ -25,7 +24,7 @@ bind f t = t >>= f -- | Merge effects/contexts, the dual of 'duplicate' join :: t :. t := a -> t a- join t = t >>= identity+ join t = t >>= \x -> x -- | Left-to-right Kleisli composition (>=>) :: (a -> t b) -> (b -> t c) -> (a -> t c) f >=> g = \x -> f x >>= g
Pandora/Pattern/Functor/Bivariant.hs view
@@ -1,7 +1,5 @@ module Pandora.Pattern.Functor.Bivariant where -import Pandora.Pattern.Category (($))- infixl 4 <-> {- |@@ -15,4 +13,4 @@ (<->) :: (a -> b) -> (c -> d) -> v a c -> v b d -- | Prefix version of '<->' bimap :: (a -> b) -> (c -> d) -> v a c -> v b d- bimap f g x = f <-> g $ x+ bimap f g x = (f <-> g) x
Pandora/Pattern/Functor/Contravariant.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Contravariant where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category ((.)) infixl 4 >$<, $<, >$ @@ -21,12 +20,7 @@ contramap f x = f >$< x -- | Replace all locations in the output with the same value (>$) :: b -> t b -> t a- (>$) = contramap . (\x _ -> x)--- -- (a -> b)-- -- (!) :: a -> b -> a+ x >$ z = (\_ -> x) >$< z -- | Flipped version of '>$' ($<) :: t b -> b -> t a x $< v = v >$ x@@ -39,13 +33,13 @@ -- | Infix versions of `contramap` with various nesting levels (>$$<) :: Contravariant u => (a -> b) -> t :. u := a -> t :. u := b- (>$$<) = (>$<) . (>$<)+ f >$$< x = ((f >$<) >$<) x (>$$$<) :: (Contravariant u, Contravariant v) => (a -> b) -> t :. u :. v := b -> t :. u :. v := a- (>$$$<) = (>$<) . (>$<) . (>$<)+ f >$$$< x = (((f >$<) >$<) >$<) x (>$$$$<) :: (Contravariant u, Contravariant v, Contravariant w) => (a -> b) -> t :. u :. v :. w := a -> t :. u :. v :. w := b- (>$$$$<) = (>$<) . (>$<) . (>$<) . (>$<)+ f >$$$$< x = ((((f >$<) >$<) >$<) >$<) x -- | Infix flipped versions of `contramap` with various nesting levels (>&&<) :: Contravariant u => t :. u := a -> (a -> b) -> t :. u := b
Pandora/Pattern/Functor/Covariant.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Covariant where import Pandora.Core.Functor (type (:.), type (:=), type (<:=))-import Pandora.Pattern.Category (Category ((.), ($))) infixl 4 <$>, <$, $> infixl 3 <$$>@@ -29,7 +28,7 @@ comap f x = f <$> x -- | Replace all locations in the input with the same value (<$) :: a -> t b -> t a- (<$) = comap . (\x _ -> x)+ x <$ z = (\_-> x) <$> z -- | Flipped version of '<$' ($>) :: t a -> b -> t b x $> v = v <$ x@@ -38,20 +37,20 @@ void x = () <$ x -- | Computing a value from a structure of values loeb :: t (a <:= t) -> t a- loeb tt = let fix f = let x = f x in x in fix (\f -> ($ f) <$> tt)+ loeb tt = let fix f = let x = f x in x in fix (\f -> (\g -> g 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- (<$$>) = (<$>) . (<$>)+ f <$$> x = ((f <$>) <$>) x (<$$$>) :: (Covariant u, Covariant v) => (a -> b) -> t :. u :. v := a -> t :. u :. v := b- (<$$$>) = (<$>) . (<$>) . (<$>)+ f <$$$> x = (((f <$>) <$>) <$>) x (<$$$$>) :: (Covariant u, Covariant v, Covariant w) => (a -> b) -> t :. u :. v :. w := a -> t :. u :. v :. w := b- (<$$$$>) = (<$>) . (<$>) . (<$>) . (<$>)+ f <$$$$> x = ((((f <$>) <$>) <$>) <$>) x -- | Infix flipped versions of `comap` with various nesting levels (<&&>) :: Covariant u => t :. u := a -> (a -> b) -> t :. u := b
Pandora/Pattern/Functor/Distributive.hs view
@@ -2,7 +2,6 @@ import Pandora.Core.Functor (type (:.), type (:=)) import Pandora.Pattern.Functor.Covariant (Covariant)-import Pandora.Pattern.Category (identity, (.)) {- | > Let f :: Distributive g => (a -> g b)@@ -24,15 +23,15 @@ collect f t = t >>- f -- | The dual of 'sequence' distribute :: Covariant u => u :. t := a -> t :. u := a- distribute t = t >>- identity+ distribute t = t >>- (\x -> x) -- | Infix versions of `collect` with various nesting levels (>>>-) :: (Covariant u, Covariant v) => u :. v := a -> (a -> t b) -> t :. u :. v := b- x >>>- f = (collect . collect) f x+ x >>>- f = x >>- (>>- f) (>>>>-) :: (Covariant u, Covariant v, Covariant w) => u :. v :. w := a -> (a -> t b) -> t :. u :. v :. w := b- x >>>>- f = (collect . collect . collect) f x+ x >>>>- f = x >>- (>>- (>>- f)) (>>>>>-) :: (Covariant u, Covariant v, Covariant w, Covariant j) => u :. v :. w :. j := a -> (a -> t b) -> t :. u :. v :. w :. j := b- x >>>>>- f = (collect . collect . collect . collect) f x+ x >>>>>- f = x >>- (>>- (>>- (>>- f)))
Pandora/Pattern/Functor/Divariant.hs view
@@ -1,7 +1,5 @@ module Pandora.Pattern.Functor.Divariant where -import Pandora.Pattern.Category ((.), ($))- infixl 4 >-> {- |@@ -15,7 +13,4 @@ (>->) :: (a -> b) -> (c -> d) -> v b c -> v a d -- | Prefix version of '>->' dimap :: (a -> b) -> (c -> d) -> v b c -> v a d- dimap f g x = f >-> g $ x--instance Divariant ((->)) where- (>->) ab cd bc = cd . bc . ab+ dimap f g x = (f >-> g) x
Pandora/Pattern/Functor/Extendable.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Extendable where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category (identity, (.)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) infixl 1 =>>@@ -26,13 +25,14 @@ extend f t = t =>> f -- | Clone existing structure, the dual of 'join' duplicate :: t a -> t :. t := a- duplicate t = t =>> identity+ duplicate t = t =>> (\x -> x) -- | Right-to-left Cokleisli composition (=<=) :: (t b -> c) -> (t a -> b) -> t a -> c- f =<= g = f . extend g+ f =<= g = \x -> f (extend g x)+ -- | Left-to-right Cokleisli composition (=>=) :: (t a -> b) -> (t b -> c) -> t a -> c- f =>= g = g . extend f+ f =>= g = \x -> g (extend f x) -- | Experimental methods ($=>>) :: Covariant u => u :. t := a -> (t a -> b) -> u :. t := b
Pandora/Pattern/Functor/Invariant.hs view
@@ -1,7 +1,5 @@ module Pandora.Pattern.Functor.Invariant where -import Pandora.Pattern.Category (($))- {- | > When providing a new instance, you should ensure it satisfies the two laws: > Identity morphisms: invmap identity identity = identity@@ -13,4 +11,4 @@ (>-<) :: (a -> b) -> (b -> a) -> t a -> t b -- | Prefix version of '>-<' invmap :: (a -> b) -> (b -> a) -> t a -> t b- invmap f g x = f >-< g $ x+ invmap f g x = (f >-< g) x
Pandora/Pattern/Functor/Traversable.hs view
@@ -1,7 +1,6 @@ module Pandora.Pattern.Functor.Traversable where import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category (identity, (.)) import Pandora.Pattern.Functor.Covariant (Covariant) import Pandora.Pattern.Functor.Applicative (Applicative) import Pandora.Pattern.Functor.Pointable (Pointable)@@ -17,7 +16,7 @@ > * Preserving apply: f (x <*> y) ≡ f x <*> f y -} -infixl 3 ->>, ->>>, ->>>>, ->>>>>+infixl 5 ->>, ->>>, ->>>>, ->>>>> class Covariant t => Traversable t where {-# MINIMAL (->>) #-}@@ -29,15 +28,15 @@ traverse f t = t ->> f -- | The dual of 'distribute' sequence :: (Pointable u, Applicative u) => t :. u := a -> u :. t := a- sequence t = t ->> identity+ sequence t = t ->> (\x -> x) -- | 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+ x ->>> f = x ->> (->> f) (->>>>) :: (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+ x ->>>> f = x ->> (->> (->> f)) (->>>>>) :: (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+ x ->>>>> f = x ->> (->> (->> (->> f)))
Pandora/Pattern/Object/Setoid.hs view
@@ -1,6 +1,5 @@ module Pandora.Pattern.Object.Setoid (Setoid (..)) where -import Pandora.Pattern.Category (($)) import Pandora.Paradigm.Primary.Object.Boolean (Boolean (False, True), (?)) infix 4 ==, !=@@ -18,4 +17,4 @@ (==) :: a -> a -> Boolean (!=) :: a -> a -> Boolean- (!=) x y = x == y ? False $ True+ (!=) x y = (x == y ? False) True
pandora.cabal view
@@ -1,5 +1,5 @@ name: pandora-version: 0.3.7+version: 0.3.8 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@@ -99,7 +99,6 @@ Pandora.Paradigm.Structure.Ability.Deletable Pandora.Paradigm.Structure.Ability.Accessible Pandora.Paradigm.Structure.Ability.Focusable- Pandora.Paradigm.Structure.Ability.Insertable Pandora.Paradigm.Structure.Ability.Measurable Pandora.Paradigm.Structure.Ability.Substructure Pandora.Paradigm.Structure.Ability.Nonempty@@ -112,9 +111,10 @@ Pandora.Paradigm.Structure.Interface Pandora.Paradigm.Structure.Interface.Set Pandora.Paradigm.Structure.Interface.Dictionary+ Pandora.Paradigm.Structure.Interface.Stack Pandora.Paradigm.Structure.Some Pandora.Paradigm.Structure.Some.Stream- Pandora.Paradigm.Structure.Some.Stack+ Pandora.Paradigm.Structure.Some.List Pandora.Paradigm.Structure.Some.Binary Pandora.Paradigm.Structure.Some.Splay Pandora.Paradigm.Structure.Some.Rose