# Search results

### censor

``censor :: forall w m a. MonadWriter w m => (w -> w) -> m a -> m a``

Modify the final accumulator value by applying a function.

### liftA1

``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
``````
P prelude M Control.Applicative

### liftM1

``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
``````

### mapDefault

``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`

P foldable-traversable M Data.FunctorWithIndex

### seeks

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

### all

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

P foldable-traversable M Data.Foldable

### any

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

P foldable-traversable M Data.Foldable

### applyFirst

``applyFirst :: forall a b f. Apply f => f a -> f b -> f a``

Combine two effectful actions, keeping only the result of the first.

P prelude M Control.Apply

### applySecond

``applySecond :: forall a b f. Apply f => f a -> f b -> f b``

Combine two effectful actions, keeping only the result of the second.

P prelude M Control.Apply

``asks :: forall e1 e2 w. ComonadEnv e1 w => (e1 -> e2) -> w e1 -> e2``

Get a value which depends on the environment.

### choose

``choose :: forall m a. MonadGen m => m a -> m a -> m a``

Creates a generator that outputs a value chosen from one of two existing existing generators with even probability.

### foldMap1Default

``foldMap1Default :: forall t m a. Foldable1 t => Functor t => Semigroup m => (a -> m) -> t a -> m``

A default implementation of `foldMap1` using `fold1`.

P foldable-traversable M Data.Semigroup.Foldable

### foldMapDefault

``foldMapDefault :: forall i f a m. FoldableWithIndex i f => Monoid m => (a -> m) -> f a -> m``

A default implementation of `foldMap` using `foldMapWithIndex`

P foldable-traversable M Data.FoldableWithIndex

### foldMapDefaultL

``foldMapDefaultL :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m``

A default implementation of `foldMap` using `foldl`.

Note: when defining a `Foldable` instance, this function is unsafe to use in combination with `foldlDefault`.

P foldable-traversable M Data.Foldable

### foldMapDefaultR

``foldMapDefaultR :: forall f a m. Foldable f => Monoid m => (a -> m) -> f a -> m``

A default implementation of `foldMap` using `foldr`.

Note: when defining a `Foldable` instance, this function is unsafe to use in combination with `foldrDefault`.

P foldable-traversable M Data.Foldable

### peeks

``peeks :: forall s a w. ComonadStore s w => (s -> s) -> w a -> a``

Extract a value from a position which depends on the current position.

### tracks

``tracks :: forall w a t. ComonadTraced t w => (a -> t) -> w a -> a``

Extracts a value at a relative position which depends on the current value.

### seek

``seek :: forall s a w. ComonadStore s w => s -> w a -> w a``

Reposition the focus at the specified position.

### voidRight

``voidRight :: forall f a b. Functor f => a -> f b -> f a``

Ignore the return value of a computation, using the specified return value instead.

P prelude M Data.Functor

### apply

``apply :: forall a b. (a -> b) -> a -> b``

Applies a function to an argument. This is primarily used as the operator `(\$)` which allows parentheses to be omitted in some cases, or as a natural way to apply a chain of composed functions to a value.

P prelude M Data.Function

### op

``op :: forall t a. Newtype t a => (a -> t) -> t -> a``

Deprecated previous name of `un`.

P newtype M Data.Newtype

### un

``un :: forall t a. Newtype t a => (a -> t) -> t -> a``

Given a constructor for a `Newtype`, this returns the appropriate `unwrap` function.

P newtype M Data.Newtype

### voidLeft

``voidLeft :: forall f a b. Functor f => f a -> b -> f b``

A version of `voidRight` with its arguments flipped.

P prelude M Data.Functor

``asks :: forall r m a. MonadAsk r m => (r -> a) -> m a``

Projects a value from the global context in a `MonadAsk`.

### duplicate

``duplicate :: forall a w. Extend w => w a -> w (w a)``

`duplicate` is dual to `Control.Bind.join`.

P control M Control.Extend

### enumFromTo

``enumFromTo :: forall a u. Enum a => Unfoldable1 u => a -> a -> u a``

Returns a contiguous sequence of elements from the first value to the second value (inclusive).

``````enumFromTo 0 3 = [0, 1, 2, 3]
enumFromTo 'c' 'a' = ['c', 'b', 'a']
``````

The example shows `Array` return values, but the result can be any type with an `Unfoldable1` instance.

P enums M Data.Enum

### fix

``fix :: forall l. Lazy l => (l -> l) -> l``

`fix` defines a value as the fixed point of a function.

The `Lazy` instance allows us to generate the result lazily.

P control M Control.Lazy

### gets

``gets :: forall s m a. MonadState s m => (s -> a) -> m a``

Get a value which depends on the current state.

### intercalate

``intercalate :: forall f m. Foldable f => Monoid m => m -> f m -> m``

Fold a data structure, accumulating values in some `Monoid`, combining adjacent elements using the specified separator.

P foldable-traversable M Data.Foldable

### intercalate

``intercalate :: forall f m. Foldable1 f => Semigroup m => m -> f m -> m``

Fold a data structure using a `Semigroup` instance, combining adjacent elements using the specified separator.

P foldable-traversable M Data.Semigroup.Foldable

### modify

``modify :: forall s m. MonadState s m => (s -> s) -> m s``

Modify the state by applying a function to the current state. The returned value is the new state value.

### surround

``surround :: forall f m. Foldable f => Semigroup m => m -> f m -> m``

`fold` but with each element surrounded by some fixed value.

For example:

``````> surround "*" []
= "*"

> surround "*" ["1"]
= "*1*"

> surround "*" ["1", "2"]
= "*1*2*"

> surround "*" ["1", "2", "3"]
= "*1*2*3*"
``````
P foldable-traversable M Data.Foldable

### unfoldable

``unfoldable :: forall m f a. 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.

### and

``and :: forall a f. 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`.

P foldable-traversable M Data.Foldable

### coerce

``coerce :: forall f a b. Contravariant f => Functor f => f a -> f b``
P contravariant M Data.Functor.Contravariant

### const

``const :: forall a b. a -> b -> a``

Returns its first argument and ignores its second.

``````const 1 "hello" = 1
``````
P prelude M Data.Function

### elements

``elements :: forall m f a. MonadGen m => Foldable1 f => f a -> m a``

Creates a generator that outputs a value chosen from a selection with uniform probability.

### fold

``fold :: forall f m. Foldable f => Monoid m => f m -> m``

Fold a data structure, accumulating values in some `Monoid`.

P foldable-traversable M Data.Foldable

### fold1Default

``fold1Default :: forall t m. Foldable1 t => Semigroup m => t m -> m``

A default implementation of `fold1` using `foldMap1`.

P foldable-traversable M Data.Semigroup.Foldable

### forever

``forever :: forall m a b. 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!"
``````

### gcd

``gcd :: forall a. Eq a => EuclideanRing a => a -> a -> a``

The greatest common divisor of two values.

P prelude M Data.EuclideanRing

### genericAppend

``genericAppend :: forall a rep. Generic a rep => GenericSemigroup rep => a -> a -> a``

A `Generic` implementation of the `append` member from the `Semigroup` type class.

P generics-rep M Data.Generic.Rep.Semigroup

### lcm

``lcm :: forall a. Eq a => EuclideanRing a => a -> a -> a``

The least common multiple of two values.

P prelude M Data.EuclideanRing

### leftDiv

``leftDiv :: forall a. DivisionRing a => a -> a -> a``

Left division, defined as `leftDiv a b = recip b * a`. Left and right division are distinct in this module because a `DivisionRing` is not necessarily commutative.

If the type `a` is also a `EuclideanRing`, then this function is equivalent to `div` from the `EuclideanRing` class. When working abstractly, `div` should generally be preferred, unless you know that you need your code to work with noncommutative rings.

P prelude M Data.DivisionRing

### length

``length :: forall a b f. 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.

P foldable-traversable M Data.Foldable

### max

``max :: forall a. Ord a => a -> a -> a``

Take the maximum of two values. If they are considered equal, the first argument is chosen.

P prelude M Data.Ord

### min

``min :: forall a. Ord a => a -> a -> a``

Take the minimum of two values. If they are considered equal, the first argument is chosen.

P prelude M Data.Ord

### or

``or :: forall a f. Foldable f => HeytingAlgebra a => f a -> a``

The disjunction of all the values in a data structure. When specialized to `Boolean`, this function will test whether any of the values in a data structure is `true`.

P foldable-traversable M Data.Foldable

### product

``product :: forall a f. Foldable f => Semiring a => f a -> a``

Find the product of the numeric values in a data structure.

P foldable-traversable M Data.Foldable

### rightDiv

``rightDiv :: forall a. DivisionRing a => a -> a -> a``

Right division, defined as `rightDiv a b = a * recip b`. Left and right division are distinct in this module because a `DivisionRing` is not necessarily commutative.

If the type `a` is also a `EuclideanRing`, then this function is equivalent to `div` from the `EuclideanRing` class. When working abstractly, `div` should generally be preferred, unless you know that you need your code to work with noncommutative rings.

P prelude M Data.DivisionRing