Search results
traverse :: forall t a b m. Traversable t => Applicative m => (a -> m b) -> t a -> m (t b)
traverse1 :: forall t a b f. Traversable1 t => Apply f => (a -> f b) -> t a -> f (t b)
traverse1Default :: forall t a b m. Traversable1 t => Apply m => (a -> m b) -> t a -> m (t b)
A default implementation of traverse1
using sequence1
.
traverseDefault :: forall t a b m. Traversable t => Applicative m => (a -> m b) -> t a -> m (t b)
A default implementation of traverse
using sequence
and map
.
traverseDefault :: forall i t a b m. TraversableWithIndex i t => Applicative m => (a -> m b) -> t a -> m (t b)
A default implementation of traverse
in terms of traverseWithIndex
collect :: forall f a b g. Distributive f => Functor g => (a -> f b) -> g a -> f (g b)
collectDefault :: forall a b f g. Distributive f => Functor g => (a -> f b) -> g a -> f (g b)
A default implementation of collect
, based on distribute
.
parTraverse :: forall f m t a b. Parallel f m => Applicative f => Traversable t => (a -> m b) -> t a -> m (t b)
Traverse a collection in parallel.
crosswalk :: forall f t a b. Crosswalk f => Alignable t => (a -> t b) -> f a -> t (f b)
traverseByWither :: forall t m a b. Witherable t => Applicative m => (a -> m b) -> t a -> m (t b)
A default implementation of traverse
given a Witherable
.
traverse :: forall m p q a b. Dissect p q => MonadRec m => (a -> m b) -> p a -> m (p b)
A tail-recursive traverse
operation, implemented in terms of Dissect
.
Derived from: https://blog.functorial.com/posts/2017-06-18-Stack-Safe-Traversals-via-Dissection.html
traverse :: forall t m b a. HasTraverse t => HasApply m => HasMap m => HasPure m => (a -> m b) -> t a -> m (t b)
oneOfMap :: forall f g a b. Foldable f => Plus g => (a -> g b) -> f a -> g b
Folds a structure into some Plus
.
parOneOfMap :: forall a b t m f. Parallel f m => Alternative f => Foldable t => Functor t => (a -> m b) -> t a -> m b
Race a collection in parallel while mapping to some effect.
bindFlipped :: forall m a b. Bind m => (a -> m b) -> m a -> m b
bindFlipped
is bind
with its arguments reversed. For example:
print =<< random
chain :: forall a c b. HasChain a => (b -> a c) -> a b -> a c
experiment :: forall f a w s. ComonadStore s w => Functor f => (s -> f s) -> w a -> f a
Extract a collection of values from positions which depend on the current position.
iterateM :: forall b a m. Monad m => (a -> m a) -> m a -> m b
oneOfMap :: forall f a b s. Convert s (Statements a) => Plus f => (a -> f b) -> s -> f b
parOneOfMap :: forall m f a b s. Convert s (Statements a) => Parallel f m => Alternative f => (a -> m b) -> s -> m b
liftA1 :: forall f a b. Applicative f => (a -> b) -> f a -> f b
liftA1
provides a default implementation of (<$>)
for any
Applicative
functor, without using (<$>)
as provided
by the Functor
-Applicative
superclass
relationship.
liftA1
can therefore be used to write Functor
instances
as follows:
instance functorF :: Functor F where
map = liftA1
liftM1 :: forall m a b. Monad m => (a -> b) -> m a -> m b
liftM1
provides a default implementation of (<$>)
for any
Monad
, without using (<$>)
as provided by the
Functor
-Monad
superclass relationship.
liftM1
can therefore be used to write Functor
instances
as follows:
instance functorF :: Functor F where
map = liftM1
map :: forall f a b. Functor f => (a -> b) -> f a -> f b
mapDefault :: forall i f a b. FunctorWithIndex i f => (a -> b) -> f a -> f b
A default implementation of Functor's map
in terms of mapWithIndex
squigglyMap :: forall f a b. Functor f => (a -> b) -> f a -> f b
transCataTM :: forall t f m. Recursive t f => Corecursive t f => Monad m => Traversable f => (t -> m t) -> t -> m t
map :: forall p q a b. Dissect p q => (a -> b) -> p a -> p b
A tail-recursive map
operation, implemented in terms of Dissect
.
defaultFilter :: forall a h f. BooleanEq h => Applicative f => Foldable f => Monoid (f a) => (a -> h) -> f a -> f a
everywhereM :: forall m a. Monad m => Data a => (forall b. Data b => b -> m b) -> a -> m a
Apply a monadic transformation everywhere, bottom-up
filter :: forall f h a. Filterable f => BooleanEq h => (a -> h) -> f a -> f a
gmapM :: forall m a. Data a => Monad m => (forall d. Data d => d -> m d) -> a -> m a
A generic monadic transformation that maps over the immediate subterms
gmapMo :: forall m a. Data a => MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a
Transformation of one immediate subterm with success
gmapMp :: forall m a. Data a => MonadPlus m => (forall d. Data d => d -> m d) -> a -> m a
Transformation of at least one immediate subterm does not fail
map :: forall a c b. HasMap a => (b -> c) -> a b -> a c
map :: forall f a b. Functor f => (a -> b) -> f a -> f b
mkM :: forall a b m. Typeable a => Typeable b => Typeable (m a) => Typeable (m b) => Applicative m => (b -> m b) -> a -> m a
cmap :: forall f a b. Contravariant f => (b -> a) -> f a -> f b
censor :: forall w m a. MonadWriter w m => (w -> w) -> m a -> m a
Modify the final accumulator value by applying a function.
local :: forall e w a. ComonadEnv e w => (e -> e) -> w a -> w a
local :: forall r m a. MonadReader r m => (r -> r) -> m a -> m a
seeks :: forall s a w. ComonadStore s w => (s -> s) -> w a -> w a
Reposition the focus at the specified position, which depends on the current position.
censorAccum :: forall acc html a. Accum acc html => (acc -> acc) -> html a -> html a
setCtx :: forall ctx html a. Ctx ctx html => (ctx -> ctx) -> html a -> html a
mapErr :: forall e m a. MonadError e m => (e -> e) -> m a -> m a
all :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b
all f
is the same as and <<< map f
; map a function over the structure,
and then get the conjunction of the results.
any :: forall a b f. Foldable f => HeytingAlgebra b => (a -> b) -> f a -> b
any f
is the same as or <<< map f
; map a function over the structure,
and then get the disjunction of the results.
foldMap :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m
foldMap1 :: forall t a m. Foldable1 t => Semigroup m => (a -> m) -> t a -> m
foldMap1DefaultL :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m
A default implementation of foldMap1
using foldl1
.
Note: when defining a Foldable1
instance, this function is unsafe to use
in combination with foldl1Default
.
foldMap1DefaultR :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m
A default implementation of foldMap1
using foldr1
.
Note: when defining a Foldable1
instance, this function is unsafe to use
in combination with foldr1Default
.