constrictor-0.1.1.0: strict versions of many things in base

Safe HaskellNone
LanguageHaskell2010

Constrictor

Contents

Description

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).

Synopsis

Strict monadic functions

(<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 Source #

Strict version of <$>

fmap' :: Monad m => (a -> b) -> m a -> m b infixl 4 Source #

liftM' :: Monad m => (a -> b) -> m a -> m b infixl 4 Source #

Strict version of liftM.

Note this is equivalent to <$!>, and is provided for convenience.

liftM2' :: Monad m => (a -> b -> c) -> m a -> m b -> m c Source #

Strict version of liftM2.

liftM3' :: Monad m => (a -> b -> c -> d) -> m a -> m b -> m c -> m d Source #

Strict version of liftM3.

liftM4' :: Monad m => (a -> b -> c -> d -> e) -> m a -> m b -> m c -> m d -> m e Source #

Strict version of liftM4.

liftM5' :: Monad m => (a -> b -> c -> d -> e -> f) -> m a -> m b -> m c -> m d -> m e -> m f Source #

Strict version of liftM5.

ap' :: Monad m => m (a -> b) -> m a -> m b Source #

Strict version of ap

Strict traversable functions

traverse' :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) Source #

Strict version of traverse.

mapM' :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) Source #

Strict version of mapM.

This is just traverse' specialised to Monad.

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.

Strict monadic folds

foldlMapM' :: forall t b a m. (Foldable t, Monoid b, Monad m) => (a -> m b) -> t a -> m b Source #

Strict in the monoidal accumulator. For monads strict in the left argument of bind, this will run in constant space. Monoidal accumulation happens from left to right.

foldrMapM' :: forall t b a m. (Foldable t, Monoid b, Monad m) => (a -> m b) -> t a -> m b Source #

Types

Wrapped applicative functor

newtype Ap f a Source #

A wrapped applicative functor. Please note that base 4.12.0.0 will include this type, and it will be removed from this library at that point.

Constructors

Ap 

Fields

Instances

Monad f => Monad (Ap f) Source # 

Methods

(>>=) :: Ap f a -> (a -> Ap f b) -> Ap f b #

(>>) :: Ap f a -> Ap f b -> Ap f b #

return :: a -> Ap f a #

fail :: String -> Ap f a #

Functor f => Functor (Ap f) Source # 

Methods

fmap :: (a -> b) -> Ap f a -> Ap f b #

(<$) :: a -> Ap f b -> Ap f a #

MonadFix f => MonadFix (Ap f) Source # 

Methods

mfix :: (a -> Ap f a) -> Ap f a #

MonadFail f => MonadFail (Ap f) Source # 

Methods

fail :: String -> Ap f a #

Applicative f => Applicative (Ap f) Source # 

Methods

pure :: a -> Ap f a #

(<*>) :: Ap f (a -> b) -> Ap f a -> Ap f b #

liftA2 :: (a -> b -> c) -> Ap f a -> Ap f b -> Ap f c #

(*>) :: Ap f a -> Ap f b -> Ap f b #

(<*) :: Ap f a -> Ap f b -> Ap f a #

Foldable f => Foldable (Ap f) Source # 

Methods

fold :: Monoid m => Ap f m -> m #

foldMap :: Monoid m => (a -> m) -> Ap f a -> m #

foldr :: (a -> b -> b) -> b -> Ap f a -> b #

foldr' :: (a -> b -> b) -> b -> Ap f a -> b #

foldl :: (b -> a -> b) -> b -> Ap f a -> b #

foldl' :: (b -> a -> b) -> b -> Ap f a -> b #

foldr1 :: (a -> a -> a) -> Ap f a -> a #

foldl1 :: (a -> a -> a) -> Ap f a -> a #

toList :: Ap f a -> [a] #

null :: Ap f a -> Bool #

length :: Ap f a -> Int #

elem :: Eq a => a -> Ap f a -> Bool #

maximum :: Ord a => Ap f a -> a #

minimum :: Ord a => Ap f a -> a #

sum :: Num a => Ap f a -> a #

product :: Num a => Ap f a -> a #

Traversable f => Traversable (Ap f) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Ap f a -> f (Ap f b) #

sequenceA :: Applicative f => Ap f (f a) -> f (Ap f a) #

mapM :: Monad m => (a -> m b) -> Ap f a -> m (Ap f b) #

sequence :: Monad m => Ap f (m a) -> m (Ap f a) #

Alternative f => Alternative (Ap f) Source # 

Methods

empty :: Ap f a #

(<|>) :: Ap f a -> Ap f a -> Ap f a #

some :: Ap f a -> Ap f [a] #

many :: Ap f a -> Ap f [a] #

MonadPlus f => MonadPlus (Ap f) Source # 

Methods

mzero :: Ap f a #

mplus :: Ap f a -> Ap f a -> Ap f a #

Generic1 * (Ap f) Source # 

Associated Types

type Rep1 (Ap f) (f :: Ap f -> *) :: k -> * #

Methods

from1 :: f a -> Rep1 (Ap f) f a #

to1 :: Rep1 (Ap f) f a -> f a #

Enum (f a) => Enum (Ap f a) Source # 

Methods

succ :: Ap f a -> Ap f a #

pred :: Ap f a -> Ap f a #

toEnum :: Int -> Ap f a #

fromEnum :: Ap f a -> Int #

enumFrom :: Ap f a -> [Ap f a] #

enumFromThen :: Ap f a -> Ap f a -> [Ap f a] #

enumFromTo :: Ap f a -> Ap f a -> [Ap f a] #

enumFromThenTo :: Ap f a -> Ap f a -> Ap f a -> [Ap f a] #

Eq (f a) => Eq (Ap f a) Source # 

Methods

(==) :: Ap f a -> Ap f a -> Bool #

(/=) :: Ap f a -> Ap f a -> Bool #

Num (f a) => Num (Ap f a) Source # 

Methods

(+) :: Ap f a -> Ap f a -> Ap f a #

(-) :: Ap f a -> Ap f a -> Ap f a #

(*) :: Ap f a -> Ap f a -> Ap f a #

negate :: Ap f a -> Ap f a #

abs :: Ap f a -> Ap f a #

signum :: Ap f a -> Ap f a #

fromInteger :: Integer -> Ap f a #

Ord (f a) => Ord (Ap f a) Source # 

Methods

compare :: Ap f a -> Ap f a -> Ordering #

(<) :: Ap f a -> Ap f a -> Bool #

(<=) :: Ap f a -> Ap f a -> Bool #

(>) :: Ap f a -> Ap f a -> Bool #

(>=) :: Ap f a -> Ap f a -> Bool #

max :: Ap f a -> Ap f a -> Ap f a #

min :: Ap f a -> Ap f a -> Ap f a #

Read (f a) => Read (Ap f a) Source # 

Methods

readsPrec :: Int -> ReadS (Ap f a) #

readList :: ReadS [Ap f a] #

readPrec :: ReadPrec (Ap f a) #

readListPrec :: ReadPrec [Ap f a] #

Show (f a) => Show (Ap f a) Source # 

Methods

showsPrec :: Int -> Ap f a -> ShowS #

show :: Ap f a -> String #

showList :: [Ap f a] -> ShowS #

Generic (Ap f a) Source # 

Associated Types

type Rep (Ap f a) :: * -> * #

Methods

from :: Ap f a -> Rep (Ap f a) x #

to :: Rep (Ap f a) x -> Ap f a #

(Applicative f, Semigroup a) => Semigroup (Ap f a) Source # 

Methods

(<>) :: Ap f a -> Ap f a -> Ap f a #

sconcat :: NonEmpty (Ap f a) -> Ap f a #

stimes :: Integral b => b -> Ap f a -> Ap f a #

(Applicative f, Monoid a) => Monoid (Ap f a) Source # 

Methods

mempty :: Ap f a #

mappend :: Ap f a -> Ap f a -> Ap f a #

mconcat :: [Ap f a] -> Ap f a #

type Rep1 * (Ap f) Source # 
type Rep1 * (Ap f) = D1 * (MetaData "Ap" "Constrictor" "constrictor-0.1.1.0-7n16Q7AfpcmHeb7BJal3ge" True) (C1 * (MetaCons "Ap" PrefixI True) (S1 * (MetaSel (Just Symbol "getAp") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 * f)))
type Rep (Ap f a) Source # 
type Rep (Ap f a) = D1 * (MetaData "Ap" "Constrictor" "constrictor-0.1.1.0-7n16Q7AfpcmHeb7BJal3ge" True) (C1 * (MetaCons "Ap" PrefixI True) (S1 * (MetaSel (Just Symbol "getAp") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * (f a))))