LocalDependency.Data.Profunctor.Strong
#Strong
class Strong :: (Type -> Type -> Type) -> Constraint
class (Profunctor p) <= Strong p where
The Strong
class extends Profunctor
with combinators for working with
product types.
first
and second
lift values in a Profunctor
to act on the first and
second components of a Tuple
, respectively.
Another way to think about Strong is to piggyback on the intuition of inputs and outputs. Rewriting the type signature in this light then yields:
first :: forall input output a. p input output -> p (Tuple input a) (Tuple output a)
second :: forall input output a. p input output -> p (Tuple a input) (Tuple a output)
If we specialize the profunctor p to the function arrow, we get the following type signatures, which may look a bit more familiar:
first :: forall input output a. (input -> output) -> (Tuple input a) -> (Tuple output a)
second :: forall input output a. (input -> output) -> (Tuple a input) -> (Tuple a output)
So, when the profunctor
is Function
application, first
essentially applies your function
to the first element of a Tuple
, and second
applies it to the second element (same as map
would do).
Members
first :: forall a b c. p a b -> p (Tuple a c) (Tuple b c)
second :: forall a b c. p b c -> p (Tuple a b) (Tuple a c)
Instances
#splitStrong
splitStrong :: forall p a b c d. Category p => Strong p => p a b -> p c d -> p (Tuple a c) (Tuple b d)
Compose a value acting on a Tuple
from two values, each acting on one of
the components of the Tuple
.
Specializing (***)
to function application would look like this:
(***) :: forall a b c d. (a -> b) -> (c -> d) -> (Tuple a c) -> (Tuple b d)
We take two functions, f
and g
, and we transform them into a single function which
takes a Tuple
and maps f
over the first element and g
over the second. Just like bi-map
would do for the bi-functor
instance of Tuple
.
#(***)
Operator alias for LocalDependency.Data.Profunctor.Strong.splitStrong (right-associative / precedence 3)
#fanout
fanout :: forall p a b c. Category p => Strong p => p a b -> p a c -> p a (Tuple b c)
Compose a value which introduces a Tuple
from two values, each introducing
one side of the Tuple
.
This combinator is useful when assembling values from smaller components, because it provides a way to support two different types of output.
Specializing (&&&)
to function application would look like this:
(&&&) :: forall a b c. (a -> b) -> (a -> c) -> (a -> (Tuple b c))
We take two functions, f
and g
, with the same parameter type and we transform them into a
single function which takes one parameter and returns a Tuple
of the results of running
f
and g
on the parameter, respectively. This allows us to run two parallel computations
on the same input and return both results in a Tuple
.
#(&&&)
Operator alias for LocalDependency.Data.Profunctor.Strong.fanout (right-associative / precedence 3)
Modules
- Control.Applicative
- Control.Apply
- Control.Bind
- Control.Category
- Control.Monad
- Control.Semigroupoid
- Data.Boolean
- Data.BooleanAlgebra
- Data.Bounded
- Data.Bounded.Generic
- Data.CommutativeRing
- Data.DivisionRing
- Data.Eq
- Data.Eq.Generic
- Data.EuclideanRing
- Data.Field
- Data.Function
- Data.Functor
- Data.Generic.Rep
- Data.HeytingAlgebra
- Data.HeytingAlgebra.Generic
- Data.Monoid
- Data.Monoid.Additive
- Data.Monoid.Conj
- Data.Monoid.Disj
- Data.Monoid.Dual
- Data.Monoid.Endo
- Data.Monoid.Generic
- Data.Monoid.Multiplicative
- Data.NaturalTransformation
- Data.Newtype
- Data.Ord
- Data.Ord.Down
- Data.Ord.Generic
- Data.Ord.Max
- Data.Ord.Min
- Data.Ordering
- Data.Ring
- Data.Ring.Generic
- Data.Semigroup
- Data.Semigroup.First
- Data.Semigroup.Generic
- Data.Semigroup.Last
- Data.Semiring
- Data.Semiring.Generic
- Data.Show
- Data.Show.Generic
- Data.Symbol
- Data.Unit
- Data.Void
- Foreign
- LocalDependency.Control.Alt
- LocalDependency.Control.Alternative
- LocalDependency.Control.Biapplicative
- LocalDependency.Control.Biapply
- LocalDependency.Control.Comonad
- LocalDependency.Control.Extend
- LocalDependency.Control.Lazy
- LocalDependency.Control.MonadPlus
- LocalDependency.Control.MonadZero
- LocalDependency.Control.Plus
- LocalDependency.Data.Bifoldable
- LocalDependency.Data.Bifunctor
- LocalDependency.Data.Bifunctor.Join
- LocalDependency.Data.Bitraversable
- LocalDependency.Data.Comparison
- LocalDependency.Data.Const
- LocalDependency.Data.Decidable
- LocalDependency.Data.Decide
- LocalDependency.Data.Distributive
- LocalDependency.Data.Divide
- LocalDependency.Data.Divisible
- LocalDependency.Data.Either
- LocalDependency.Data.Either.Inject
- LocalDependency.Data.Either.Nested
- LocalDependency.Data.Equivalence
- LocalDependency.Data.Exists
- LocalDependency.Data.Foldable
- LocalDependency.Data.FoldableWithIndex
- LocalDependency.Data.Functor.App
- LocalDependency.Data.Functor.Clown
- LocalDependency.Data.Functor.Compose
- LocalDependency.Data.Functor.Contravariant
- LocalDependency.Data.Functor.Coproduct
- LocalDependency.Data.Functor.Coproduct.Inject
- LocalDependency.Data.Functor.Coproduct.Nested
- LocalDependency.Data.Functor.Costar
- LocalDependency.Data.Functor.Flip
- LocalDependency.Data.Functor.Invariant
- LocalDependency.Data.Functor.Joker
- LocalDependency.Data.Functor.Product
- LocalDependency.Data.Functor.Product.Nested
- LocalDependency.Data.Functor.Product2
- LocalDependency.Data.FunctorWithIndex
- LocalDependency.Data.Identity
- LocalDependency.Data.Maybe
- LocalDependency.Data.Maybe.First
- LocalDependency.Data.Maybe.Last
- LocalDependency.Data.Monoid.Alternate
- LocalDependency.Data.Op
- LocalDependency.Data.Predicate
- LocalDependency.Data.Profunctor
- LocalDependency.Data.Profunctor.Choice
- LocalDependency.Data.Profunctor.Closed
- LocalDependency.Data.Profunctor.Cochoice
- LocalDependency.Data.Profunctor.Costrong
- LocalDependency.Data.Profunctor.Join
- LocalDependency.Data.Profunctor.Split
- LocalDependency.Data.Profunctor.Star
- LocalDependency.Data.Profunctor.Strong
- LocalDependency.Data.Semigroup.Foldable
- LocalDependency.Data.Semigroup.Traversable
- LocalDependency.Data.Traversable
- LocalDependency.Data.Traversable.Accum
- LocalDependency.Data.Traversable.Accum.Internal
- LocalDependency.Data.TraversableWithIndex
- LocalDependency.Data.Tuple
- LocalDependency.Data.Tuple.Nested
- LocalDependency.Effect
- LocalDependency.Safe.Coerce
- LocalDependency.Type.Equality
- LocalDependency.Unsafe.Coerce
- Prelude
- Prim
- Prim.Boolean
- Prim.Coerce
- Prim.Ordering
- Prim.Row
- Prim.RowList
- Prim.Symbol
- Prim.TypeError
- Record.Unsafe
- Safe.Coerce
- Test.Foreign
- Test.Main
- Test.MiraculixLite
- Test.MiraculixLite.Assertion
- Test.MiraculixLite.FFI
- Test.MiraculixLite.Summary
- Test.MiraculixLite.TestTree
- Test.MiraculixLite.Typo
- Type.Data.Row
- Type.Data.RowList
- Type.Proxy
- Unsafe.Coerce