Safe Haskell | None |
---|---|
Language | Haskell2010 |
This library provides strict versions of many functions in base, as well as a few functions that do not have lazy versions that exist in base (see the section on Folds).
Many functions in this library have an increased constraint from Functor/Applicative to Monad in order to achieve strictness in their arguments and/or result.
- (<$!>) :: Monad m => (a -> b) -> m a -> m b
- fmap' :: Monad m => (a -> b) -> m a -> m b
- liftM' :: Monad m => (a -> b) -> m a -> m b
- liftM2' :: Monad m => (a -> b -> c) -> m a -> m b -> m c
- liftM3' :: Monad m => (a -> b -> c -> d) -> m a -> m b -> m c -> m d
- liftM4' :: Monad m => (a -> b -> c -> d -> e) -> m a -> m b -> m c -> m d -> m e
- liftM5' :: Monad m => (a -> b -> c -> d -> e -> f) -> m a -> m b -> m c -> m d -> m e -> m f
- ap' :: Monad m => m (a -> b) -> m a -> m b
- traverse' :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
- traverse'' :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- mapM' :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
- foldrMap :: (Monoid m, Foldable t) => (a -> m) -> t a -> m
- foldlMap :: (Monoid m, Foldable t) => (a -> m) -> t a -> m
- foldrMap' :: (Monoid m, Foldable t) => (a -> m) -> t a -> m
- foldlMap' :: (Monoid m, Foldable t) => (a -> m) -> t a -> m
- foldlMapA :: forall t b a f. (Foldable t, Monoid b, Applicative f) => (a -> f b) -> t a -> f b
- foldrMapA :: forall t b a f. (Foldable t, Monoid b, Applicative f) => (a -> f b) -> t a -> f b
- foldlMapM' :: forall t b a m. (Foldable t, Monoid b, Monad m) => (a -> m b) -> t a -> m b
- foldrMapM' :: forall t b a m. (Foldable t, Monoid b, Monad m) => (a -> m b) -> t a -> m b
Strict lifting functions
(<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 Source #
This is <$>
, but strict in its
argument and result.
This is re-defined in this module, and not just re-exported from Control.Monad. The reason for this is that there is no way to hide the docs for re-exports with Haddocks.
In the common case that one might import Control.Monad, we recommend structuring imports like so:
import Control.Monad hiding ((<$!>)) import Constrictor
or
import Control.Monad import Constrictor hiding ((<$!>))
There should be no unintended side effects introduced as a result of structuring one's imports in this way.
liftM2' :: Monad m => (a -> b -> c) -> m a -> m b -> m c Source #
This is liftM2
, but strict in its
arguments and result.
liftM3' :: Monad m => (a -> b -> c -> d) -> m a -> m b -> m c -> m d Source #
This is liftM3
, but strict in its
arguments and result.
liftM4' :: Monad m => (a -> b -> c -> d -> e) -> m a -> m b -> m c -> m d -> m e Source #
This is liftM4
, but strict in its
arguments and result.
liftM5' :: Monad m => (a -> b -> c -> d -> e -> f) -> m a -> m b -> m c -> m d -> m e -> m f Source #
This is liftM5
, but strict in its
arguments and result.
ap' :: Monad m => m (a -> b) -> m a -> m b Source #
This is ap
, but strict in its
arguments and result.
traverse' :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) Source #
Strict version of traverse
.
traverse'' :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) Source #
Stricter version of traverse
.
mapM' :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) Source #
Folds
Lazy monoidal folds
foldrMap :: (Monoid m, Foldable t) => (a -> m) -> t a -> m Source #
Map each element of a foldable structure to a monoid, and combine the results. This function is right-associative.
Note that this is equivalent to foldMap
.
foldlMap :: (Monoid m, Foldable t) => (a -> m) -> t a -> m Source #
Map each element of a foldable structure to a monoid, and combine the results. This function is left-associative.
The operator is applied lazily. For a strict version, see
foldlMap'
.
Strict monoidal folds
foldrMap' :: (Monoid m, Foldable t) => (a -> m) -> t a -> m Source #
Map each element of a foldable structure to a monoid, and combine the results. This function is right-associative.
Note that this is equivalent to foldMap
,
but is strict.
foldlMap' :: (Monoid m, Foldable t) => (a -> m) -> t a -> m Source #
Map each element of a foldable structure to a monoid, and combine the results. This function is left-associative.
The operator is applied strictly. For a lazy version, see
foldlMap
.
Lazy applicative folds
foldlMapA :: forall t b a f. (Foldable t, Monoid b, Applicative f) => (a -> f b) -> t a -> f b Source #
Lazy in the monoidal accumulator. Monoidal accumulation happens from left to right.
foldrMapA :: forall t b a f. (Foldable t, Monoid b, Applicative f) => (a -> f b) -> t a -> f b Source #
Lazy in the monoidal accumulator. Monoidal accumulation happens from left to right.