Search results
sequence :: forall t m a. Traversable t => Applicative m => t (m a) -> m (t a)
sequence1 :: forall t f b. Traversable1 t => Apply f => t (f b) -> f (t b)
sequence1Default :: forall m a t. Traversable1 t => Apply m => t (m a) -> m (t a)
A default implementation of sequence1
using traverse1
.
sequenceDefault :: forall m a t. Traversable t => Applicative m => t (m a) -> m (t a)
A default implementation of sequence
using traverse
.
distribute :: forall f g a. Distributive f => Functor g => g (f a) -> f (g a)
distributeDefault :: forall g f a. Distributive f => Functor g => g (f a) -> f (g a)
A default implementation of distribute
, based on collect
.
parSequence :: forall f m t a. Parallel f m => Traversable t => t (m a) -> m (t a)
sequence :: forall c b a. HasApply b => HasMap b => HasTraverse a => HasPure b => a (b c) -> b (a c)
Sequences actions and collects the results.
sequence [Just 1, Just 2] -- Just [1, 2]
oneOf :: forall a g f. Foldable f => Plus g => f (g a) -> g a
Combines a collection of elements using the Alt
operation.
oneOf :: forall a f m. MonadGen m => Foldable1 f => f (m a) -> m a
Creates a generator that outputs a value chosen from a selection of existing generators with uniform probability.
parOneOf :: forall f m t a. Parallel f m => Alternative f => Foldable t => Functor t => t (m a) -> m a
Race a collection in parallel.
unwrapCofree :: forall f w a. ComonadCofree f w => w a -> f (w a)
wrapFree :: forall f m a. MonadFree f m => f (m a) -> m a
choice :: forall a g f. Foldable f => Alt g => Plus g => f (g a) -> g a
oneOf :: forall a m f. Foldable f => Alternative m => f (m a) -> m a
restoreM :: forall base m stM a. MonadBaseControl base m stM => base (stM a) -> m a
join :: forall m a. Bind m => m (m a) -> m a
Collapse two applications of a monadic type constructor into one.
duplicate :: forall w a. Extend w => w a -> w (w a)
Duplicate a comonadic context.
duplicate
is dual to Control.Bind.join
.
keepLatest :: forall event a. IsEvent event => event (event a) -> event a
join :: forall v m c. HasBind c m => HasIdentity c => ObjectOf c (m v) => m (m v) -> m v
flatten :: forall b a. HasChain a => a (a b) -> a b
Removes a level of nesting from a container.
flatten [[1, 2], [3, 4]] -- [1, 2, 3, 4]
warbler :: forall m a. Bind m => m (m a) -> m a
W combinator - warbler - omega
MM
Λ a b . (a → a → b) → a → b
λ f x . f x x
unfoldable :: forall a f m. MonadRec m => MonadGen m => Unfoldable f => m a -> m (f a)
Creates a generator that produces unfoldable structures based on an existing generator for the elements.
The size of the unfoldable will be determined by the current size state
for the generator. To generate an unfoldable structure of a particular
size, use the resize
function from the MonadGen
class first.
fork :: forall f m a. MonadFork f m => m a -> m (f a)
suspend :: forall f m a. MonadFork f m => m a -> m (f a)
integrateM :: forall a stM m base. Applicative base => MonadBaseControl base m stM => m (stM a) -> m a
Pack a state belonging to m
back into it, instead of throwing it away
lift :: forall a g f. Applicative f => Applicative g => a -> f (g a)
elements :: forall a f m. MonadGen m => Foldable1 f => f a -> m a
Creates a generator that outputs a value chosen from a selection with uniform probability.
inj :: forall f g a. Inject f g => f a -> g a
join :: forall f m a. MonadFork f m => f a -> m a
liftBase :: forall b m a. MonadBase b m => b a -> m a
forever :: forall b a m. MonadRec m => m a -> m b
forever
runs an action indefinitely, using the MonadRec
instance to
ensure constant stack usage.
For example:
main = forever $ trace "Hello, World!"
coerce :: forall b a f. Contravariant f => Functor f => f a -> f b
uninterruptible :: forall e f m a. MonadBracket e f m => m a -> m a
cleared :: forall b a f. Filterable f => f a -> f b
Filter out all values.
folded :: forall a event. IsEvent event => Monoid a => event a -> event a
Combine subsequent events using a Monoid
.
sort :: forall a f. Functor f => Foldable f => Unfoldable f => Ord a => f a -> f a
Sort any structure (which has Foldable, Unfoldable, and Functor instances) by converting to an OrdSeq and back again. I am fairly sure this is usually O(n*log(n)), although of course this depends on the Unfoldable and Foldable instances.
restoreAfter :: forall a m. MonadCanvasAction m => m a -> m a
Runs save
, then the provided action, then restore
forever :: forall b a m. Monad m => m a -> m b
lookAhead :: forall m a. LookAheadParsing m => m a -> m a
once :: forall a m. MonadLogic m => m a -> m a
try :: forall m a. Parsing m => m a -> m a
pure :: forall f a. Applicative f => a -> f a
extract :: forall w a. Comonad w => w a -> a
and :: forall f a. Foldable f => HeytingAlgebra a => f a -> a
The conjunction of all the values in a data structure. When specialized
to Boolean
, this function will test whether all of the values in a data
structure are true
.
fold :: forall m f. Foldable f => Monoid m => f m -> m
Fold a data structure, accumulating values in some Monoid
.
fold1 :: forall t m. Foldable1 t => Semigroup m => t m -> m
fold1Default :: forall m t. Foldable1 t => Semigroup m => t m -> m
A default implementation of fold1
using foldMap1
.
length :: forall f b a. Foldable f => Semiring b => f a -> b
Returns the size/length of a finite structure. Optimized for structures that are similar to cons-lists, because there is no general way to do better.
maximum :: forall a f. Ord a => Foldable1 f => f a -> a