pandora 0.2.7 → 0.2.8
raw patch · 40 files changed
+421/−184 lines, 40 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Pandora.Paradigm.Primary.Functor.Variation: That :: e -> Variation e a
- Pandora.Paradigm.Primary.Functor.Variation: These :: e -> a -> Variation e a
- Pandora.Paradigm.Primary.Functor.Variation: This :: a -> Variation e a
- Pandora.Paradigm.Primary.Functor.Variation: data Variation e a
- Pandora.Paradigm.Primary.Functor.Variation: instance Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Functor.Variation.Variation e)
- Pandora.Paradigm.Primary.Functor.Variation: instance Pandora.Pattern.Functor.Pointable.Pointable (Pandora.Paradigm.Primary.Functor.Variation.Variation e)
- Pandora.Paradigm.Primary.Functor.Variation: instance Pandora.Pattern.Functor.Traversable.Traversable (Pandora.Paradigm.Primary.Functor.Variation.Variation e)
- Pandora.Paradigm.Primary.Functor.Variation: variation :: (a -> r) -> (e -> r) -> (e -> a -> r) -> Variation e a -> r
- Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Variation.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Left (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
- Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Variation.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Left Pandora.Paradigm.Structure.Binary.Binary
- Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Variation.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Right (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
- Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Variation.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Right Pandora.Paradigm.Structure.Binary.Binary
- Pandora.Paradigm.Structure.Stack: top :: Stack a :-. Maybe a
- Pandora.Paradigm.Structure.Variation.Nonempty: type family Nonempty (s :: * -> *) = (r :: * -> *) | r -> s
- Pandora.Paradigm.Structure.Variation.Substructure: class Substructure f t where {
- Pandora.Paradigm.Structure.Variation.Substructure: sub :: Substructure f t => t a :-. Tagged f (Output f t a)
- Pandora.Paradigm.Structure.Variation.Substructure: type family Output (f :: * -> k) (t :: * -> *) a;
- Pandora.Paradigm.Structure.Variation.Substructure: }
- Pandora.Pattern.Object.Chain: Equal :: Ordering
- Pandora.Pattern.Object.Chain: Greater :: Ordering
- Pandora.Pattern.Object.Chain: Less :: Ordering
- Pandora.Pattern.Object.Chain: data Ordering
- Pandora.Pattern.Object.Chain: instance Pandora.Pattern.Object.Chain.Chain Pandora.Pattern.Object.Chain.Ordering
- Pandora.Pattern.Object.Chain: instance Pandora.Pattern.Object.Setoid.Setoid Pandora.Pattern.Object.Chain.Ordering
- Pandora.Pattern.Object.Chain: order :: a -> a -> a -> Ordering -> a
- Pandora.Pattern.Object.Setoid: (?) :: Boolean -> a -> a -> a
- Pandora.Pattern.Object.Setoid: False :: Boolean
- Pandora.Pattern.Object.Setoid: True :: Boolean
- Pandora.Pattern.Object.Setoid: bool :: a -> a -> Boolean -> a
- Pandora.Pattern.Object.Setoid: data Boolean
- Pandora.Pattern.Object.Setoid: infixr 1 ?
- Pandora.Pattern.Object.Setoid: instance Pandora.Pattern.Object.Group.Group Pandora.Pattern.Object.Setoid.Boolean
- Pandora.Pattern.Object.Setoid: instance Pandora.Pattern.Object.Monoid.Monoid Pandora.Pattern.Object.Setoid.Boolean
- Pandora.Pattern.Object.Setoid: instance Pandora.Pattern.Object.Quasiring.Quasiring Pandora.Pattern.Object.Setoid.Boolean
- Pandora.Pattern.Object.Setoid: instance Pandora.Pattern.Object.Ringoid.Ringoid Pandora.Pattern.Object.Setoid.Boolean
- Pandora.Pattern.Object.Setoid: instance Pandora.Pattern.Object.Semigroup.Semigroup Pandora.Pattern.Object.Setoid.Boolean
- Pandora.Pattern.Object.Setoid: instance Pandora.Pattern.Object.Setoid.Setoid Pandora.Pattern.Object.Setoid.Boolean
+ Pandora.Paradigm.Primary.Functor: here :: Wedge e a -> Maybe e
+ Pandora.Paradigm.Primary.Functor: there :: Wedge e ~> Maybe
+ Pandora.Paradigm.Primary.Functor.Delta: (:^:) :: a -> a -> Delta a
+ Pandora.Paradigm.Primary.Functor.Delta: data Delta a
+ Pandora.Paradigm.Primary.Functor.Delta: instance Pandora.Pattern.Functor.Applicative.Applicative Pandora.Paradigm.Primary.Functor.Delta.Delta
+ Pandora.Paradigm.Primary.Functor.Delta: instance Pandora.Pattern.Functor.Covariant.Covariant Pandora.Paradigm.Primary.Functor.Delta.Delta
+ Pandora.Paradigm.Primary.Functor.Delta: instance Pandora.Pattern.Functor.Pointable.Pointable Pandora.Paradigm.Primary.Functor.Delta.Delta
+ Pandora.Paradigm.Primary.Functor.Delta: instance Pandora.Pattern.Functor.Representable.Representable Pandora.Paradigm.Primary.Functor.Delta.Delta
+ Pandora.Paradigm.Primary.Functor.Delta: instance Pandora.Pattern.Functor.Traversable.Traversable Pandora.Paradigm.Primary.Functor.Delta.Delta
+ Pandora.Paradigm.Primary.Functor.Delta: type (:^:) = Delta
+ Pandora.Paradigm.Primary.Functor.Identity: instance Pandora.Pattern.Functor.Representable.Representable Pandora.Paradigm.Primary.Functor.Identity.Identity
+ Pandora.Paradigm.Primary.Functor.These: That :: e -> These e a
+ Pandora.Paradigm.Primary.Functor.These: These :: e -> a -> These e a
+ Pandora.Paradigm.Primary.Functor.These: This :: a -> These e a
+ Pandora.Paradigm.Primary.Functor.These: data These e a
+ Pandora.Paradigm.Primary.Functor.These: instance Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Functor.These.These e)
+ Pandora.Paradigm.Primary.Functor.These: instance Pandora.Pattern.Functor.Pointable.Pointable (Pandora.Paradigm.Primary.Functor.These.These e)
+ Pandora.Paradigm.Primary.Functor.These: instance Pandora.Pattern.Functor.Traversable.Traversable (Pandora.Paradigm.Primary.Functor.These.These e)
+ Pandora.Paradigm.Primary.Functor.These: these :: (a -> r) -> (e -> r) -> (e -> a -> r) -> These e a -> r
+ Pandora.Paradigm.Primary.Functor.Wedge: Here :: e -> Wedge e a
+ Pandora.Paradigm.Primary.Functor.Wedge: Nowhere :: Wedge e a
+ Pandora.Paradigm.Primary.Functor.Wedge: There :: a -> Wedge e a
+ Pandora.Paradigm.Primary.Functor.Wedge: data Wedge e a
+ Pandora.Paradigm.Primary.Functor.Wedge: instance Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Functor.Wedge.Wedge e)
+ Pandora.Paradigm.Primary.Functor.Wedge: instance Pandora.Pattern.Functor.Pointable.Pointable (Pandora.Paradigm.Primary.Functor.Wedge.Wedge e)
+ Pandora.Paradigm.Primary.Functor.Wedge: instance Pandora.Pattern.Functor.Traversable.Traversable (Pandora.Paradigm.Primary.Functor.Wedge.Wedge e)
+ Pandora.Paradigm.Primary.Functor.Wedge: wedge :: (e -> r) -> (a -> r) -> r -> Wedge e a -> r
+ Pandora.Paradigm.Primary.Object.Boolean: (?) :: Boolean -> a -> a -> a
+ Pandora.Paradigm.Primary.Object.Boolean: False :: Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: True :: Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: bool :: a -> a -> Boolean -> a
+ Pandora.Paradigm.Primary.Object.Boolean: data Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: infixr 1 ?
+ Pandora.Paradigm.Primary.Object.Boolean: instance Pandora.Pattern.Object.Group.Group Pandora.Paradigm.Primary.Object.Boolean.Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: instance Pandora.Pattern.Object.Monoid.Monoid Pandora.Paradigm.Primary.Object.Boolean.Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: instance Pandora.Pattern.Object.Quasiring.Quasiring Pandora.Paradigm.Primary.Object.Boolean.Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: instance Pandora.Pattern.Object.Ringoid.Ringoid Pandora.Paradigm.Primary.Object.Boolean.Boolean
+ Pandora.Paradigm.Primary.Object.Boolean: instance Pandora.Pattern.Object.Semigroup.Semigroup Pandora.Paradigm.Primary.Object.Boolean.Boolean
+ Pandora.Paradigm.Primary.Object.Ordering: Equal :: Ordering
+ Pandora.Paradigm.Primary.Object.Ordering: Greater :: Ordering
+ Pandora.Paradigm.Primary.Object.Ordering: Less :: Ordering
+ Pandora.Paradigm.Primary.Object.Ordering: data Ordering
+ Pandora.Paradigm.Primary.Object.Ordering: order :: a -> a -> a -> Ordering -> a
+ Pandora.Paradigm.Primary.Transformer.Construction: instance Pandora.Pattern.Transformer.Hoistable.Hoistable Pandora.Paradigm.Primary.Transformer.Construction.Construction
+ Pandora.Paradigm.Primary.Transformer.Outline: [Line] :: a -> Outline t a
+ Pandora.Paradigm.Primary.Transformer.Outline: [Outlined] :: t a -> Outline t (a -> b) -> Outline t b
+ Pandora.Paradigm.Primary.Transformer.Outline: data Outline t a
+ Pandora.Paradigm.Primary.Transformer.Outline: instance (Pandora.Pattern.Functor.Pointable.Pointable t, Pandora.Pattern.Functor.Applicative.Applicative t) => Pandora.Paradigm.Controlflow.Joint.Interpreted.Interpreted (Pandora.Paradigm.Primary.Transformer.Outline.Outline t)
+ Pandora.Paradigm.Primary.Transformer.Outline: instance Pandora.Pattern.Functor.Applicative.Applicative (Pandora.Paradigm.Primary.Transformer.Outline.Outline f)
+ Pandora.Paradigm.Primary.Transformer.Outline: instance Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Transformer.Outline.Outline t)
+ Pandora.Paradigm.Primary.Transformer.Outline: instance Pandora.Pattern.Functor.Extractable.Extractable t => Pandora.Pattern.Functor.Extractable.Extractable (Pandora.Paradigm.Primary.Transformer.Outline.Outline t)
+ Pandora.Paradigm.Primary.Transformer.Outline: instance Pandora.Pattern.Functor.Pointable.Pointable (Pandora.Paradigm.Primary.Transformer.Outline.Outline t)
+ Pandora.Paradigm.Primary.Transformer.Outline: instance Pandora.Pattern.Transformer.Hoistable.Hoistable Pandora.Paradigm.Primary.Transformer.Outline.Outline
+ Pandora.Paradigm.Primary.Transformer.Outline: instance Pandora.Pattern.Transformer.Liftable.Liftable Pandora.Paradigm.Primary.Transformer.Outline.Outline
+ Pandora.Paradigm.Structure.Ability.Focusable: class Focusable t where {
+ Pandora.Paradigm.Structure.Ability.Focusable: singleton :: Focusable t => a |-> t
+ Pandora.Paradigm.Structure.Ability.Focusable: top :: Focusable t => t a :-. Focus t a
+ Pandora.Paradigm.Structure.Ability.Focusable: type family Focus (t :: * -> *) a;
+ Pandora.Paradigm.Structure.Ability.Focusable: }
+ Pandora.Paradigm.Structure.Ability.Nonempty: type family Nonempty (s :: * -> *) = (r :: * -> *) | r -> s
+ Pandora.Paradigm.Structure.Ability.Substructure: class Substructure f t where {
+ Pandora.Paradigm.Structure.Ability.Substructure: sub :: Substructure f t => t a :-. Tagged f (Substructural f t a)
+ Pandora.Paradigm.Structure.Ability.Substructure: type family Substructural (f :: * -> k) (t :: * -> *) a;
+ Pandora.Paradigm.Structure.Ability.Substructure: }
+ Pandora.Paradigm.Structure.Binary: instance (forall a. Pandora.Pattern.Object.Chain.Chain a) => Pandora.Paradigm.Structure.Ability.Focusable.Focusable Pandora.Paradigm.Structure.Binary.Binary
+ Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
+ Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Left (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
+ Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Left Pandora.Paradigm.Structure.Binary.Binary
+ Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Right (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Wye.Wye)
+ Pandora.Paradigm.Structure.Binary: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Wye.Right Pandora.Paradigm.Structure.Binary.Binary
+ Pandora.Paradigm.Structure.Rose: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Stack.Stack)
+ Pandora.Paradigm.Structure.Rose: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable Pandora.Paradigm.Structure.Rose.Rose
+ Pandora.Paradigm.Structure.Rose: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Maybe.Just (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Structure.Stack.Stack)
+ Pandora.Paradigm.Structure.Rose: instance Pandora.Paradigm.Structure.Ability.Substructure.Substructure 'Pandora.Paradigm.Primary.Functor.Maybe.Just Pandora.Paradigm.Structure.Rose.Rose
+ Pandora.Paradigm.Structure.Stack: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)
+ Pandora.Paradigm.Structure.Stack: instance Pandora.Paradigm.Structure.Ability.Focusable.Focusable Pandora.Paradigm.Structure.Stack.Stack
+ Pandora.Pattern.Functor.Bindable: ($>>=) :: (Bindable t, Covariant u) => (a -> t b) -> ((u :. t) := a) -> (u :. t) := b
+ Pandora.Pattern.Functor.Bindable: (>>=$) :: Bindable t => (t b -> c) -> (a -> t b) -> t a -> c
- Pandora.Paradigm.Primary.Functor: that :: Variation e a -> Maybe e
+ Pandora.Paradigm.Primary.Functor: that :: These e a -> Maybe e
- Pandora.Paradigm.Primary.Functor: this :: Variation e ~> Maybe
+ Pandora.Paradigm.Primary.Functor: this :: These e ~> Maybe
- Pandora.Pattern.Transformer.Hoistable: hoist :: Hoistable t => (u ~> v) -> t u ~> t v
+ Pandora.Pattern.Transformer.Hoistable: hoist :: (Hoistable t, Covariant u) => (u ~> v) -> t u ~> t v
Files
- CHANGELOG.md +14/−0
- Pandora/Paradigm/Inventory/State.hs +1/−1
- Pandora/Paradigm/Primary.hs +2/−1
- Pandora/Paradigm/Primary/Functor.hs +16/−4
- Pandora/Paradigm/Primary/Functor/Conclusion.hs +10/−8
- Pandora/Paradigm/Primary/Functor/Delta.hs +30/−0
- Pandora/Paradigm/Primary/Functor/Identity.hs +6/−0
- Pandora/Paradigm/Primary/Functor/Maybe.hs +9/−7
- Pandora/Paradigm/Primary/Functor/Predicate.hs +1/−1
- Pandora/Paradigm/Primary/Functor/These.hs +26/−0
- Pandora/Paradigm/Primary/Functor/Validation.hs +5/−3
- Pandora/Paradigm/Primary/Functor/Variation.hs +0/−26
- Pandora/Paradigm/Primary/Functor/Wedge.hs +26/−0
- Pandora/Paradigm/Primary/Object.hs +4/−0
- Pandora/Paradigm/Primary/Object/Boolean.hs +37/−0
- Pandora/Paradigm/Primary/Object/Ordering.hs +8/−0
- Pandora/Paradigm/Primary/Transformer.hs +1/−0
- Pandora/Paradigm/Primary/Transformer/Construction.hs +4/−0
- Pandora/Paradigm/Primary/Transformer/Jack.hs +4/−2
- Pandora/Paradigm/Primary/Transformer/Outline.hs +43/−0
- Pandora/Paradigm/Structure.hs +2/−2
- Pandora/Paradigm/Structure/Ability.hs +5/−0
- Pandora/Paradigm/Structure/Ability/Focusable.hs +9/−0
- Pandora/Paradigm/Structure/Ability/Nonempty.hs +4/−0
- Pandora/Paradigm/Structure/Ability/Substructure.hs +8/−0
- Pandora/Paradigm/Structure/Binary.hs +51/−29
- Pandora/Paradigm/Structure/Rose.hs +42/−4
- Pandora/Paradigm/Structure/Stack.hs +19/−11
- Pandora/Paradigm/Structure/Variation/Nonempty.hs +0/−4
- Pandora/Paradigm/Structure/Variation/Substructure.hs +0/−8
- Pandora/Pattern/Functor/Avoidable.hs +1/−0
- Pandora/Pattern/Functor/Bindable.hs +7/−1
- Pandora/Pattern/Functor/Determinable.hs +1/−0
- Pandora/Pattern/Functor/Distributive.hs +1/−0
- Pandora/Pattern/Functor/Extractable.hs +1/−0
- Pandora/Pattern/Functor/Pointable.hs +1/−0
- Pandora/Pattern/Object/Chain.hs +4/−26
- Pandora/Pattern/Object/Setoid.hs +3/−40
- Pandora/Pattern/Transformer/Hoistable.hs +2/−1
- pandora.cabal +13/−5
CHANGELOG.md view
@@ -216,3 +216,17 @@ * Replace `UT` joint scheme with `TU` in data structures * Change `sub` method of `Substructure` - it always returns `Tagged` value * Rename `Construction` constructor of `Construction` to `Construct`++# 0.2.8+* Define `Outline` free applicative transformer+* Define `Delta` datatype+* Define `Wedge` datatype+* Rename `Variation` to `These`+* Define two experimental methods in `Bindable` class - `$>>=` and `>>=$`+* Define `here` and `there` methods from `Wedge` to `Maybe`+* Move `Boolean` definition to its own module+* Move `Ordering` definition to its own module+* Rename `Variation` submodule to `Ability` and create umbrella-module+* Define `Focusable` typeclass for getting root and creating singleton+* Replace `top` method of `Stack` structure with `Focusable` instance+* Add `Covariant` constraint on `natural transformation` in `Hoistable` typeclass
Pandora/Paradigm/Inventory/State.hs view
@@ -16,12 +16,12 @@ import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Adjoint ((|-)) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (bool) import Pandora.Paradigm.Controlflow.Joint.Adaptable (Adaptable (adapt)) import Pandora.Paradigm.Controlflow.Joint.Interpreted (Interpreted (Primary, run)) import Pandora.Paradigm.Controlflow.Joint.Transformer.Monadic (Monadic (lay, wrap), (:>) (TM)) import Pandora.Paradigm.Controlflow.Joint.Schematic (Schematic) import Pandora.Paradigm.Controlflow.Joint.Schemes.TUT (TUT (TUT))+import Pandora.Paradigm.Primary.Object.Boolean (bool) import Pandora.Paradigm.Primary.Functor.Predicate (Predicate (predicate)) import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:), delta)
Pandora/Paradigm/Primary.hs view
@@ -1,4 +1,5 @@ module Pandora.Paradigm.Primary (module Exports) where -import Pandora.Paradigm.Primary.Functor as Exports import Pandora.Paradigm.Primary.Transformer as Exports+import Pandora.Paradigm.Primary.Functor as Exports+import Pandora.Paradigm.Primary.Object as Exports
Pandora/Paradigm/Primary/Functor.hs view
@@ -1,9 +1,10 @@-module Pandora.Paradigm.Primary.Functor (module Exports, note, hush, left, right, this, that) where+module Pandora.Paradigm.Primary.Functor (module Exports, note, hush, left, right, this, that, here, there) where import Pandora.Paradigm.Primary.Functor.Fix as Exports import Pandora.Paradigm.Primary.Functor.Predicate as Exports-import Pandora.Paradigm.Primary.Functor.Variation as Exports+import Pandora.Paradigm.Primary.Functor.These as Exports import Pandora.Paradigm.Primary.Functor.Validation as Exports+import Pandora.Paradigm.Primary.Functor.Wedge as Exports import Pandora.Paradigm.Primary.Functor.Wye as Exports import Pandora.Paradigm.Primary.Functor.Edges as Exports import Pandora.Paradigm.Primary.Functor.Conclusion as Exports@@ -12,6 +13,7 @@ import Pandora.Paradigm.Primary.Functor.Proxy as Exports import Pandora.Paradigm.Primary.Functor.Tagged as Exports import Pandora.Paradigm.Primary.Functor.Product as Exports+import Pandora.Paradigm.Primary.Functor.Delta as Exports import Pandora.Paradigm.Primary.Functor.Constant as Exports import Pandora.Paradigm.Primary.Functor.Identity as Exports @@ -36,12 +38,22 @@ right (Right rs) = Just rs right End = Nothing -this :: Variation e ~> Maybe+this :: These e ~> Maybe this (This x) = Just x this (That _) = Nothing this (These _ x) = Just x -that :: Variation e a -> Maybe e+that :: These e a -> Maybe e that (This _) = Nothing that (That x) = Just x that (These y _) = Just y++here :: Wedge e a -> Maybe e+here Nowhere = Nothing+here (Here x) = Just x+here (There _) = Nothing++there :: Wedge e ~> Maybe+there Nowhere = Nothing+there (Here _) = Nothing+there (There x) = Just x
Pandora/Paradigm/Primary/Functor/Conclusion.hs view
@@ -2,11 +2,6 @@ import Pandora.Core.Functor (type (~>)) import Pandora.Pattern.Category ((.))-import Pandora.Paradigm.Controlflow.Joint.Interpreted (Interpreted (Primary, run))-import Pandora.Paradigm.Controlflow.Joint.Transformer.Monadic (Monadic (lay, wrap), (:>) (TM))-import Pandora.Paradigm.Controlflow.Joint.Schematic (Schematic)-import Pandora.Paradigm.Controlflow.Joint.Adaptable (Adaptable (adapt))-import Pandora.Paradigm.Controlflow.Joint.Schemes.UT (UT (UT)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>))) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Alternative (Alternative ((<+>)))@@ -16,9 +11,16 @@ import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Bivariant (Bivariant ((<->))) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (False))-import Pandora.Pattern.Object.Chain (Chain ((<=>)), Ordering (Less, Greater))+import Pandora.Pattern.Object.Setoid (Setoid ((==)))+import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (False))+import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Greater))+import Pandora.Paradigm.Controlflow.Joint.Interpreted (Interpreted (Primary, run))+import Pandora.Paradigm.Controlflow.Joint.Transformer.Monadic (Monadic (lay, wrap), (:>) (TM))+import Pandora.Paradigm.Controlflow.Joint.Schematic (Schematic)+import Pandora.Paradigm.Controlflow.Joint.Adaptable (Adaptable (adapt))+import Pandora.Paradigm.Controlflow.Joint.Schemes.UT (UT (UT)) data Conclusion e a = Failure e | Success a @@ -48,7 +50,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/Delta.hs view
@@ -0,0 +1,30 @@+module Pandora.Paradigm.Primary.Functor.Delta (Delta (..), type (:^:)) where++import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Pattern.Functor.Representable (Representable (Representation, (<#>), tabulate))+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False))++data Delta a = a :^: a++type (:^:) = Delta++instance Covariant Delta where+ f <$> x :^: y = f x :^: f y++instance Pointable Delta where+ point x = x :^: x++instance Applicative Delta where+ f :^: g <*> x :^: y = f x :^: g y++instance Traversable Delta where+ x :^: y ->> f = (:^:) <$> f x <*> f y++instance Representable Delta where+ type Representation Delta = Boolean+ True <#> (x :^: _) = x+ False <#> (_ :^: y) = y+ tabulate f = f True :^: f False
Pandora/Paradigm/Primary/Functor/Identity.hs view
@@ -11,6 +11,7 @@ import Pandora.Pattern.Functor.Extendable (Extendable ((=>>))) import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Comonad (Comonad)+import Pandora.Pattern.Functor.Representable (Representable (Representation, (<#>), tabulate)) import Pandora.Pattern.Functor.Adjoint (Adjoint ((-|), (|-))) import Pandora.Pattern.Functor.Divariant (($)) import Pandora.Pattern.Object.Setoid (Setoid ((==)))@@ -52,6 +53,11 @@ x =>> f = Identity . f $ x instance Comonad Identity++instance Representable Identity where+ type Representation Identity = ()+ () <#> Identity x = x+ tabulate f = Identity $ f () instance Adjoint Identity Identity where x -| f = Identity . f . Identity $ x
Pandora/Paradigm/Primary/Functor/Maybe.hs view
@@ -1,10 +1,5 @@ module Pandora.Paradigm.Primary.Functor.Maybe (Maybe (..), Optional, maybe, nothing) where -import Pandora.Paradigm.Controlflow.Joint.Interpreted (Interpreted (Primary, run))-import Pandora.Paradigm.Controlflow.Joint.Transformer.Monadic (Monadic (lay, wrap), (:>) (TM))-import Pandora.Paradigm.Controlflow.Joint.Schematic (Schematic)-import Pandora.Paradigm.Controlflow.Joint.Adaptable (Adaptable (adapt))-import Pandora.Paradigm.Controlflow.Joint.Schemes.UT (UT (UT)) import Pandora.Pattern.Category ((.)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), (<$$>))) import Pandora.Pattern.Functor.Avoidable (Avoidable (empty))@@ -15,12 +10,19 @@ import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (True, False))-import Pandora.Pattern.Object.Chain (Chain ((<=>)), Ordering (Less, Equal, Greater))+import Pandora.Pattern.Object.Setoid (Setoid ((==)))+import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+))) import Pandora.Pattern.Object.Monoid (Monoid (zero)) import Pandora.Pattern.Object.Semilattice (Infimum ((/\)), Supremum ((\/))) import Pandora.Pattern.Object.Lattice (Lattice)+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False))+import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Equal, Greater))+import Pandora.Paradigm.Controlflow.Joint.Interpreted (Interpreted (Primary, run))+import Pandora.Paradigm.Controlflow.Joint.Transformer.Monadic (Monadic (lay, wrap), (:>) (TM))+import Pandora.Paradigm.Controlflow.Joint.Schematic (Schematic)+import Pandora.Paradigm.Controlflow.Joint.Adaptable (Adaptable (adapt))+import Pandora.Paradigm.Controlflow.Joint.Schemes.UT (UT (UT)) data Maybe a = Nothing | Just a
Pandora/Paradigm/Primary/Functor/Predicate.hs view
@@ -5,7 +5,7 @@ import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<))) import Pandora.Pattern.Functor.Determinable (Determinable (determine)) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (Boolean (True))+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True)) newtype Predicate a = Predicate { predicate :: a -> Boolean }
+ Pandora/Paradigm/Primary/Functor/These.hs view
@@ -0,0 +1,26 @@+module Pandora.Paradigm.Primary.Functor.These (These (..), these) where++import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Pattern.Functor.Divariant (($))++data These e a = This a | That e | These e a++instance Covariant (These e) where+ f <$> This x = This $ f x+ _ <$> That y = That y+ f <$> These y x = These y $ f x++instance Pointable (These e) where+ point = This++instance Traversable (These e) where+ This x ->> f = This <$> f x+ That y ->> _ = point $ That y+ These y x ->> f = These y <$> f x++these :: (a -> r) -> (e -> r) -> (e -> a -> r) -> These e a -> r+these f _ _ (This x) = f x+these _ g _ (That y) = g y+these _ _ h (These y x) = h y x
Pandora/Paradigm/Primary/Functor/Validation.hs view
@@ -8,9 +8,11 @@ import Pandora.Pattern.Functor.Traversable (Traversable ((->>))) import Pandora.Pattern.Functor.Bivariant (Bivariant ((<->))) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (False))-import Pandora.Pattern.Object.Chain (Chain ((<=>)), Ordering (Less, Greater))+import Pandora.Pattern.Object.Setoid (Setoid ((==)))+import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (False))+import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Greater)) data Validation e a = Flaws e | Validated a @@ -36,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/Variation.hs
@@ -1,26 +0,0 @@-module Pandora.Paradigm.Primary.Functor.Variation (Variation (..), variation) where--import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))-import Pandora.Pattern.Functor.Pointable (Pointable (point))-import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))-import Pandora.Pattern.Functor.Divariant (($))--data Variation e a = This a | That e | These e a--instance Covariant (Variation e) where- f <$> This x = This $ f x- _ <$> That y = That y- f <$> These y x = These y (f x)--instance Pointable (Variation e) where- point = This--instance Traversable (Variation e) where- This x ->> f = This <$> f x- That y ->> _ = point $ That y- These y x ->> f = These y <$> f x--variation :: (a -> r) -> (e -> r) -> (e -> a -> r) -> Variation e a -> r-variation f _ _ (This x) = f x-variation _ g _ (That y) = g y-variation _ _ h (These y x) = h y x
+ Pandora/Paradigm/Primary/Functor/Wedge.hs view
@@ -0,0 +1,26 @@+module Pandora.Paradigm.Primary.Functor.Wedge (Wedge (..), wedge) where++import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Pointable (Pointable (point))+import Pandora.Pattern.Functor.Traversable (Traversable ((->>)))+import Pandora.Pattern.Functor.Divariant (($))++data Wedge e a = Nowhere | Here e | There a++instance Covariant (Wedge e) where+ _ <$> Nowhere = Nowhere+ _ <$> Here x = Here x+ f <$> There x = There $ f x++instance Pointable (Wedge e) where+ point = There++instance Traversable (Wedge e) where+ Nowhere ->> _ = point Nowhere+ Here x ->> _ = point $ Here x+ There x ->> f = There <$> f x++wedge :: (e -> r) -> (a -> r) -> r -> Wedge e a -> r+wedge f _ _ (Here x) = f x+wedge _ g _ (There x) = g x+wedge _ _ r Nowhere = r
+ Pandora/Paradigm/Primary/Object.hs view
@@ -0,0 +1,4 @@+module Pandora.Paradigm.Primary.Object (module Exports) where++import Pandora.Paradigm.Primary.Object.Ordering as Exports+import Pandora.Paradigm.Primary.Object.Boolean as Exports
+ Pandora/Paradigm/Primary/Object/Boolean.hs view
@@ -0,0 +1,37 @@+module Pandora.Paradigm.Primary.Object.Boolean (Boolean (..), bool, (?)) where++import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Ringoid (Ringoid ((*)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Pattern.Object.Quasiring (Quasiring (one))+import Pandora.Pattern.Object.Group (Group (invert))++infixr 1 ?++data Boolean = True | False++bool :: a -> a -> Boolean -> a+bool x _ False = x+bool _ y True = y++(?) :: Boolean -> a -> a -> a+(?) True x _ = x+(?) False _ y = y++instance Semigroup Boolean where+ False + False = False+ _ + _ = True++instance Ringoid Boolean where+ True * True = True+ _ * _ = False++instance Monoid Boolean where+ zero = False++instance Quasiring Boolean where+ one = True++instance Group Boolean where+ invert False = True+ invert True = False
+ Pandora/Paradigm/Primary/Object/Ordering.hs view
@@ -0,0 +1,8 @@+module Pandora.Paradigm.Primary.Object.Ordering (Ordering (..), order) where++data Ordering = Less | Equal | Greater++order :: a -> a -> a -> Ordering -> a+order x _ _ Less = x+order _ y _ Equal = y+order _ _ z Greater = z
Pandora/Paradigm/Primary/Transformer.hs view
@@ -5,6 +5,7 @@ import Pandora.Paradigm.Primary.Transformer.Kan as Exports import Pandora.Paradigm.Primary.Transformer.Jet as Exports import Pandora.Paradigm.Primary.Transformer.Jack as Exports+import Pandora.Paradigm.Primary.Transformer.Outline as Exports import Pandora.Paradigm.Primary.Transformer.Instruction as Exports import Pandora.Paradigm.Primary.Transformer.Construction as Exports import Pandora.Paradigm.Primary.Transformer.Reverse as Exports
Pandora/Paradigm/Primary/Transformer/Construction.hs view
@@ -14,6 +14,7 @@ import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Comonad (Comonad) import Pandora.Pattern.Transformer.Lowerable (Lowerable (lower))+import Pandora.Pattern.Transformer.Hoistable (Hoistable (hoist)) import Pandora.Pattern.Functor.Divariant (($)) import Pandora.Pattern.Object.Setoid (Setoid ((==))) import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))@@ -50,6 +51,9 @@ instance Lowerable Construction where lower (Construct _ xs) = extract <$> xs++instance Hoistable Construction where+ hoist f (Construct x xs) = Construct x . f $ hoist f <$> xs instance (Setoid a, forall b . Setoid b => Setoid (t b)) => Setoid (Construction t a) where Construct x xs == Construct y ys = (x == y) * (xs == ys)
Pandora/Paradigm/Primary/Transformer/Jack.hs view
@@ -11,8 +11,10 @@ import Pandora.Pattern.Functor.Distributive (Distributive ((>>-), distribute)) import Pandora.Pattern.Transformer.Liftable (Liftable (lift)) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (False))-import Pandora.Pattern.Object.Chain (Chain ((<=>)), Ordering (Less, Greater))+import Pandora.Pattern.Object.Setoid (Setoid ((==)))+import Pandora.Pattern.Object.Chain (Chain ((<=>)))+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (False))+import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Greater)) data Jack t a = It a | Other (t a)
+ Pandora/Paradigm/Primary/Transformer/Outline.hs view
@@ -0,0 +1,43 @@+module Pandora.Paradigm.Primary.Transformer.Outline (Outline (..)) where++import Pandora.Core.Morphism ((%))+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))+import Pandora.Pattern.Functor.Applicative (Applicative ((<*>)))+import Pandora.Pattern.Functor.Divariant (($))+import Pandora.Pattern.Transformer.Liftable (Liftable (lift))+import Pandora.Pattern.Transformer.Hoistable (Hoistable (hoist))+import Pandora.Paradigm.Controlflow.Joint.Interpreted (Interpreted (Primary, run))++data Outline t a where+ Line :: a -> Outline t a+ Outlined :: t a -> Outline t (a -> b) -> Outline t b++instance Covariant (Outline t) where+ f <$> Line a = Line $ f a+ 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++instance Applicative (Outline f) where+ Line f <*> y = f <$> y+ 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)++instance (Pointable t, Applicative t) => Interpreted (Outline t) where+ type Primary (Outline t) a = t a+ run (Line x) = point x+ run (Outlined t f) = run f <*> t
Pandora/Paradigm/Structure.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Structure (module Exports) where -import Pandora.Paradigm.Structure.Variation.Substructure as Exports-import Pandora.Paradigm.Structure.Variation.Nonempty as Exports+import Pandora.Paradigm.Structure.Ability.Substructure as Exports+import Pandora.Paradigm.Structure.Ability.Nonempty as Exports import Pandora.Paradigm.Structure.Rose as Exports import Pandora.Paradigm.Structure.Binary as Exports import Pandora.Paradigm.Structure.Stack as Exports
+ Pandora/Paradigm/Structure/Ability.hs view
@@ -0,0 +1,5 @@+module Pandora.Paradigm.Structure.Ability (module Exports) where++import Pandora.Paradigm.Structure.Ability.Substructure as Exports+import Pandora.Paradigm.Structure.Ability.Focusable as Exports+import Pandora.Paradigm.Structure.Ability.Nonempty as Exports
+ Pandora/Paradigm/Structure/Ability/Focusable.hs view
@@ -0,0 +1,9 @@+module Pandora.Paradigm.Structure.Ability.Focusable (Focusable (..)) where++import Pandora.Core.Functor (type (|->))+import Pandora.Paradigm.Inventory.Optics (type (:-.))++class Focusable t where+ type Focus (t :: * -> *) a+ top :: t a :-. Focus t a+ singleton :: a |-> t
+ Pandora/Paradigm/Structure/Ability/Nonempty.hs view
@@ -0,0 +1,4 @@+module Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty) where++-- | Type synonymous for at least one element data structure+type family Nonempty (s :: * -> *) = (r :: * -> *) | r -> s
+ Pandora/Paradigm/Structure/Ability/Substructure.hs view
@@ -0,0 +1,8 @@+module Pandora.Paradigm.Structure.Ability.Substructure (Substructure (..)) where++import Pandora.Paradigm.Inventory.Optics (type (:-.))+import Pandora.Paradigm.Primary.Functor.Tagged (Tagged)++class Substructure f t where+ type Substructural (f :: * -> k) (t :: * -> *) a+ sub :: t a :-. Tagged f (Substructural f t a)
Pandora/Paradigm/Structure/Binary.hs view
@@ -2,23 +2,26 @@ module Pandora.Paradigm.Structure.Binary (Binary, insert) where +import Pandora.Core.Functor (type (:.), type (:=)) import Pandora.Core.Morphism ((&), (%), (!)) import Pandora.Pattern.Category ((.)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Chain (Chain ((<=>)), order)+import Pandora.Pattern.Object.Chain (Chain ((<=>)))+import Pandora.Paradigm.Primary.Object.Ordering (order) import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing), maybe) import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:))) 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))+import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct) import Pandora.Paradigm.Controlflow.Joint.Schemes.TU (TU (TU)) import Pandora.Paradigm.Controlflow.Joint.Interpreted (run) import Pandora.Paradigm.Inventory.Store (Store (Store)) import Pandora.Paradigm.Inventory.Optics ((%~))-import Pandora.Paradigm.Structure.Variation.Nonempty (Nonempty)-import Pandora.Paradigm.Structure.Variation.Substructure (Substructure (Output, sub))+import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty)+import Pandora.Paradigm.Structure.Ability.Focusable (Focusable (Focus, top, singleton))+import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, sub)) type Binary = TU Covariant Covariant Maybe (Construction Wye) @@ -28,8 +31,22 @@ (sub @Left %~ (insert x <$>) $ tree) tree (sub @Right %~ (insert x <$>) $ tree) +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)++instance (forall a . Chain a) => Focusable Binary where+ type Focus Binary a = Maybe a+ top (TU Nothing) = Store . (:*:) Nothing $ TU . (<$>) (Construct % End)+ top (TU (Just x)) = Store . (:*:) (Just $ extract x) $ maybe+ (TU . Just . rebalance $ deconstruct x)+ (TU . Just . Construct % deconstruct x)+ singleton = TU . Just . Construct % End+ instance Substructure Left Binary where- type Output Left Binary a = Binary a+ type Substructural Left Binary a = Binary a sub (TU Nothing) = Store $ (:*:) (Tag $ TU Nothing) $ (TU Nothing !) sub t@(TU (Just (Construct x End))) = Store $ (:*:) (Tag $ TU Nothing) $ maybe t (TU . Just . Construct x . Left) . run . extract@@ -41,35 +58,40 @@ maybe (TU (Just (Construct x (Right rst)))) (TU . Just . Construct x . Both % rst) . run . extract instance Substructure Right Binary where- type Output Right Binary a = Binary a- sub (TU Nothing) = Store $ Tag (TU Nothing) :*: (!) (TU Nothing)- sub t@(TU (Just (Construct x End))) = Store $ (:*:) (Tag $ TU Nothing) $- maybe t (TU . Just . Construct x . Right) . run . extract- sub t@(TU (Just (Construct x (Left lst)))) = Store $ (:*:) (Tag $ TU Nothing) $- maybe t (TU . Just . Construct x . Both lst) . run . extract- sub (TU (Just (Construct x (Right rst)))) = Store $ (:*:) (Tag . TU . Just $ rst) $- maybe (TU . Just . Construct x $ End) (TU . Just . Construct x . Right) . run . extract- sub (TU (Just (Construct x (Both lst rst)))) = Store $ (:*:) (Tag . TU . Just $ rst) $- maybe (TU (Just (Construct x (Left lst)))) (TU . Just . Construct x . Both lst) . run . extract+ type Substructural Right Binary a = Binary a+ sub (TU Nothing) = Store $ Tag (TU Nothing) :*: (TU Nothing !)+ sub t@(TU (Just (Construct x End))) = Store $ Tag (TU Nothing)+ :*: maybe t (TU . Just . Construct x . Right) . run . extract+ sub t@(TU (Just (Construct x (Left lst)))) = Store $ Tag (TU Nothing)+ :*: maybe t (TU . Just . Construct x . Both lst) . run . extract+ sub (TU (Just (Construct x (Right rst)))) = Store $ (Tag . TU . Just $ rst)+ :*: maybe (TU . Just . Construct x $ End) (TU . Just . Construct x . Right) . run . extract+ sub (TU (Just (Construct x (Both lst rst)))) = Store $ (Tag . TU . Just $ rst)+ :*: maybe (TU . Just . Construct x $ Left lst) (TU . Just . Construct x . Both lst) . run . extract type instance Nonempty Binary = Construction Wye +instance Focusable (Construction Wye) where+ type Focus (Construction Wye) a = a+ top (Construct x xs) = Store $ x :*: Construct % xs+ singleton = Construct % End+ instance Substructure Left (Construction Wye) where- type Output Left (Construction Wye) a = Maybe (Construction Wye a)+ type Substructural Left (Construction Wye) a = Maybe :. Construction Wye := a sub (Construct x End) = Store $ Tag Nothing :*: (Construct x End !)- sub (Construct x (Left lst)) = Store $ (:*:) (Tag . Just $ lst) $- maybe (Construct x End) (Construct x . Left) . extract- sub tree@(Construct x (Right rst)) = Store $ (:*:) (Tag Nothing) $- maybe tree (Construct x . Both % rst) . extract- sub (Construct x (Both lst rst)) = Store $ (:*:) (Tag . Just $ lst) $- maybe (Construct x $ Right rst) (Construct x . Both % rst) . extract+ sub (Construct x (Left lst)) = Store $ Tag (Just lst)+ :*: maybe (Construct x End) (Construct x . Left) . extract+ sub tree@(Construct x (Right rst)) = Store $ Tag Nothing+ :*: maybe tree (Construct x . Both % rst) . extract+ sub (Construct x (Both lst rst)) = Store $ Tag (Just lst)+ :*: maybe (Construct x $ Right rst) (Construct x . Both % rst) . extract instance Substructure Right (Construction Wye) where- type Output Right (Construction Wye) a = Maybe (Construction Wye a)+ type Substructural Right (Construction Wye) a = Maybe :. Construction Wye := a sub (Construct x End) = Store $ Tag Nothing :*: (Construct x End !)- sub tree@(Construct x (Left lst)) = Store $ (:*:) (Tag Nothing) $- maybe tree (Construct x . Both lst) . extract- sub (Construct x (Right rst)) = Store $ (:*:) (Tag . Just $ rst) $- maybe (Construct x End) (Construct x . Right) . extract- sub (Construct x (Both lst rst)) = Store $ (:*:) (Tag . Just $ rst) $- maybe (Construct x $ Left lst) (Construct x . Both lst) . extract+ sub tree@(Construct x (Left lst)) = Store $ Tag Nothing+ :*: maybe tree (Construct x . Both lst) . extract+ sub (Construct x (Right rst)) = Store $ Tag (Just rst)+ :*: maybe (Construct x End) (Construct x . Right) . extract+ sub (Construct x (Both lst rst)) = Store $ Tag (Just rst)+ :*: maybe (Construct x $ Left lst) (Construct x . Both lst) . extract
Pandora/Paradigm/Structure/Rose.hs view
@@ -1,9 +1,47 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}+ module Pandora.Paradigm.Structure.Rose (Rose) where -import Pandora.Pattern.Functor.Covariant (Covariant)-import Pandora.Paradigm.Primary.Functor.Maybe (Maybe)-import Pandora.Paradigm.Primary.Transformer.Construction (Construction)+import Pandora.Core.Functor (type (:.), type (:=))+import Pandora.Core.Morphism ((!), (%))+import Pandora.Pattern.Category ((.))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>)))+import Pandora.Pattern.Functor.Extractable (extract)+import Pandora.Pattern.Functor.Avoidable (Avoidable (empty))+import Pandora.Pattern.Functor.Divariant (($))+import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing), maybe)+import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)))+import Pandora.Paradigm.Primary.Functor.Tagged (Tagged (Tag))+import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct)+import Pandora.Paradigm.Controlflow.Joint.Schemes.TU (TU (TU))+import Pandora.Paradigm.Inventory.Store (Store (Store)) import Pandora.Paradigm.Structure.Stack (Stack)-import Pandora.Paradigm.Controlflow.Joint.Schemes.TU (TU)+import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty)+import Pandora.Paradigm.Structure.Ability.Focusable (Focusable (Focus, top, singleton))+import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, sub)) type Rose = TU Covariant Covariant Maybe (Construction Stack)++instance Focusable Rose where+ type Focus Rose a = Maybe a+ top (TU Nothing) = Store $ Nothing :*: TU . (<$>) (Construct % empty)+ top (TU (Just x)) = Store $ Just (extract x) :*: maybe+ (TU $ Just x) -- TODO: Nothing at top's lens - should it remove something?+ (TU . Just . Construct % deconstruct x)+ singleton = TU . Just . Construct % empty++instance Substructure Just Rose where+ type Substructural Just Rose a = Stack :. Construction Stack := a+ sub (TU Nothing) = Store $ Tag (TU Nothing) :*: (TU Nothing !)+ sub (TU (Just (Construct x xs))) = Store $ Tag xs :*: TU . Just . Construct x . extract++type instance Nonempty Rose = Construction Stack++instance Substructure Just (Construction Stack) where+ type Substructural Just (Construction Stack) a = Stack :. Construction Stack := a+ sub (Construct x xs) = Store $ Tag xs :*: Construct x . extract++instance Focusable (Construction Stack) where+ type Focus (Construction Stack) a = a+ top rose = Store $ extract rose :*: Construct % deconstruct rose+ singleton = Construct % empty
Pandora/Paradigm/Structure/Stack.hs view
@@ -1,9 +1,9 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} -module Pandora.Paradigm.Structure.Stack (Stack, push, top, pop, filter, linearize) where+module Pandora.Paradigm.Structure.Stack (Stack, push, pop, filter, linearize) where import Pandora.Core.Functor (type (~>))-import Pandora.Core.Morphism ((&))+import Pandora.Core.Morphism ((&), (%)) import Pandora.Pattern.Category ((.)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Alternative ((<+>))@@ -13,25 +13,24 @@ import Pandora.Pattern.Functor.Traversable (Traversable) import Pandora.Pattern.Functor.Bindable ((>>=)) import Pandora.Pattern.Functor.Divariant (($))-import Pandora.Pattern.Object.Setoid (Setoid ((==)), (?))+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 ((?)) import Pandora.Paradigm.Primary.Functor.Maybe (Maybe (Just, Nothing)) import Pandora.Paradigm.Primary.Functor.Predicate (Predicate (Predicate)) import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:))) import Pandora.Paradigm.Primary.Transformer.Construction (Construction (Construct), deconstruct) import Pandora.Paradigm.Inventory.State (fold) import Pandora.Paradigm.Inventory.Store (Store (Store))-import Pandora.Paradigm.Inventory.Optics (type (:-.)) import Pandora.Paradigm.Controlflow.Joint.Interpreted (run) import Pandora.Paradigm.Controlflow.Joint.Schemes.TU (TU (TU))-import Pandora.Paradigm.Structure.Variation.Nonempty (Nonempty)+import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty)+import Pandora.Paradigm.Structure.Ability.Focusable (Focusable (Focus, top, singleton)) -- | Linear data structure that serves as a collection of elements type Stack = TU Covariant Covariant Maybe (Construction Maybe) -type instance Nonempty Stack = Construction Maybe- instance Setoid a => Setoid (Stack a) where TU ls == TU rs = ls == rs @@ -43,10 +42,19 @@ instance Monoid (Stack a) where zero = TU Nothing -top :: Stack a :-. Maybe a-top stack = Store $ (:*:) (extract <$> run stack) $ \case- Just x -> stack & pop & push x- Nothing -> pop stack+instance Focusable Stack where+ type Focus Stack a = Maybe a+ top stack = Store $ (:*:) (extract <$> run stack) $ \case+ Just x -> stack & pop & push x+ Nothing -> pop stack+ singleton = TU . Just . Construct % Nothing++type instance Nonempty Stack = Construction Maybe++instance Focusable (Construction Maybe) where+ type Focus (Construction Maybe) a = a+ top stack = Store $ extract stack :*: Construct % deconstruct stack+ singleton = Construct % Nothing push :: a -> Stack a -> Stack a push x (TU stack) = TU $ (Construct x . Just <$> stack) <+> (point . point) x
− Pandora/Paradigm/Structure/Variation/Nonempty.hs
@@ -1,4 +0,0 @@-module Pandora.Paradigm.Structure.Variation.Nonempty (Nonempty) where---- | Type synonymous for at least one element data structure-type family Nonempty (s :: * -> *) = (r :: * -> *) | r -> s
− Pandora/Paradigm/Structure/Variation/Substructure.hs
@@ -1,8 +0,0 @@-module Pandora.Paradigm.Structure.Variation.Substructure (Substructure (..)) where--import Pandora.Paradigm.Inventory.Optics (type (:-.))-import Pandora.Paradigm.Primary.Functor.Tagged (Tagged)--class Substructure f t where- type Output (f :: * -> k) (t :: * -> *) a- sub :: t a :-. Tagged f (Output f t a)
Pandora/Pattern/Functor/Avoidable.hs view
@@ -9,4 +9,5 @@ -} class Alternative t => Avoidable t where+ {-# MINIMAL empty #-} empty :: t a
Pandora/Pattern/Functor/Bindable.hs view
@@ -3,7 +3,7 @@ import Pandora.Core.Functor (type (:.), type (:=)) import Pandora.Core.Morphism ((%)) import Pandora.Pattern.Category (identity)-import Pandora.Pattern.Functor.Covariant (Covariant)+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) infixl 1 >>= infixr 1 =<<, <=<, >=>@@ -33,6 +33,12 @@ -- | Right-to-left Kleisli composition (<=<) :: (b -> t c) -> (a -> t b) -> (a -> t c) (<=<) = (%) (>=>)++ -- | Experimental methods+ ($>>=) :: Covariant u => (a -> t b) -> u :. t := a -> u :. t := b+ f $>>= x = (>>= f) <$> x+ (>>=$) :: (t b -> c) -> (a -> t b) -> t a -> c+ f >>=$ g = f <$> (>>= g) instance Bindable ((->) e) where f >>= g = \x -> g (f x) x
Pandora/Pattern/Functor/Determinable.hs view
@@ -3,4 +3,5 @@ import Pandora.Pattern.Functor.Contravariant (Contravariant) class Contravariant t => Determinable t where+ {-# MINIMAL determine #-} determine :: t a
Pandora/Pattern/Functor/Distributive.hs view
@@ -4,6 +4,7 @@ import Pandora.Core.Morphism ((%)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Category (identity, (.))+ {- | > Let f :: Distributive g => (a -> g b)
Pandora/Pattern/Functor/Extractable.hs view
@@ -5,6 +5,7 @@ import Pandora.Pattern.Object.Monoid (Monoid (zero)) class Covariant t => Extractable t where+ {-# MINIMAL extract #-} extract :: a <-| t instance Monoid e => Extractable ((->) e) where
Pandora/Pattern/Functor/Pointable.hs view
@@ -5,6 +5,7 @@ import Pandora.Pattern.Functor.Covariant (Covariant) class Covariant t => Pointable t where+ {-# MINIMAL point #-} point :: a |-> t instance Pointable ((->) e) where
Pandora/Pattern/Object/Chain.hs view
@@ -1,6 +1,8 @@-module Pandora.Pattern.Object.Chain (Ordering (..), order, Chain (..)) where+module Pandora.Pattern.Object.Chain (Chain (..)) where -import Pandora.Pattern.Object.Setoid (Setoid ((==)), Boolean (True, False))+import Pandora.Pattern.Object.Setoid (Setoid)+import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False))+import Pandora.Paradigm.Primary.Object.Ordering (Ordering, order) {- | > When providing a new instance, you should ensure it satisfies the three laws:@@ -21,27 +23,3 @@ x > y = order False False True (x <=> y) (>=) :: a -> a -> Boolean x >= y = order False True True (x <=> y)--data Ordering = Less | Equal | Greater--order :: a -> a -> a -> Ordering -> a-order x _ _ Less = x-order _ y _ Equal = y-order _ _ z Greater = z--instance Setoid Ordering where- Less == Less = True- Equal == Equal = True- Greater == Greater = True- _ == _ = False--instance Chain Ordering where- Less <=> Less = Equal- Less <=> Equal = Less- Less <=> Greater = Less- Equal <=> Less = Greater- Equal <=> Equal = Equal- Equal <=> Greater = Less- Greater <=> Less = Greater- Greater <=> Equal = Greater- Greater <=> Greater = Equal
Pandora/Pattern/Object/Setoid.hs view
@@ -1,12 +1,8 @@-module Pandora.Pattern.Object.Setoid (Boolean (..), (?), bool, Setoid (..)) where+module Pandora.Pattern.Object.Setoid (Setoid (..)) where -import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))-import Pandora.Pattern.Object.Ringoid (Ringoid ((*)))-import Pandora.Pattern.Object.Monoid (Monoid (zero))-import Pandora.Pattern.Object.Quasiring (Quasiring (one))-import Pandora.Pattern.Object.Group (Group (invert))+import Pandora.Pattern.Object.Group (invert)+import Pandora.Paradigm.Primary.Object.Boolean (Boolean) -infixr 1 ? infix 4 ==, /= {- |@@ -23,36 +19,3 @@ (/=) :: a -> a -> Boolean (/=) x y = invert (x == y)--data Boolean = True | False--bool :: a -> a -> Boolean -> a-bool x _ False = x-bool _ y True = y--(?) :: Boolean -> a -> a -> a-(?) True x _ = x-(?) False _ y = y--instance Setoid Boolean where- True == True = True- False == False = True- _ == _ = False--instance Semigroup Boolean where- False + False = False- _ + _ = True--instance Ringoid Boolean where- True * True = True- _ * _ = False--instance Monoid Boolean where- zero = False--instance Quasiring Boolean where- one = True--instance Group Boolean where- invert False = True- invert True = False
Pandora/Pattern/Transformer/Hoistable.hs view
@@ -1,6 +1,7 @@ module Pandora.Pattern.Transformer.Hoistable (Hoistable (..)) where import Pandora.Core.Functor (type (~>))+import Pandora.Pattern.Functor.Covariant (Covariant) {- | > When providing a new instance, you should ensure it satisfies one law:@@ -9,4 +10,4 @@ -} class Hoistable t where- hoist :: u ~> v -> t u ~> t v+ hoist :: Covariant u => u ~> v -> t u ~> t v
pandora.cabal view
@@ -1,5 +1,5 @@ name: pandora-version: 0.2.7+version: 0.2.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@@ -26,10 +26,15 @@ Pandora.Paradigm -- Basic constructions+ Pandora.Paradigm.Primary+ Pandora.Paradigm.Primary.Object+ Pandora.Paradigm.Primary.Object.Boolean+ Pandora.Paradigm.Primary.Object.Ordering Pandora.Paradigm.Primary.Functor Pandora.Paradigm.Primary.Functor.Conclusion Pandora.Paradigm.Primary.Functor.Constant+ Pandora.Paradigm.Primary.Functor.Delta Pandora.Paradigm.Primary.Functor.Edges Pandora.Paradigm.Primary.Functor.Endo Pandora.Paradigm.Primary.Functor.Fix@@ -39,15 +44,17 @@ Pandora.Paradigm.Primary.Functor.Product Pandora.Paradigm.Primary.Functor.Proxy Pandora.Paradigm.Primary.Functor.Tagged+ Pandora.Paradigm.Primary.Functor.These Pandora.Paradigm.Primary.Functor.Validation- Pandora.Paradigm.Primary.Functor.Variation Pandora.Paradigm.Primary.Functor.Wye+ Pandora.Paradigm.Primary.Functor.Wedge Pandora.Paradigm.Primary.Transformer Pandora.Paradigm.Primary.Transformer.Backwards Pandora.Paradigm.Primary.Transformer.Reverse Pandora.Paradigm.Primary.Transformer.Continuation Pandora.Paradigm.Primary.Transformer.Construction Pandora.Paradigm.Primary.Transformer.Instruction+ Pandora.Paradigm.Primary.Transformer.Outline Pandora.Paradigm.Primary.Transformer.Jack Pandora.Paradigm.Primary.Transformer.Jet Pandora.Paradigm.Primary.Transformer.Kan@@ -85,8 +92,10 @@ Pandora.Paradigm.Structure.Stack Pandora.Paradigm.Structure.Binary Pandora.Paradigm.Structure.Rose- Pandora.Paradigm.Structure.Variation.Nonempty- Pandora.Paradigm.Structure.Variation.Substructure+ Pandora.Paradigm.Structure.Ability+ Pandora.Paradigm.Structure.Ability.Focusable+ Pandora.Paradigm.Structure.Ability.Nonempty+ Pandora.Paradigm.Structure.Ability.Substructure Pandora.Pattern -- Category typeclass@@ -125,7 +134,6 @@ Pandora.Pattern.Object.Semilattice Pandora.Pattern.Object.Semiring Pandora.Pattern.Object.Setoid- -- Pandora.Pattern.Object.Property.Boolean -- Typeclassess about object composition of functors Pandora.Pattern.Transformer Pandora.Pattern.Transformer.Hoistable