Module
Control.Selective.ComposeTM
- Package
- purescript-selective-functors
- Repository
- artemisSystem/purescript-selective-functors
#ComposeTM Source
newtype ComposeTM :: forall k1 k2. (k2 -> Type) -> (k1 -> k2) -> k1 -> Type
newtype ComposeTM f g a
This newtype provides a Select
instance for Compose
.
It "lifts" the Traversable
g
into the Selective
f
. ComposeTM
does
this in a way that works well when the g
/inner type is like Array
or
Maybe
, whose "effect" just involves the amount of elements, and doesn't
store any extra data alongside elements, like Tuple
does. More details
in the documentation for the Select
instance. See also ComposeT
for an
alternate implementation that's better suited for tuples.
Constructors
ComposeTM (f (g a))
Instances
Newtype (ComposeTM f g a) _
Generic (ComposeTM f g a) _
(Show (f (g a))) => Show (ComposeTM f g a)
(Eq1 f, Eq1 g, Eq a) => Eq (ComposeTM f g a)
(Eq1 f, Eq1 g) => Eq1 (ComposeTM f g)
(Ord1 f, Ord1 g, Ord a) => Ord (ComposeTM f g a)
(Ord1 f, Ord1 g) => Ord1 (ComposeTM f g)
(Functor f, Functor g) => Functor (ComposeTM f g)
(Apply f, Apply g) => Apply (ComposeTM f g)
(Applicative f, Applicative g) => Applicative (ComposeTM f g)
(Select f, Apply g, Traversable g) => Select (ComposeTM f g)
(Selective f, Applicative g, Traversable g) => Selective (ComposeTM f g)
(Alt f, Functor g) => Alt (ComposeTM f g)
(Plus f, Functor g) => Plus (ComposeTM f g)
(Alternative f, Applicative g) => Alternative (ComposeTM f g)
- Modules
- Control.
Select - Control.
Selective - Control.
Selective. ComposeI - Control.
Selective. ComposeTM - Control.
Selective. ComposeTS - Control.
Selective. Free - Control.
Selective. Over - Control.
Selective. SelectA - Control.
Selective. SelectM - Control.
Selective. SelectTM - Control.
Selective. SelectTS - Control.
Selective. Under - Control.
Selective. Validation
This newtype provides a
Select
instance forCompose
. It "lifts" theTraversable
g
into theSelective
f
.This instance works best when the traversable's "effect" is failure/nondeterminism, like
Array
orMaybe
. It doesn't work too well in other cases, for example ifg
isTuple
, then if the first parameter contains aLeft
(requiring use of the second parameter), only the second parameter'sfst
value actually ends up in the result. SeeComposeT
for an instance that works better for types likeTuple
.