pandora 0.3.9 → 0.4.0
raw patch · 50 files changed
+376/−221 lines, 50 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Pandora.Paradigm.Controlflow.Effect.Adaptable: (<:=<<) :: (Adaptable t u, Bindable u) => (a -> t b) -> u a -> u b
- Pandora.Paradigm.Controlflow.Effect.Adaptable: (>>=:>) :: (Adaptable t u, Bindable u) => u a -> (a -> t b) -> u b
- Pandora.Paradigm.Controlflow.Effect.Adaptable: infixl 1 >>=:>
- Pandora.Paradigm.Controlflow.Effect.Adaptable: infixr 1 <:=<<
- Pandora.Paradigm.Primary.Functor.Product: infixr 1 :*:
- Pandora.Paradigm.Structure.Ability.Substructure: subplace :: Substructure f t => Substructural f t a -> t a -> t a
- Pandora.Paradigm.Structure.Ability.Substructure: substitute :: Substructure f t => (Substructural f t a -> Substructural f t a) -> t a -> t a
- Pandora.Paradigm.Structure.Ability.Substructure: subview :: Substructure f t => t ~> Substructural f t
- Pandora.Paradigm.Structure.Some.Binary: Down :: a -> Vertical a
- Pandora.Paradigm.Structure.Some.Binary: Up :: a -> Vertical a
- Pandora.Paradigm.Structure.Some.Binary: data Vertical a
- 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.Pattern.Category: (/) :: Category m => m ~~> m
- Pandora.Pattern.Category: infixl 1 /
- Pandora.Pattern.Category: infixr 8 .
- Pandora.Pattern.Object.Group: infixl 6 -
- Pandora.Pattern.Object.Ringoid: infixl 7 *
- Pandora.Pattern.Object.Semigroup: infixl 6 +
+ Pandora.Paradigm.Primary: instance Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Primary.Transformer.Flip.Flip (Pandora.Paradigm.Primary.Functor.Product.:*:) a)
+ Pandora.Paradigm.Primary: instance Pandora.Pattern.Functor.Extractable.Extractable (Pandora.Paradigm.Primary.Transformer.Flip.Flip (Pandora.Paradigm.Primary.Functor.Product.:*:) a)
+ Pandora.Paradigm.Primary.Functor.Function: instance Pandora.Pattern.Object.Ringoid.Ringoid r => Pandora.Pattern.Object.Ringoid.Ringoid (e -> r)
+ Pandora.Paradigm.Primary.Functor.Function: instance Pandora.Pattern.Object.Semigroup.Semigroup r => Pandora.Pattern.Object.Semigroup.Semigroup (e -> r)
+ Pandora.Paradigm.Primary.Functor.Product: infixr 0 :*:
+ Pandora.Paradigm.Primary.Linear.Matrix: Matrix :: Vector i (Vector j a) -> Matrix i j a
+ Pandora.Paradigm.Primary.Linear.Matrix: instance (Pandora.Pattern.Object.Monoid.Monoid a, Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Primary.Linear.Vector.Vector i a), Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Primary.Linear.Vector.Vector i (Pandora.Paradigm.Primary.Linear.Vector.Vector j a))) => Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Primary.Linear.Matrix.Matrix i j a)
+ Pandora.Paradigm.Primary.Linear.Matrix: instance (Pandora.Pattern.Object.Semigroup.Semigroup a, Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Linear.Vector.Vector i a), Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Linear.Vector.Vector i (Pandora.Paradigm.Primary.Linear.Vector.Vector j a))) => Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Linear.Matrix.Matrix i j a)
+ Pandora.Paradigm.Primary.Linear.Matrix: instance (Pandora.Pattern.Object.Setoid.Setoid a, Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Primary.Linear.Vector.Vector i a), Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Primary.Linear.Vector.Vector i (Pandora.Paradigm.Primary.Linear.Vector.Vector j a))) => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Primary.Linear.Matrix.Matrix i j a)
+ Pandora.Paradigm.Primary.Linear.Matrix: newtype Matrix i j a
+ Pandora.Paradigm.Primary.Linear.Vector: [Scalar] :: a -> Vector a a
+ Pandora.Paradigm.Primary.Linear.Vector: [Vector] :: a -> Vector r a -> Vector (a :*: r) a
+ Pandora.Paradigm.Primary.Linear.Vector: class Vectorize a r
+ Pandora.Paradigm.Primary.Linear.Vector: data Vector r a
+ Pandora.Paradigm.Primary.Linear.Vector: instance (Pandora.Pattern.Object.Group.Group a, Pandora.Pattern.Object.Group.Group r, Pandora.Pattern.Object.Group.Group (a Pandora.Paradigm.Primary.Functor.Product.:*: r), Pandora.Pattern.Object.Group.Group (Pandora.Paradigm.Primary.Linear.Vector.Vector r a)) => Pandora.Pattern.Object.Group.Group (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance (Pandora.Pattern.Object.Monoid.Monoid a, Pandora.Pattern.Object.Monoid.Monoid r, Pandora.Pattern.Object.Monoid.Monoid (a Pandora.Paradigm.Primary.Functor.Product.:*: r), Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Primary.Linear.Vector.Vector r a)) => Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance (Pandora.Pattern.Object.Quasiring.Quasiring a, Pandora.Pattern.Object.Quasiring.Quasiring r, Pandora.Pattern.Object.Quasiring.Quasiring (a Pandora.Paradigm.Primary.Functor.Product.:*: r), Pandora.Pattern.Object.Quasiring.Quasiring (Pandora.Paradigm.Primary.Linear.Vector.Vector r a)) => Pandora.Pattern.Object.Quasiring.Quasiring (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance (Pandora.Pattern.Object.Ringoid.Ringoid a, Pandora.Pattern.Object.Ringoid.Ringoid r, Pandora.Pattern.Object.Ringoid.Ringoid (a Pandora.Paradigm.Primary.Functor.Product.:*: r), Pandora.Pattern.Object.Ringoid.Ringoid (Pandora.Paradigm.Primary.Linear.Vector.Vector r a)) => Pandora.Pattern.Object.Ringoid.Ringoid (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance (Pandora.Pattern.Object.Semigroup.Semigroup a, Pandora.Pattern.Object.Semigroup.Semigroup r, Pandora.Pattern.Object.Semigroup.Semigroup (a Pandora.Paradigm.Primary.Functor.Product.:*: r), Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Linear.Vector.Vector r a)) => Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance (Pandora.Pattern.Object.Setoid.Setoid a, Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Primary.Linear.Vector.Vector r a)) => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Paradigm.Primary.Linear.Vector.Vectorize a a
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Paradigm.Primary.Linear.Vector.Vectorize a r => Pandora.Paradigm.Primary.Linear.Vector.Vectorize a (a Pandora.Paradigm.Primary.Functor.Product.:*: r)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a (Pandora.Paradigm.Primary.Linear.Vector.Vector r a) => Pandora.Paradigm.Structure.Ability.Monotonic.Monotonic a (Pandora.Paradigm.Primary.Linear.Vector.Vector (a Pandora.Paradigm.Primary.Functor.Product.:*: r) a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Into (Pandora.Paradigm.Primary.Transformer.Construction.Construction Pandora.Paradigm.Primary.Functor.Maybe.Maybe)) (Pandora.Paradigm.Primary.Linear.Vector.Vector r)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Into Pandora.Paradigm.Structure.Some.List.List) (Pandora.Paradigm.Primary.Linear.Vector.Vector r)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Pattern.Object.Group.Group a => Pandora.Pattern.Object.Group.Group (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Pattern.Object.Monoid.Monoid a => Pandora.Pattern.Object.Monoid.Monoid (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Pattern.Object.Quasiring.Quasiring a => Pandora.Pattern.Object.Quasiring.Quasiring (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Pattern.Object.Ringoid.Ringoid a => Pandora.Pattern.Object.Ringoid.Ringoid (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Pattern.Object.Semigroup.Semigroup a => Pandora.Pattern.Object.Semigroup.Semigroup (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: instance Pandora.Pattern.Object.Setoid.Setoid a => Pandora.Pattern.Object.Setoid.Setoid (Pandora.Paradigm.Primary.Linear.Vector.Vector a a)
+ Pandora.Paradigm.Primary.Linear.Vector: vectorize :: Vectorize a r => r -> Vector r a
+ Pandora.Paradigm.Structure.Ability.Morphable: Down :: a -> Vertical a
+ Pandora.Paradigm.Structure.Ability.Morphable: Up :: a -> Vertical a
+ Pandora.Paradigm.Structure.Ability.Morphable: data Vertical a
+ Pandora.Paradigm.Structure.Ability.Substructure: data (|>) (i :: * -> k) (j :: * -> k') a
+ Pandora.Paradigm.Structure.Ability.Substructure: instance forall k1 k' k2 (t :: * -> *) (i :: * -> k1) (j :: * -> k'). (Pandora.Pattern.Functor.Covariant.Covariant t, Pandora.Pattern.Functor.Covariant.Covariant (Pandora.Paradigm.Structure.Ability.Substructure.Substructural i t), Pandora.Paradigm.Structure.Ability.Substructure.Substructure i t, Pandora.Paradigm.Structure.Ability.Substructure.Substructure j (Pandora.Paradigm.Structure.Ability.Substructure.Substructural i t)) => Pandora.Paradigm.Structure.Ability.Substructure.Substructure (i Pandora.Paradigm.Structure.Ability.Substructure.|> j) t
+ Pandora.Paradigm.Structure.Ability.Substructure: type Substructured i source target = (Substructure i source, Substructural i source ~ target)
+ Pandora.Paradigm.Structure.Some.Binary: instance Pandora.Paradigm.Structure.Ability.Morphable.Morphable ('Pandora.Paradigm.Structure.Ability.Morphable.Rotate 'Pandora.Paradigm.Structure.Ability.Morphable.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.Ability.Morphable.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.Ability.Morphable.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: leaf :: a :=> Nonempty Binary
+ Pandora.Pattern.Category: (#) :: Category m => m ~~> m
+ Pandora.Pattern.Category: infixl 2 #
+ Pandora.Pattern.Category: infixr 9 .
+ Pandora.Pattern.Object.Group: infixl 7 -
+ Pandora.Pattern.Object.Ringoid: infixl 8 *
+ Pandora.Pattern.Object.Semigroup: infixl 7 +
- Pandora.Paradigm.Structure.Ability.Substructure: sub :: Substructure f t => t :~. Substructural f t
+ Pandora.Paradigm.Structure.Ability.Substructure: sub :: (Substructure f t, Covariant t) => t :~. Substructural f t
Files
- CHANGELOG.md +19/−0
- Pandora/Paradigm/Controlflow/Effect/Adaptable.hs +0/−10
- Pandora/Paradigm/Controlflow/Observable.hs +6/−6
- Pandora/Paradigm/Controlflow/Pipeline.hs +6/−6
- Pandora/Paradigm/Inventory.hs +3/−3
- Pandora/Paradigm/Inventory/Accumulator.hs +2/−2
- Pandora/Paradigm/Inventory/Environment.hs +2/−2
- Pandora/Paradigm/Inventory/Store.hs +1/−1
- Pandora/Paradigm/Primary.hs +8/−0
- Pandora/Paradigm/Primary/Functor.hs +1/−1
- Pandora/Paradigm/Primary/Functor/Conclusion.hs +4/−3
- Pandora/Paradigm/Primary/Functor/Convergence.hs +2/−2
- Pandora/Paradigm/Primary/Functor/Endo.hs +2/−2
- Pandora/Paradigm/Primary/Functor/Function.hs +11/−3
- Pandora/Paradigm/Primary/Functor/Predicate.hs +1/−1
- Pandora/Paradigm/Primary/Functor/Product.hs +1/−1
- Pandora/Paradigm/Primary/Functor/These.hs +8/−8
- Pandora/Paradigm/Primary/Functor/Validation.hs +2/−2
- Pandora/Paradigm/Primary/Functor/Wye.hs +11/−11
- Pandora/Paradigm/Primary/Linear.hs +4/−0
- Pandora/Paradigm/Primary/Linear/Matrix.hs +20/−0
- Pandora/Paradigm/Primary/Linear/Vector.hs +84/−0
- Pandora/Paradigm/Primary/Object/Ordering.hs +2/−2
- Pandora/Paradigm/Primary/Transformer/Backwards.hs +2/−2
- Pandora/Paradigm/Primary/Transformer/Construction.hs +10/−12
- Pandora/Paradigm/Primary/Transformer/Continuation.hs +7/−7
- Pandora/Paradigm/Primary/Transformer/Day.hs +6/−6
- Pandora/Paradigm/Primary/Transformer/Jack.hs +2/−2
- Pandora/Paradigm/Primary/Transformer/Outline.hs +5/−5
- Pandora/Paradigm/Primary/Transformer/Reverse.hs +5/−5
- Pandora/Paradigm/Primary/Transformer/Tap.hs +5/−5
- Pandora/Paradigm/Primary/Transformer/Yoneda.hs +3/−3
- Pandora/Paradigm/Structure.hs +2/−2
- Pandora/Paradigm/Structure/Ability/Monotonic.hs +2/−2
- Pandora/Paradigm/Structure/Ability/Morphable.hs +9/−7
- Pandora/Paradigm/Structure/Ability/Substructure.hs +18/−16
- Pandora/Paradigm/Structure/Interface/Dictionary.hs +3/−3
- Pandora/Paradigm/Structure/Interface/Set.hs +1/−1
- Pandora/Paradigm/Structure/Some/Binary.hs +39/−30
- Pandora/Paradigm/Structure/Some/List.hs +25/−21
- Pandora/Paradigm/Structure/Some/Rose.hs +2/−2
- Pandora/Paradigm/Structure/Some/Splay.hs +8/−7
- Pandora/Paradigm/Structure/Some/Stream.hs +6/−6
- Pandora/Pattern/Category.hs +5/−4
- Pandora/Pattern/Functor/Bindable.hs +1/−1
- Pandora/Pattern/Object/Chain.hs +2/−2
- Pandora/Pattern/Object/Group.hs +1/−1
- Pandora/Pattern/Object/Ringoid.hs +1/−1
- Pandora/Pattern/Object/Semigroup.hs +1/−1
- pandora.cabal +5/−1
CHANGELOG.md view
@@ -396,3 +396,22 @@ * Move `lookup` and `discover` exressions to `Dictionary` module # 0.4.0+* Define size typed `Vector` data structure+* Move `Vertical` datatype from `Binary` to `Morphable` module+* Remove `substitute`, `subplace`, `subview` methods from `Substructure` typeclass+* Remove `>>=:>` and `<:=<<` infix operators+* Move `Vector` datatype to `Linear` umbrella-module+* Rename `/` infix function application operator to `#`+* Define `$:` and `$::` infix function application operators+* Decrease precedence for `:*:` infix operator+* Change arguments order in `order` expression+* Rename `$:` to `#`, `$::` to `#:`, `$:::` to ` #::` and define `#:::`+* Remove `#:`, `#::`, `#:::` infix operators+* Change precedence for `.` infix operator+* Change precedence for `*`, `+`, `-` infix operators+* Change precedence for `#` infix operator+* Move `Linear` module to `Paradigm.Primary`+* Define experimental `Vectorize` typeclass+* Define `Matrix` datatype as combination of `Vector`'s+* Define `|>` datatype to use it for combining `Substructure` instances+* Define `Substructured` type synonymous as constraint kind
Pandora/Paradigm/Controlflow/Effect/Adaptable.hs view
@@ -7,16 +7,12 @@ import Pandora.Pattern.Functor.Covariant (Covariant) import Pandora.Pattern.Functor.Pointable (Pointable) import Pandora.Pattern.Functor.Extractable (Extractable)-import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Comonad (Comonad) import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Transformer (Liftable (lift), Lowerable (lower), Hoistable (hoist)) import Pandora.Paradigm.Controlflow.Effect.Interpreted (Schematic) import Pandora.Paradigm.Controlflow.Effect.Transformer (Transformer, wrap, bring, (:>), (:<)) -infixl 1 >>=:>-infixr 1 <:=<<- class Adaptable t u where {-# MINIMAL adapt #-} adapt :: t ~> u@@ -492,9 +488,3 @@ ) => Adaptable (t :> u :> v :> w :> x :> y :> z :> f :> h) (t :> u :> v :> w :> x :> y :> z :> f :> h') where adapt = hoist (hoist (hoist (hoist (hoist (hoist (hoist adapt))))))--(>>=:>) :: (Adaptable t u, Bindable u) => u a -> (a -> t b) -> u b-x >>=:> f = x >>= adapt . f--(<:=<<) :: (Adaptable t u, Bindable u) => (a -> t b) -> u a -> u b-f <:=<< x = x >>= adapt . f
Pandora/Paradigm/Controlflow/Observable.hs view
@@ -1,7 +1,7 @@ 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)) import Pandora.Paradigm.Controlflow.Effect.Interpreted (run)@@ -12,11 +12,11 @@ -- | Make continuation observable observe :: Continuation r t a -> Observable t a r-observe action = Continuation $ \h -> Capture $ run 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 $ run r / Capture . action+notify r action = captured $ run r # Capture . action -- | Infix version of 'notify' (.:~.) :: Observable t a r -> (a -> t r) -> t r@@ -24,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 $ run 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@@ -32,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 $ run 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@@ -40,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 $ run 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,6 +1,6 @@ module Pandora.Paradigm.Controlflow.Pipeline (Pipeline, await, yield, finish, impact, (=*=), pipeline) where -import Pandora.Pattern.Category (($), (.), (/))+import Pandora.Pattern.Category (($), (.), (#)) import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Paradigm.Primary.Functor.Function ((!), (!!))@@ -29,15 +29,15 @@ 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 $ \(Producer i) o -> 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 (Consumer o) -> 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 () ()@@ -49,14 +49,14 @@ -- | Compose two pipelines into one (=*=) :: 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+p =*= q = Continuation $ \_ -> Pipe $ \i -> pipe # run q end # pause (run p end !) i where end :: b -> Pipe c d () t () end _ = Pipe (point () !!) -- | Run pipeline and get result pipeline :: Pointable t => Pipeline i o t () () -> t ()-pipeline p = pipe / run p (Pipe . (!!) . point) / i / o where+pipeline p = pipe # run p (Pipe . (!!) . point) # i # o where i :: Producer i t () i = Producer $ \o' -> produce i o'
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 ((<->))@@ -26,7 +26,7 @@ (-|) :: a -> (Store s a -> b) -> State s b x -| f = State $ \s -> (:*:) s . f . Store $ s :*: (x !) (|-) :: Store s a -> (a -> State s b) -> b- Store (s :*: f) |- g = extract . run % s . g $ f s+ Store (s :*: f) |- g = extract . (run % s) . g $ f s instance Adjoint (Accumulator e) (Imprint e) where x -| f = Imprint $ x -| f . Accumulator@@ -47,7 +47,7 @@ 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 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,7 +22,7 @@ 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
Pandora/Paradigm/Inventory/Environment.hs view
@@ -25,13 +25,13 @@ point x = Environment (x !) instance Applicative (Environment e) where- f <*> x = Environment $ \e -> run f e $ run x e+ f <*> x = Environment $ run f <*> run x instance Distributive (Environment e) where g >>- f = Environment $ g >>- (run <$> f) instance Bindable (Environment e) where- Environment x >>= f = Environment $ \e -> run % e . f . x $ e+ Environment x >>= f = Environment $ \e -> (run % e) . f . x $ e instance Monad (Environment e) where
Pandora/Paradigm/Inventory/Store.hs view
@@ -50,7 +50,7 @@ -- | Given an index return value look :: Storable s t => s -> a <:= t-look s = extract % s . run @(Store _) . adapt+look s = (extract % s) . run @(Store _) . adapt -- | Change index with function retrofit :: (s -> s) -> Store s ~> Store s
Pandora/Paradigm/Primary.hs view
@@ -2,6 +2,7 @@ module Pandora.Paradigm.Primary (module Exports) where +import Pandora.Paradigm.Primary.Linear as Exports import Pandora.Paradigm.Primary.Transformer as Exports import Pandora.Paradigm.Primary.Functor as Exports import Pandora.Paradigm.Primary.Object as Exports@@ -10,6 +11,7 @@ import Pandora.Pattern.Category (Category ((.), ($), identity)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Contravariant (Contravariant ((>$<)))+import Pandora.Pattern.Functor.Extractable (Extractable (extract)) import Pandora.Paradigm.Controlflow.Effect.Interpreted (run, (||=)) import Pandora.Paradigm.Schemes.TU (TU (TU), type (<:.>)) import Pandora.Paradigm.Schemes.T_U (type (<:.:>))@@ -21,6 +23,12 @@ instance Contravariant (Flip (->) r) where f >$< g = (<$> f) ||= g++instance Covariant (Flip (:*:) a) where+ f <$> (Flip (x :*: y)) = Flip $ f x :*: y++instance Extractable (Flip (:*:) a) where+ extract (Flip (x :*: _)) = x instance Morphable (Into Maybe) (Conclusion e) where type Morphing (Into Maybe) (Conclusion e) = Maybe
Pandora/Paradigm/Primary/Functor.hs view
@@ -35,4 +35,4 @@ ~(s :*: x) |- f = f x s match :: Predicate a -> (a -> r) -> a -> r -> r :*: a-match (Predicate p) f x r = p x ? f x :*: x $ r :*: x+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@@ -98,4 +98,5 @@ catch (Success x) _ = Success x instance Monad u => Catchable e (Conclusion e <.:> u) where- catch (UT x) handle = UT $ x >>= conclusion (run . handle) (point . Success)+ catch (UT x) handle = let conclude = conclusion # run . handle # point . Success+ in UT $ x >>= conclude
Pandora/Paradigm/Primary/Functor/Convergence.hs view
@@ -1,6 +1,6 @@ module Pandora.Paradigm.Primary.Functor.Convergence 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 ((*)))@@ -9,7 +9,7 @@ data Convergence r a = Convergence (a -> a -> r) instance Contravariant (Convergence r) where- f >$< Convergence g = Convergence $ \x y -> g / f x / f y+ f >$< Convergence g = Convergence $ \x y -> g # f x # f y instance Ringoid r => Divisible (Convergence r) where Convergence g >*< Convergence h = Convergence $
Pandora/Paradigm/Primary/Functor/Endo.hs view
@@ -1,6 +1,6 @@ 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))@@ -12,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/Function.hs view
@@ -2,7 +2,7 @@ module Pandora.Paradigm.Primary.Functor.Function where -import Pandora.Pattern.Category (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 ((>>-)))@@ -10,6 +10,8 @@ import Pandora.Pattern.Functor.Bindable (Bindable ((>>=))) import Pandora.Pattern.Functor.Representable (Representable (Representation, (<#>), tabulate)) import Pandora.Pattern.Functor.Divariant (Divariant ((>->)))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Ringoid (Ringoid ((*))) infixr 2 ! infixr 9 %@@ -23,7 +25,7 @@ (<$>) = (.) 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@@ -32,7 +34,7 @@ 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@@ -41,6 +43,12 @@ instance Divariant ((->)) where (>->) ab cd bc = cd . bc . ab++instance Semigroup r => Semigroup (e -> r) where+ f + g = \e -> f e + g e++instance Ringoid r => Ringoid (e -> r) where+ f * g = \e -> f e * g e {-# INLINE (!) #-} (!) :: a -> b -> a
Pandora/Paradigm/Primary/Functor/Predicate.hs view
@@ -8,7 +8,7 @@ import Pandora.Pattern.Functor.Pointable (Pointable (point)) import Pandora.Pattern.Functor.Avoidable (Avoidable (empty)) import Pandora.Pattern.Object.Setoid (Setoid ((==)))-import Pandora.Pattern.Object.Ringoid (Ringoid ((*)))+import Pandora.Pattern.Object.Ringoid ((*)) import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False), bool, (?)) import Pandora.Paradigm.Primary.Functor.Function ((!)) import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)))
Pandora/Paradigm/Primary/Functor/Product.hs view
@@ -16,7 +16,7 @@ import Pandora.Pattern.Object.Group (Group (invert)) import Pandora.Paradigm.Schemes.T_U (T_U (T_U), type (<:.:>)) -infixr 1 :*:+infixr 0 :*: data Product s a = s :*: a
Pandora/Paradigm/Primary/Functor/These.hs view
@@ -1,6 +1,6 @@ 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 ((->>)))@@ -23,15 +23,15 @@ 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 + This x' = This # x + x' This x + That y = These y x- This x + These y x' = These y / x + 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'+ 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 ((<*>)))@@ -38,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/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 ((<*>)))@@ -14,9 +14,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@@ -33,15 +33,15 @@ instance Semigroup a => Semigroup (Wye a) where End + x = x x + End = x- Left x + Left x' = Left / x + x'+ Left x + Left x' = Left # x + x' Left x + Right y = Both x y- Left x + Both x' y = Both / x + x' / y+ Left x + Both x' y = Both # x + x' # y Right y + Left x = Both x y- Right y + Right y' = Right / y + y'- Right y + Both x y' = Both x / y + y'- Both x y + Left x' = Both / x + x' / y- Both x y + Right y' = Both / x / y + y'- Both x y + Both x' y' = Both / x + x' / y + y'+ Right y + Right y' = Right # y + y'+ Right y + Both x y' = Both x # y + y'+ Both x y + Left x' = Both # x + x' # y+ Both x y + Right y' = Both # x # y + y'+ Both x y + Both x' y' = Both # x + x' # y + y' instance Semigroup a => Monoid (Wye a) where zero = End
+ Pandora/Paradigm/Primary/Linear.hs view
@@ -0,0 +1,4 @@+module Pandora.Paradigm.Primary.Linear (module Exports) where++import Pandora.Paradigm.Primary.Linear.Matrix as Exports+import Pandora.Paradigm.Primary.Linear.Vector as Exports
+ Pandora/Paradigm/Primary/Linear/Matrix.hs view
@@ -0,0 +1,20 @@+{-# LANGUAGE UndecidableInstances #-}++module Pandora.Paradigm.Primary.Linear.Matrix where++import Pandora.Pattern.Category (($))+import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))+import Pandora.Pattern.Object.Monoid (Monoid (zero))+import Pandora.Pattern.Object.Setoid (Setoid ((==)))+import Pandora.Paradigm.Primary.Linear.Vector (Vector)++newtype Matrix i j a = Matrix (Vector i (Vector j a))++instance (Semigroup a, Semigroup (Vector i a), Semigroup (Vector i (Vector j a))) => Semigroup (Matrix i j a) where+ ~(Matrix x) + ~(Matrix y) = Matrix $ x + y++instance (Monoid a, Monoid (Vector i a), Monoid (Vector i (Vector j a))) => Monoid (Matrix i j a) where+ zero = Matrix zero++instance (Setoid a, Setoid (Vector i a), Setoid (Vector i (Vector j a))) => Setoid (Matrix i j a) where+ Matrix x == Matrix y = x == y
+ Pandora/Paradigm/Primary/Linear/Vector.hs view
@@ -0,0 +1,84 @@+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Pandora.Paradigm.Primary.Linear.Vector where++import Pandora.Pattern.Category (($), (#))+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.Setoid (Setoid ((==)))+import Pandora.Pattern.Functor.Pointable (point)+import Pandora.Paradigm.Primary.Functor.Maybe (Maybe)+import Pandora.Paradigm.Primary.Functor.Product (Product ((:*:)), type (:*:))+import Pandora.Paradigm.Primary.Transformer.Construction (Construction)+import Pandora.Paradigm.Structure.Ability.Nonempty (Nonempty)+import Pandora.Paradigm.Structure.Ability.Monotonic (Monotonic (reduce))+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Into, Push), premorph, into, item)+import Pandora.Paradigm.Structure.Some.List (List)++data Vector r a where+ Scalar :: a -> Vector a a+ Vector :: a -> Vector r a -> Vector (a :*: r) a++instance Semigroup a => Semigroup (Vector a a) where+ Scalar x + Scalar y = Scalar $ x + y++instance (Semigroup a, Semigroup r, Semigroup (a :*: r), Semigroup (Vector r a)) => Semigroup (Vector (a :*: r) a) where+ Vector x xs + Vector y ys = Vector # x + y # xs + ys++instance Ringoid a => Ringoid (Vector a a) where+ Scalar x * Scalar y = Scalar $ x * y++instance (Ringoid a, Ringoid r, Ringoid (a :*: r), Ringoid (Vector r a)) => Ringoid (Vector (a :*: r) a) where+ Vector x xs * Vector y ys = Vector # x * y # xs * ys++instance Monoid a => Monoid (Vector a a) where+ zero = Scalar zero++instance (Monoid a, Monoid r, Monoid (a :*: r), Monoid (Vector r a)) => Monoid (Vector (a :*: r) a) where+ zero = Vector zero zero++instance Quasiring a => Quasiring (Vector a a) where+ one = Scalar one++instance (Quasiring a, Quasiring r, Quasiring (a :*: r), Quasiring (Vector r a)) => Quasiring (Vector (a :*: r) a) where+ one = Vector one one++instance Group a => Group (Vector a a) where+ invert (Scalar x) = Scalar $ invert x++instance (Group a, Group r, Group (a :*: r), Group (Vector r a)) => Group (Vector (a :*: r) a) where+ invert (Vector x xs) = Vector # invert x # invert xs++instance Setoid a => Setoid (Vector a a) where+ Scalar x == Scalar y = x == y++instance (Setoid a, Setoid (Vector r a)) => Setoid (Vector (a :*: r) a) where+ Vector x xs == Vector y ys = (x == y) * (xs == ys)++instance Monotonic a (Vector a a) where+ reduce f r (Scalar x) = f x r++instance Monotonic a (Vector r a) => Monotonic a (Vector (a :*: r) a) where+ reduce f r (Vector x xs) = reduce f # f x r # xs++instance Morphable (Into List) (Vector r) where+ type Morphing (Into List) (Vector r) = List+ morphing (premorph -> Scalar x) = point x+ morphing (premorph -> Vector x xs) = item @Push x $ into @List xs++instance Morphable (Into (Construction Maybe)) (Vector r) where+ type Morphing (Into (Construction Maybe)) (Vector r) = Construction Maybe+ morphing (premorph -> Scalar x) = point x+ morphing (premorph -> Vector x xs) = item @Push x $ into @(Nonempty List) xs++class Vectorize a r where+ vectorize :: r -> Vector r a++instance Vectorize a a where+ vectorize x = Scalar x++instance Vectorize a r => Vectorize a (a :*: r) where+ vectorize (x :*: r) = Vector x $ vectorize r
Pandora/Paradigm/Primary/Object/Ordering.hs view
@@ -3,6 +3,6 @@ data Ordering = Less | Equal | Greater order :: a -> a -> a -> Ordering -> a-order x _ _ Less = x-order _ y _ Equal = y+order _ x _ Less = x+order y _ _ Equal = y order _ _ z Greater = z
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,7 +26,7 @@ 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
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))@@ -9,7 +9,7 @@ import Pandora.Pattern.Functor.Alternative (Alternative ((<+>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>), (<**>))) import Pandora.Pattern.Functor.Traversable (Traversable ((->>), (->>>)))-import Pandora.Pattern.Functor.Bindable (Bindable ((>>=)))+import Pandora.Pattern.Functor.Bindable (Bindable ((>>=), ($>>=))) import Pandora.Pattern.Functor.Extendable (Extendable ((=>>), extend)) import Pandora.Pattern.Functor.Monad (Monad) import Pandora.Pattern.Functor.Comonad (Comonad)@@ -26,7 +26,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 <$> ~(Construct x xs) = Construct # f x # f <$$> xs instance Avoidable t => Pointable (Construction t) where point x = Construct x empty@@ -35,18 +35,16 @@ extract ~(Construct x _) = x instance Applicative t => Applicative (Construction t) where- f <*> x = Construct / extract f (extract x)- $ deconstruct f <**> deconstruct x+ ~(Construct f fs) <*> ~(Construct x xs) = Construct # f x # fs <**> xs instance Traversable t => Traversable (Construction t) where- x ->> f = Construct <$> f (extract x) <*> deconstruct x ->>> f+ ~(Construct x xs) ->> f = Construct <$> f x <*> xs ->>> f instance Alternative t => Bindable (Construction t) where- x >>= f = Construct (extract . f $ extract x)- $ (deconstruct . f $ extract x) <+> (>>= f) <$> deconstruct x+ ~(Construct x xs) >>= f = Construct # extract (f x) # deconstruct (f x) <+> xs $>>= f 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 @@ -56,13 +54,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@@ -75,4 +73,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 ((<*>)))@@ -26,10 +26,10 @@ point x = Continuation ($ x) instance Covariant t => Applicative (Continuation r t) where- f <*> x = Continuation $ \h -> run f $ \g -> run 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 -> run x $ \y -> run / f y / g+ x >>= f = Continuation $ \g -> run x $ \y -> run # f y # g instance Monad t => Monad (Continuation r t) where @@ -38,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 -> run % 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 . run % 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 $ run % point . f+shift f = Continuation $ (run % point) . f interruptable :: Pointable t => ((a -> Continuation a t a) -> Continuation a t a) -> t a-interruptable = run % 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))@@ -15,17 +15,17 @@ 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 !!)@@ -34,4 +34,4 @@ 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/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))@@ -31,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
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,7 +26,7 @@ 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@@ -35,10 +35,10 @@ 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/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 }
Pandora/Paradigm/Structure/Ability/Monotonic.hs view
@@ -1,7 +1,7 @@ module Pandora.Paradigm.Structure.Ability.Monotonic where import Pandora.Pattern ((.|..))-import Pandora.Pattern.Category ((/))+import Pandora.Pattern.Category ((#)) import Pandora.Paradigm.Primary.Functor.Function ((!)) class Monotonic a e where@@ -10,7 +10,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
@@ -3,7 +3,7 @@ module Pandora.Paradigm.Structure.Ability.Morphable where import Pandora.Core.Functor (type (:=), type (~>), type (:=:=>))-import Pandora.Pattern.Category ((.), (/))+import Pandora.Pattern.Category ((.), (#)) import Pandora.Pattern.Functor.Extractable (extract) import Pandora.Pattern.Object.Chain (Chain ((<=>))) import Pandora.Pattern.Object.Setoid (Setoid)@@ -33,6 +33,8 @@ data Occurrence a = All a | First a +data Vertical a = Up a | Down a+ rotate :: forall f t . Morphable (Rotate f) t => t ~> Morphing (Rotate f) t rotate = morphing . TU . Tag @(Rotate f) @@ -40,19 +42,19 @@ 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+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+item new xs = run # morph @f xs # Identity new collate :: forall f t a . (Chain a, Morphable f t, Morphing f t ~ ((Identity <:.:> Comparison := (:*:)) <:.:> t := (->))) => a :=:=> t-collate new xs = run / morph @f xs / T_U (Identity new :*: Convergence (<=>))+collate new xs = run # morph @f xs # T_U (Identity new :*: Convergence (<=>)) delete :: forall f t a . (Setoid a, Morphable (Delete f) t, Morphing (Delete f) t ~ (Predicate <:.:> t := (->))) => a :=:=> t-delete x xs = run / morph @(Delete f) xs / equate x+delete x xs = run # morph @(Delete f) xs # equate x filter :: forall f t a . (Morphable (Delete f) t, Morphing (Delete f) t ~ (Predicate <:.:> t := (->))) => Predicate a -> t a -> t a-filter p xs = run / morph @(Delete f) xs / p+filter p xs = run # morph @(Delete f) xs # p find :: forall f t u a . (Morphable (Find f) t, Morphing (Find f) t ~ (Predicate <:.:> u := (->))) => Predicate a -> t a -> u a-find p xs = run / morph @(Find f) xs / p+find p xs = run # morph @(Find f) xs # p
Pandora/Paradigm/Structure/Ability/Substructure.hs view
@@ -1,30 +1,32 @@ {-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE UndecidableInstances #-} module Pandora.Paradigm.Structure.Ability.Substructure where -import Pandora.Core.Functor (type (~>))-import Pandora.Pattern.Category ((.))-import Pandora.Pattern.Functor.Covariant (comap)+import Pandora.Pattern.Category ((.), ($))+import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Extractable (extract)-import Pandora.Paradigm.Controlflow.Effect.Interpreted (run)-import Pandora.Paradigm.Inventory.Optics (type (:~.), view, over, set)-import Pandora.Paradigm.Primary.Functor.Tagged (Tagged (Tag))-import Pandora.Paradigm.Schemes.TU (TU (TU), type (<:.>))+import Pandora.Pattern.Functor.Pointable (point)+import Pandora.Pattern.Functor.Divariant ((>->))+import Pandora.Pattern.Transformer.Liftable (lift)+import Pandora.Paradigm.Controlflow.Effect.Interpreted (run, unite)+import Pandora.Paradigm.Inventory.Optics (type (:~.), (|>))+import Pandora.Paradigm.Primary.Functor.Tagged (Tagged)+import Pandora.Paradigm.Schemes.TU (type (<:.>)) class Substructure f t where type Substructural (f :: k) (t :: * -> *) :: * -> * substructure :: Tagged f <:.> t :~. Substructural f t - sub :: t :~. Substructural f t- sub = comap (extract . run) . substructure . TU . Tag @f+ sub :: Covariant t => t :~. Substructural f t+ sub x = extract . run <$> substructure @f (lift x) - subview :: t ~> Substructural f t- subview = view (sub @f)+data Segment a = Tail a - substitute :: (Substructural f t a -> Substructural f t a) -> t a -> t a- substitute = over (sub @f)+data (|>) (i :: * -> k) (j :: * -> k') a - subplace :: (Substructural f t) a -> t a -> t a- subplace = set (sub @f)+instance (Covariant t, Covariant (Substructural i t), Substructure i t, Substructure j (Substructural i t)) => Substructure (i |> j) t where+ type Substructural (i |> j) t = Substructural j (Substructural i t)+ substructure = extract . run >-> (unite . point <$>) $ sub @i |> sub @j -data Segment a = Tail a+type Substructured i source target = (Substructure i source, Substructural i source ~ target)
Pandora/Paradigm/Structure/Interface/Dictionary.hs view
@@ -2,7 +2,7 @@ module Pandora.Paradigm.Structure.Interface.Dictionary where -import Pandora.Pattern.Category ((/))+import Pandora.Pattern.Category ((#)) import Pandora.Paradigm.Controlflow.Effect.Interpreted (run) import Pandora.Paradigm.Schemes.TU (type (<:.>)) @@ -11,7 +11,7 @@ type Dictionary f t = Morphable (Lookup f) t lookup :: forall f k t u a . (Dictionary f t, Morphing (Lookup f) t ~ ((->) k <:.> u)) => k -> t a -> u a-lookup key xs = run / morph @(Lookup f) xs / key+lookup key xs = run # morph @(Lookup f) xs # key discover :: forall f k v t u a . (Dictionary f t, Morphing (Lookup f) t ~ ((->) (v k) <:.> u)) => v k -> t a -> u a-discover keys xs = run / morph @(Lookup f) xs / keys+discover keys xs = run # morph @(Lookup f) xs # keys
Pandora/Paradigm/Structure/Interface/Set.hs view
@@ -23,7 +23,7 @@ type Set t f a = (Traversable t, Setoid a, Setoid (t a), Morphable (Find f) t) subset :: forall t f a . (Set t f a, Morphing (Find f) t ~ (Predicate <:.:> Maybe := (->))) => Convergence Boolean := t a-subset = Convergence $ \s ss -> Nothing != ss ->> find @f @t @Maybe % s . equate+subset = Convergence $ \s ss -> Nothing != ss ->> (find @f @t @Maybe % s) . equate cardinality :: Traversable t => t a -> Numerator cardinality s = attached . run @(State _) % Zero $ s ->> (modify @Numerator (+ one) !)
Pandora/Paradigm/Structure/Some/Binary.hs view
@@ -2,8 +2,8 @@ module Pandora.Paradigm.Structure.Some.Binary where -import Pandora.Core.Functor (type (:.), type (:=))-import Pandora.Pattern.Category (identity, (.), ($), (/))+import Pandora.Core.Functor (type (:.), type (:=), type (:=>))+import Pandora.Pattern.Category (identity, (.), ($), (#)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>), comap)) import Pandora.Pattern.Functor.Traversable (Traversable ((->>))) import Pandora.Pattern.Functor.Extractable (extract)@@ -35,29 +35,30 @@ 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.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into, Insert), morph, premorph)-import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure), sub, substitute)+import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into, Insert), Vertical (Up, Down), morph, premorph)+import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure), sub) import Pandora.Paradigm.Structure.Ability.Zipper (Zipper) type Binary = Maybe <:.> Construction Wye 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 x) (Both # rebalance (deconstruct x) # rebalance (deconstruct y))+ # Construct (extract y) (Both # x # rebalance (deconstruct y))+ # Construct (extract x) (Both # rebalance (deconstruct x) # y) instance Morphable Insert Binary where type Morphing Insert Binary = (Identity <:.:> Comparison := (:*:)) <:.:> Binary := (->)- morphing (run . premorph -> Nothing) = T_U $ \(T_U (Identity x :*: _)) -> lift . Construct x $ End+ morphing (run . premorph -> Nothing) = T_U $ \(T_U (Identity x :*: _)) -> lift $ leaf x morphing (run . premorph -> Just ne) = T_U $ \(T_U (Identity x :*: Convergence f)) ->- let continue xs = run / morph @Insert xs $ twosome / Identity x / Convergence f- in lift $ f x (extract ne) & order (ne & substitute @Left continue) ne (ne & substitute @Right continue)+ let continue xs = run # morph @Insert xs $ twosome # Identity x # Convergence f+ in lift $ f x # extract ne & order # ne # over (sub @Left) continue ne # over (sub @Right) continue ne instance (forall a . Chain a) => Focusable Root Binary where type Focusing Root Binary a = Maybe a- focusing (run . extract -> Nothing) = Store $ Nothing :*: Tag . TU . comap (Construct % End)- focusing (run . extract -> Just x) = Store $ Just (extract x) :*: Tag . lift . resolve (Construct % deconstruct x) (rebalance $ deconstruct x)+ focusing (run . extract -> Nothing) = Store $ Nothing :*: Tag . TU . comap leaf+ focusing (run . extract -> Just x) = Store $ Just # extract x :*: Tag . lift+ . resolve (Construct % deconstruct x) (rebalance $ deconstruct x) instance Measurable Heighth Binary where type Measural Heighth Binary a = Numerator@@ -81,9 +82,11 @@ binary struct = attached $ run @(State (Binary a)) % empty $ struct ->> modify @(Binary a) . insert' where insert' :: a -> Binary a -> Binary a- insert' x (run -> Nothing) = lift . Construct x $ End- insert' x tree@(run -> Just nonempty) = x <=> extract nonempty & order- (tree & substitute @Left (insert' x)) tree (tree & substitute @Right (insert' x))+ insert' x (run -> Nothing) = lift $ leaf x+ insert' x tree@(run -> Just nonempty) = order # tree+ # (over # sub @Left # insert' x # tree)+ # (over # sub @Right # insert' x # tree)+ # x <=> extract nonempty type instance Nonempty Binary = Construction Wye @@ -93,10 +96,13 @@ instance Morphable Insert (Construction Wye) where type Morphing Insert (Construction Wye) = (Identity <:.:> Comparison := (:*:)) <:.:> Construction Wye := (->)- morphing (premorph -> ne) = T_U $ \(T_U (Identity x :*: Convergence f)) ->- let continue xs = run / morph @Insert @(Nonempty Binary) xs $ twosome / Identity x / Convergence f in- let change = lift . resolve continue (Construct x End) . run in- f x (extract ne) & order (over / sub @Left / change / ne) ne (over / sub @Right / change / ne)+ morphing (premorph -> nonempty_list) = T_U $ \(T_U (Identity x :*: Convergence f)) ->+ let continue xs = run # morph @Insert @(Nonempty Binary) xs $ twosome # Identity x # Convergence f in+ let change = lift . resolve continue (leaf x) . run in+ order # nonempty_list+ # over (sub @Left) change nonempty_list+ # over (sub @Right) change nonempty_list+ # f x (extract nonempty_list) instance Focusable Root (Construction Wye) where type Focusing Root (Construction Wye) a = a@@ -109,12 +115,12 @@ measurement (deconstruct . extract -> Right rst) = One + measure @Heighth rst measurement (deconstruct . extract -> Both lst rst) = One + let (lm :*: rm) = measure @Heighth lst :*: measure @Heighth rst- in lm <=> rm & order rm lm lm+ in lm <=> rm & order lm rm lm instance Substructure Left (Construction Wye) where type Substructural Left (Construction Wye) = Binary substructure (extract . run -> Construct x End) =- Store $ empty :*: lift . resolve (Construct x . Left) (Construct x End) . run+ Store $ empty :*: lift . resolve (Construct x . Left) (leaf x) . run substructure (extract . run -> Construct x (Left lst)) = Store $ lift lst :*: lift . Construct x . resolve Left End . run substructure (extract . run -> Construct x (Right rst)) =@@ -125,7 +131,7 @@ instance Substructure Right (Construction Wye) where type Substructural Right (Construction Wye) = Binary substructure (extract . run -> Construct x End) =- Store $ empty :*: lift . resolve (Construct x . Right) (Construct x End) . run+ Store $ empty :*: lift . resolve (Construct x . Right) (leaf x) . run substructure (extract . run -> Construct x (Left lst)) = Store $ empty :*: lift . Construct x . resolve (Both lst) (Left lst) . run substructure (extract . run -> Construct x (Right rst)) =@@ -146,31 +152,34 @@ type instance Zipper (Construction Wye) = Construction Wye <:.:> Bifurcation <:.> Bicursor := (:*:) -data Vertical a = Up a | Down a- 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)+ 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)+ 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)) (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+ 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+ 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)) (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 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++leaf :: a :=> Nonempty Binary+leaf x = Construct x End
Pandora/Paradigm/Structure/Some/List.hs view
@@ -4,7 +4,7 @@ import Pandora.Core.Functor (type (:.), type (:=)) import Pandora.Pattern ((.|..))-import Pandora.Pattern.Category ((.), (/), ($), identity)+import Pandora.Pattern.Category ((.), ($), (#), identity) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Applicative (Applicative ((<*>))) import Pandora.Pattern.Functor.Extractable (extract)@@ -46,7 +46,7 @@ import Pandora.Paradigm.Structure.Ability.Monotonic (Monotonic (reduce, resolve)) import Pandora.Paradigm.Structure.Ability.Morphable (Morphable (Morphing, morphing), Morph (Rotate, Into, Push, Pop, Delete, Find, Element) , Occurrence (All, First), premorph, rotate, item, filter, find, into)-import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure), Segment (Tail), sub, subview)+import Pandora.Paradigm.Structure.Ability.Substructure (Substructure (Substructural, substructure, sub), Segment (Tail)) import Pandora.Paradigm.Structure.Interface.Stack (Stack) -- | Linear data structure that serves as a collection of elements@@ -65,7 +65,7 @@ instance Morphable Push List where type Morphing Push List = Identity <:.:> List := (->)- morphing (premorph -> xs) = T_U $ \(Identity x) -> lift . Construct x . run $ xs+ morphing (premorph -> xs) = T_U $ lift . (Construct % run xs) . extract instance Morphable Pop List where type Morphing Pop List = List@@ -75,7 +75,7 @@ type Morphing (Find Element) List = Predicate <:.:> Maybe := (->) morphing (premorph -> TU Nothing) = T_U $ \_ -> Nothing morphing (premorph -> TU (Just (Construct x xs))) = T_U $ \p ->- run p x ? Just x $ (find @Element @List @Maybe / p / TU xs)+ run p x ? Just x $ find @Element @List @Maybe # p # TU xs instance Morphable (Delete First) List where type Morphing (Delete First) List = Predicate <:.:> List := (->)@@ -94,8 +94,8 @@ 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+ Just x -> stack & view (sub @Tail) & item @Push x & Tag+ Nothing -> stack & view (sub @Tail) & Tag instance Measurable Length List where type Measural Length List a = Numerator@@ -112,7 +112,7 @@ -- | 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)+linearize = TU . extract . (run @(State (Maybe :. Nonempty List := a)) % Nothing) . fold (Just .|.. Construct) type instance Nonempty List = Construction Maybe @@ -148,12 +148,12 @@ type instance Zipper List = Tap (List <:.:> List := (:*:)) instance {-# OVERLAPS #-} Traversable (Tap (List <:.:> List := (:*:))) where- Tap x (T_U (future :*: past)) ->> f = (\past' x' future' -> Tap x' $ twosome / future' / run past')+ Tap x (T_U (future :*: past)) ->> f = (\past' x' future' -> Tap x' $ twosome # future' # run past') <$> Reverse past ->> f <*> f x <*> future ->> f instance {-# OVERLAPS #-} Extendable (Tap (List <:.:> List := (:*:))) where z =>> f = let move rtt = TU . deconstruct $ run . rtt .-+ z in- Tap / f z $ twosome / f <$> move (rotate @Left) / f <$> move (rotate @Right)+ Tap # f z $ twosome # f <$> move (rotate @Left) # f <$> move (rotate @Right) instance Focusable Head (Tap (List <:.:> List := (:*:))) where type Focusing Head (Tap (List <:.:> List := (:*:))) a = a@@ -162,12 +162,12 @@ instance Morphable (Rotate Left) (Tap (List <:.:> List := (:*:))) where type Morphing (Rotate Left) (Tap (List <:.:> List := (:*:))) = Maybe <:.> Zipper List morphing (premorph -> Tap x (T_U (future :*: past))) = TU- $ Tap % twosome (subview @Tail future) (item @Push x past) <$> view (focus @Head) future+ $ Tap % twosome (view (sub @Tail) future) (item @Push x past) <$> view (focus @Head) future instance Morphable (Rotate Right) (Tap (List <:.:> List := (:*:))) where type Morphing (Rotate Right) (Tap (List <:.:> List := (:*:))) = Maybe <:.> Zipper List morphing (premorph -> Tap x (T_U (future :*: past))) = TU- $ Tap % twosome (item @Push x future) (subview @Tail past) <$> view (focus @Head) past+ $ Tap % twosome (item @Push x future) (view (sub @Tail) past) <$> view (focus @Head) past instance Morphable (Into (Tap (List <:.:> List := (:*:)))) List where type Morphing (Into (Tap (List <:.:> List := (:*:)))) List = Maybe <:.> Zipper List@@ -175,13 +175,14 @@ instance Morphable (Into List) (Tap (List <:.:> List := (:*:))) where type Morphing (Into List) (Tap (List <:.:> List := (:*:))) = List- morphing (premorph -> Tap x (T_U (future :*: past))) = attached . run @(State _)- % item @Push x future $ past ->> modify . item @Push @List+ morphing (premorph -> Tap x (T_U (future :*: past))) = attached $ run @(State _)+ # past ->> modify . item @Push @List+ # item @Push x future type instance Zipper (Construction Maybe) = Tap (Construction Maybe <:.:> Construction Maybe := (:*:)) instance {-# OVERLAPS #-} Traversable (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where- Tap x (T_U (future :*: past)) ->> f = (\past' x' future' -> Tap x' $ twosome / future' / run past')+ Tap x (T_U (future :*: past)) ->> f = (\past' x' future' -> Tap x' $ twosome # future' # run past') <$> Reverse past ->> f <*> f x <*> future ->> f instance Focusable Head (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where@@ -198,25 +199,28 @@ instance Morphable (Into (Tap (List <:.:> List := (:*:)))) (Construction Maybe) where type Morphing (Into (Tap (List <:.:> List := (:*:)))) (Construction Maybe) = Zipper List- morphing (premorph -> ne) = Tap / extract ne $ twosome / view (sub @Tail) ne / empty+ morphing (premorph -> ne) = Tap # extract ne $ twosome # view (sub @Tail) ne # empty instance Morphable (Into (Tap (List <:.:> List := (:*:)))) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where type Morphing (Into (Tap (List <:.:> List := (:*:)))) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) = Zipper List- morphing (premorph -> zipper) = Tap / extract zipper $ (lift <-> lift) ||= lower zipper+ morphing (premorph -> zipper) = Tap # extract zipper $ (lift <-> lift) ||= lower zipper instance Morphable (Into (Tap (Construction Maybe <:.:> Construction Maybe := (:*:)))) (Tap (List <:.:> List := (:*:))) where type Morphing (Into (Tap (Construction Maybe <:.:> Construction Maybe := (:*:)))) (Tap (List <:.:> List := (:*:))) = Maybe <:.> Zipper (Construction Maybe)- morphing (premorph -> zipper) = let spread x y = (:*:) <$> x <*> y in TU $ Tap (extract zipper) . T_U <$> ((|- spread) . (run <-> run) . run $ lower zipper)+ morphing (premorph -> zipper) = let spread x y = (:*:) <$> x <*> y in TU $+ Tap (extract zipper) . T_U <$> ((|- spread) . (run <-> run) . run $ lower zipper) instance Morphable (Into (Construction Maybe)) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where type Morphing (Into (Construction Maybe)) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) = Construction Maybe- morphing (premorph -> Tap x (T_U (future :*: past))) = attached . run @(State _)- % item @Push x future $ past ->> modify . item @Push @(Nonempty List)+ morphing (premorph -> Tap x (T_U (future :*: past))) = attached $ run @(State _)+ # past ->> modify . item @Push @(Nonempty List)+ # item @Push x future instance Morphable (Into List) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) where type Morphing (Into List) (Tap (Construction Maybe <:.:> Construction Maybe := (:*:))) = List- morphing (premorph -> Tap x (T_U (future :*: past))) = attached . run @(State _)- % item @Push x (lift future) $ past ->> modify . item @Push @List+ morphing (premorph -> Tap x (T_U (future :*: past))) = attached $ run @(State _)+ # past ->> modify . item @Push @List+ # item @Push x (lift future) instance Monotonic a (Maybe <:.> Construction Maybe := a) where reduce f r = reduce f r . run
Pandora/Paradigm/Structure/Some/Rose.hs view
@@ -3,7 +3,7 @@ module Pandora.Paradigm.Structure.Some.Rose 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.Contravariant ((>$<)) import Pandora.Pattern.Functor.Extractable (extract)@@ -68,4 +68,4 @@ find_rose_sub_tree (Construct k (Just ks)) tree = k != attached (extract tree) ? Nothing $ subtree >>= find_rose_sub_tree ks where subtree :: Maybe :. Nonempty Rose := k :*: a- subtree = find @Element / attached . extract >$< equate (extract ks) / deconstruct tree+ subtree = find @Element # attached . extract >$< equate (extract ks) # deconstruct tree
Pandora/Paradigm/Structure/Some/Splay.hs view
@@ -4,7 +4,7 @@ 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)@@ -16,10 +16,11 @@ 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.Inventory.Optics (over) import Pandora.Paradigm.Schemes (TU (TU), type (<:.>)) 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.Ability.Substructure (sub) import Pandora.Paradigm.Structure.Some.Binary (Binary) data Splay a = Zig a | Zag a@@ -44,26 +45,26 @@ nodes :: Wye :. Nonempty Binary := a 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+ . 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 (premorph -> 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 (premorph -> 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)) ||=) . premorph+ morphing = rotate @(Left Zig) . over (sub @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)) ||=) . premorph+ morphing = rotate @(Right Zig) . over (sub @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/Stream.hs view
@@ -3,7 +3,7 @@ module Pandora.Paradigm.Structure.Some.Stream where import Pandora.Core.Functor (type (:=), type (:=>))-import Pandora.Pattern.Category ((.), ($), (/))+import Pandora.Pattern.Category ((.), ($), (#)) import Pandora.Pattern.Functor.Covariant (Covariant ((<$>))) import Pandora.Pattern.Functor.Pointable (point) import Pandora.Pattern.Functor.Extractable (extract)@@ -23,17 +23,17 @@ 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)+ 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 <:.:> 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)+ morphing (premorph -> Tap x (T_U (bs :*: fs))) = Tap # extract fs+ $ twosome # Construct x (point bs) # extract (deconstruct fs) instance {-# OVERLAPS #-} Extendable (Tap (Stream <:.:> Stream := (:*:))) where z =>> f = let move rtt = extract . deconstruct $ point . rtt .-+ z- in f <$> Tap z (twosome / 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
@@ -2,9 +2,10 @@ import Pandora.Core.Functor (type (~~>)) -infixr 8 .-infixl 1 /+-- infixl 1 #+infixl 2 # infixr 0 $+infixr 9 . class Category (m :: * -> * -> *) where identity :: m a a@@ -13,5 +14,5 @@ ($) :: m ~~> m ($) f = identity . f - (/) :: m ~~> m- (/) f = identity . f+ (#) :: m ~~> m+ (#) f = identity . f
Pandora/Pattern/Functor/Bindable.hs view
@@ -30,7 +30,7 @@ f >=> g = \x -> f x >>= g -- | Right-to-left Kleisli composition (<=<) :: (b -> t c) -> (a -> t b) -> (a -> t c)- g <=< f = f >=> g+ g <=< f = f >=> g ($>>=) :: Covariant u => u :. t := a -> (a -> t b) -> u :. t := b x $>>= f = (>>= f) <$> x
Pandora/Pattern/Object/Chain.hs view
@@ -18,10 +18,10 @@ (<=>) :: a -> a -> Ordering (<) :: a -> a -> Boolean- x < y = order True False False (x <=> y)+ x < y = order False True False (x <=> y) (<=) :: a -> a -> Boolean x <= y = order True True False (x <=> y) (>) :: a -> a -> Boolean x > y = order False False True (x <=> y) (>=) :: a -> a -> Boolean- x >= y = order False True True (x <=> y)+ x >= y = order True False True (x <=> y)
Pandora/Pattern/Object/Group.hs view
@@ -3,7 +3,7 @@ import Pandora.Pattern.Object.Semigroup (Semigroup ((+))) import Pandora.Pattern.Object.Monoid (Monoid) -infixl 6 -+infixl 7 - {- | > When providing a new instance, you should ensure it satisfies:
Pandora/Pattern/Object/Ringoid.hs view
@@ -2,7 +2,7 @@ import Pandora.Pattern.Object.Semigroup (Semigroup) -infixl 7 *+infixl 8 * {- | > When providing a new instance, you should ensure it satisfies:
Pandora/Pattern/Object/Semigroup.hs view
@@ -1,6 +1,6 @@ module Pandora.Pattern.Object.Semigroup (Semigroup (..)) where -infixl 6 ++infixl 7 + {- | > When providing a new instance, you should ensure it satisfies:
pandora.cabal view
@@ -1,5 +1,5 @@ name: pandora-version: 0.3.9+version: 0.4.0 synopsis: A box of patterns and paradigms description: Humble attempt to define a library for problem solving based on math abstractions. homepage: https://github.com/iokasimov/pandora@@ -117,6 +117,10 @@ Pandora.Paradigm.Structure.Some.Binary Pandora.Paradigm.Structure.Some.Splay Pandora.Paradigm.Structure.Some.Rose+ -- Linear albegra's primitives+ Pandora.Paradigm.Primary.Linear+ Pandora.Paradigm.Primary.Linear.Vector+ Pandora.Paradigm.Primary.Linear.Matrix Pandora.Pattern -- Category typeclass