# Stuff

- Package
- purescript-stuff
- Repository
- rightfold/purescript-stuff

### #logWarning Source

`logWarning :: forall m. MonadIOSync m => String -> m Unit`

### #dlmap Source

`dlmap :: forall a b c p. Profunctor p => (a -> b) -> p b c -> p a c`

### #drmap Source

`drmap :: forall a b c p. Profunctor p => (b -> c) -> p a b -> p a c`

### #compose2 Source

`compose2 :: forall t100 t101 t102 t98 t99. Semigroupoid t99 => t99 t101 t100 -> (t98 -> t99 t102 t101) -> t98 -> t99 t102 t100`

### #compose3 Source

`compose3 :: forall t86 t90 t91 t92 t93 t94. Semigroupoid t91 => t91 t93 t92 -> (t86 -> t90 -> t91 t94 t93) -> t86 -> t90 -> t91 t94 t92`

### #compose4 Source

`compose4 :: forall t70 t74 t78 t79 t80 t81 t82. Semigroupoid t79 => t79 t81 t80 -> (t70 -> t74 -> t78 -> t79 t82 t81) -> t70 -> t74 -> t78 -> t79 t82 t80`

### #compose5 Source

`compose5 :: forall t50 t54 t58 t62 t63 t64 t65 t66. Semigroupoid t63 => t63 t65 t64 -> (t50 -> t54 -> t58 -> t62 -> t63 t66 t65) -> t50 -> t54 -> t58 -> t62 -> t63 t66 t64`

## Re-exports from **Control.**Alt

### #Alt Source

`class (Functor f) <= Alt f `

The `Alt`

type class identifies an associative operation on a type
constructor. It is similar to `Semigroup`

, except that it applies to
types of kind `* -> *`

, like `Array`

or `List`

, rather than concrete types
`String`

or `Number`

.

`Alt`

instances are required to satisfy the following laws:

- Associativity:
`(x <|> y) <|> z == x <|> (y <|> z)`

- Distributivity:
`f <$> (x <|> y) == (f <$> x) <|> (f <$> y)`

For example, the `Array`

(`[]`

) type is an instance of `Alt`

, where
`(<|>)`

is defined to be concatenation.

#### Instances

## Re-exports from **Control.**Alternative

### #Alternative Source

`class (Applicative f, Plus f) <= Alternative f `

The `Alternative`

type class has no members of its own; it just specifies
that the type constructor has both `Applicative`

and `Plus`

instances.

Types which have `Alternative`

instances should also satisfy the following
laws:

- Distributivity:
`(f <|> g) <*> x == (f <*> x) <|> (g <*> x)`

- Annihilation:
`empty <*> f = empty`

#### Instances

## Re-exports from **Control.**Apply

### #lift5

`lift5 :: forall a b c d e f g. Apply f => (a -> b -> c -> d -> e -> g) -> f a -> f b -> f c -> f d -> f e -> f g`

Lift a function of five arguments to a function which accepts and returns
values wrapped with the type constructor `f`

.

### #lift4

`lift4 :: forall a b c d e f. Apply f => (a -> b -> c -> d -> e) -> f a -> f b -> f c -> f d -> f e`

Lift a function of four arguments to a function which accepts and returns
values wrapped with the type constructor `f`

.

### #lift3

`lift3 :: forall a b c d f. Apply f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d`

Lift a function of three arguments to a function which accepts and returns
values wrapped with the type constructor `f`

.

### #lift2

`lift2 :: forall a b c f. Apply f => (a -> b -> c) -> f a -> f b -> f c`

Lift a function of two arguments to a function which accepts and returns
values wrapped with the type constructor `f`

.

## Re-exports from **Control.**Biapplicative

### #Biapplicative Source

`class (Biapply w) <= Biapplicative w where`

`Biapplicative`

captures type constructors of two arguments which support lifting of
functions of zero or more arguments, in the sense of `Applicative`

.

#### Members

`bipure :: forall a b. a -> b -> w a b`

## Re-exports from **Control.**Biapply

### #(<<$>>) Source

Operator alias for Control.Category.id *(left-associative / precedence 4)*

A convenience operator which can be used to apply the result of `bipure`

in
the style of `Applicative`

:

```
bipure f g <<$>> x <<*>> y
```

## Re-exports from **Control.**Comonad

### #Comonad Source

`class (Extend w) <= Comonad w where`

`Comonad`

extends the `Extend`

class with the `extract`

function
which extracts a value, discarding the comonadic context.

`Comonad`

is the dual of `Monad`

, and `extract`

is the dual of `pure`

.

Laws:

- Left Identity:
`extract <<= xs = xs`

- Right Identity:
`extract (f <<= xs) = f xs`

#### Members

`extract :: forall a. w a -> a`

## Re-exports from **Control.**Extend

### #Extend Source

`class (Functor w) <= Extend w where`

The `Extend`

class defines the extension operator `(<<=)`

which extends a local context-dependent computation to
a global computation.

`Extend`

is the dual of `Bind`

, and `(<<=)`

is the dual of
`(>>=)`

.

Laws:

- Associativity:
`extend f <<< extend g = extend (f <<< extend g)`

#### Members

`extend :: forall b a. (w a -> b) -> w a -> w b`

#### Instances

### #(=<=) Source

Operator alias for Control.Extend.composeCoKleisliFlipped *(right-associative / precedence 1)*

## Re-exports from **Control.**Monad.Aff.Class

## Re-exports from **Control.**Monad.Eff.Class

## Re-exports from **Control.**Monad.Eff.Exception

### #Error

`data Error :: Type`

The type of JavaScript errors

#### Instances

`Show Error`

## Re-exports from **Control.**Monad.IO

### #IO

`newtype IO a`

#### Instances

`Newtype (IO a) _`

`Functor IO`

`Apply IO`

`Applicative IO`

`Bind IO`

`Monad IO`

`MonadRec IO`

`(Semigroup a) => Semigroup (IO a)`

`(Monoid a) => Monoid (IO a)`

`MonadAff eff IO`

`Parallel ParIO IO`

`MonadEff eff IO`

`MonadThrow Error IO`

`MonadError Error IO`

`Alt IO`

`Plus IO`

`Alternative IO`

`MonadZero IO`

### #runIO'

`runIO' :: forall eff. IO ~> (Aff (infinity :: INFINITY | eff))`

### #runIO

`runIO :: IO ~> (Aff (infinity :: INFINITY))`

### #launchIO

`launchIO :: forall a. IO a -> IOSync Unit`

## Re-exports from **Control.**Monad.IO.Class

### #MonadIO

`class (Monad m) <= MonadIO m where`

#### Members

`liftIO :: IO ~> m`

#### Instances

`MonadIO IO`

`(MonadIO m) => MonadIO (ContT r m)`

`(MonadIO m) => MonadIO (ExceptT e m)`

`(MonadIO m) => MonadIO (ListT m)`

`(MonadIO m) => MonadIO (MaybeT m)`

`(MonadIO m) => MonadIO (ReaderT r m)`

`(MonadIO m, Monoid w) => MonadIO (RWST r w s m)`

`(MonadIO m) => MonadIO (StateT s m)`

`(MonadIO m, Monoid w) => MonadIO (WriterT w m)`

## Re-exports from **Control.**Monad.IOSync

### #IOSync

`newtype IOSync a`

#### Instances

`Newtype (IOSync a) _`

`Functor IOSync`

`Apply IOSync`

`Applicative IOSync`

`Bind IOSync`

`Monad IOSync`

`MonadRec IOSync`

`(Semigroup a) => Semigroup (IOSync a)`

`(Monoid a) => Monoid (IOSync a)`

`MonadEff eff IOSync`

`MonadError Error IOSync`

`MonadThrow Error IOSync`

`Alt IOSync`

`Plus IOSync`

`Alternative IOSync`

`MonadZero IOSync`

### #runIOSync'

`runIOSync' :: forall eff. IOSync ~> (Eff (infinity :: INFINITY | eff))`

### #runIOSync

`runIOSync :: IOSync ~> (Eff (infinity :: INFINITY))`

## Re-exports from **Control.**Monad.IOSync.Class

### #MonadIOSync

`class (Monad m) <= MonadIOSync m where`

#### Members

`liftIOSync :: IOSync ~> m`

#### Instances

`MonadIOSync IOSync`

`MonadIOSync IO`

`(MonadIOSync m) => MonadIOSync (ContT r m)`

`(MonadIOSync m) => MonadIOSync (ExceptT e m)`

`(MonadIOSync m) => MonadIOSync (ListT m)`

`(MonadIOSync m) => MonadIOSync (MaybeT m)`

`(MonadIOSync m) => MonadIOSync (ReaderT r m)`

`(MonadIOSync m, Monoid w) => MonadIOSync (RWST r w s m)`

`(MonadIOSync m) => MonadIOSync (StateT s m)`

`(MonadIOSync m, Monoid w) => MonadIOSync (WriterT w m)`

## Re-exports from **Control.**Monad.Rec.Class

### #MonadRec Source

`class (Monad m) <= MonadRec m where`

This type class captures those monads which support tail recursion in constant stack space.

The `tailRecM`

function takes a step function, and applies that step
function recursively until a pure value of type `b`

is found.

Instances are provided for standard monad transformers.

For example:

```
loopWriter :: Number -> WriterT Sum (Eff (trace :: Trace)) Unit
loopWriter n = tailRecM go n
where
go 0 = do
lift $ trace "Done!"
pure (Done unit)
go n = do
tell $ Sum n
pure (Loop (n - 1))
```

#### Members

#### Instances

### #tailRec Source

`tailRec :: forall a b. (a -> Step a b) -> a -> b`

Create a pure tail-recursive function of one argument

For example:

```
pow :: Number -> Number -> Number
pow n p = tailRec go { accum: 1, power: p }
where
go :: _ -> Step _ Number
go { accum: acc, power: 0 } = Done acc
go { accum: acc, power: p } = Loop { accum: acc * n, power: p - 1 }
```

## Re-exports from **Control.**MonadPlus

## Re-exports from **Control.**MonadZero

### #MonadZero Source

`class (Monad m, Alternative m) <= MonadZero m `

The `MonadZero`

type class has no members of its own; it just specifies
that the type has both `Monad`

and `Alternative`

instances.

Types which have `MonadZero`

instances should also satisfy the following
laws:

- Annihilation:
`empty >>= f = empty`

#### Instances

### #guard Source

`guard :: forall m. MonadZero m => Boolean -> m Unit`

Fail using `Plus`

if a condition does not hold, or
succeed using `Monad`

if it does.

For example:

```
import Prelude
import Control.Monad (bind)
import Control.MonadZero (guard)
import Data.Array ((..))
factors :: Int -> Array Int
factors n = do
a <- 1..n
b <- 1..n
guard $ a * b == n
pure a
```

## Re-exports from **Control.**Plus

### #Plus Source

`class (Alt f) <= Plus f where`

The `Plus`

type class extends the `Alt`

type class with a value that
should be the left and right identity for `(<|>)`

.

It is similar to `Monoid`

, except that it applies to types of
kind `* -> *`

, like `Array`

or `List`

, rather than concrete types like
`String`

or `Number`

.

`Plus`

instances should satisfy the following laws:

- Left identity:
`empty <|> x == x`

- Right identity:
`x <|> empty == x`

- Annihilation:
`f <$> empty == empty`

#### Members

`empty :: forall a. f a`

#### Instances

## Re-exports from **Data.**Bifoldable

### #Bifoldable

`class Bifoldable p where`

`Bifoldable`

represents data structures with two type arguments which can be
folded.

A fold for such a structure requires two step functions, one for each type argument. Type class instances should choose the appropriate step function based on the type of the element encountered at each point of the fold.

Default implementations are provided by the following functions:

`bifoldrDefault`

`bifoldlDefault`

`bifoldMapDefaultR`

`bifoldMapDefaultL`

Note: some combinations of the default implementations are unsafe to use together - causing a non-terminating mutually recursive cycle. These combinations are documented per function.

#### Members

`bifoldr :: forall a b c. (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c`

`bifoldl :: forall a b c. (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c`

`bifoldMap :: forall m a b. Monoid m => (a -> m) -> (b -> m) -> p a b -> m`

#### Instances

`(Foldable f) => Bifoldable (Clown f)`

`(Foldable f) => Bifoldable (Joker f)`

`(Bifoldable p) => Bifoldable (Flip p)`

`(Bifoldable f, Bifoldable g) => Bifoldable (Product f g)`

`(Bifoldable p) => Bifoldable (Wrap p)`

### #bitraverse_

`bitraverse_ :: forall t f a b c d. Bifoldable t => Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f Unit`

Traverse a data structure, accumulating effects using an `Applicative`

functor,
ignoring the final result.

### #bisequence_

`bisequence_ :: forall t f a b. Bifoldable t => Applicative f => t (f a) (f b) -> f Unit`

Collapse a data structure, collecting effects using an `Applicative`

functor,
ignoring the final result.

### #bifor_

`bifor_ :: forall t f a b c d. Bifoldable t => Applicative f => t a b -> (a -> f c) -> (b -> f d) -> f Unit`

A version of `bitraverse_`

with the data structure as the first argument.

### #bifold

`bifold :: forall t m. Bifoldable t => Monoid m => t m m -> m`

Fold a data structure, accumulating values in a monoidal type.

### #biany

`biany :: forall t a b c. Bifoldable t => BooleanAlgebra c => (a -> c) -> (b -> c) -> t a b -> c`

Test whether a predicate holds at any position in a data structure.

### #biall

`biall :: forall t a b c. Bifoldable t => BooleanAlgebra c => (a -> c) -> (b -> c) -> t a b -> c`

Test whether a predicate holds at all positions in a data structure.

## Re-exports from **Data.**Bifunctor

### #Bifunctor Source

`class Bifunctor f where`

A `Bifunctor`

is a `Functor`

from the pair category `(Type, Type)`

to `Type`

.

A type constructor with two type arguments can be made into a `Bifunctor`

if
both of its type arguments are covariant.

The `bimap`

function maps a pair of functions over the two type arguments
of the bifunctor.

Laws:

- Identity:
`bimap id id == id`

- Composition:
`bimap f1 g1 <<< bimap f2 g2 == bimap (f1 <<< f2) (g1 <<< g2)`

#### Members

`bimap :: forall a b c d. (a -> b) -> (c -> d) -> f a c -> f b d`

## Re-exports from **Data.**Bifunctor.Clown

### #Clown Source

## Re-exports from **Data.**Bifunctor.Joker

### #Joker Source

## Re-exports from **Data.**Bitraversable

### #Bitraversable

`class (Bifunctor t, Bifoldable t) <= Bitraversable t where`

`Bitraversable`

represents data structures with two type arguments which can be
traversed.

A traversal for such a structure requires two functions, one for each type argument. Type class instances should choose the appropriate function based on the type of the element encountered at each point of the traversal.

Default implementations are provided by the following functions:

`bitraverseDefault`

`bisequenceDefault`

#### Members

`bitraverse :: forall f a b c d. Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)`

`bisequence :: forall f a b. Applicative f => t (f a) (f b) -> f (t a b)`

#### Instances

`(Traversable f) => Bitraversable (Clown f)`

`(Traversable f) => Bitraversable (Joker f)`

`(Bitraversable p) => Bitraversable (Flip p)`

`(Bitraversable f, Bitraversable g) => Bitraversable (Product f g)`

`(Bitraversable p) => Bitraversable (Wrap p)`

### #rtraverse

`rtraverse :: forall t b c a f. Bitraversable t => Applicative f => (b -> f c) -> t a b -> f (t a c)`

### #rfor

`rfor :: forall t b c a f. Bitraversable t => Applicative f => t a b -> (b -> f c) -> f (t a c)`

### #ltraverse

`ltraverse :: forall t b c a f. Bitraversable t => Applicative f => (a -> f c) -> t a b -> f (t c b)`

### #lfor

`lfor :: forall t b c a f. Bitraversable t => Applicative f => t a b -> (a -> f c) -> f (t c b)`

### #bifor

`bifor :: forall t f a b c d. Bitraversable t => Applicative f => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)`

Traverse a data structure, accumulating effects and results using an `Applicative`

functor.

## Re-exports from **Data.**Const

### #Const

`newtype Const a b`

The `Const`

type constructor, which wraps its first type argument
and ignores its second. That is, `Const a b`

is isomorphic to `a`

for any `b`

.

`Const`

has some useful instances. For example, the `Applicative`

instance allows us to collect results using a `Monoid`

while
ignoring return values.

#### Constructors

`Const a`

#### Instances

`Newtype (Const a b) _`

`(Eq a) => Eq (Const a b)`

`(Eq a) => Eq1 (Const a)`

`(Ord a) => Ord (Const a b)`

`(Bounded a) => Bounded (Const a b)`

`(Show a) => Show (Const a b)`

`Semigroupoid Const`

`(Semigroup a) => Semigroup (Const a b)`

`(Monoid a) => Monoid (Const a b)`

`(Semiring a) => Semiring (Const a b)`

`(Ring a) => Ring (Const a b)`

`(EuclideanRing a) => EuclideanRing (Const a b)`

`(CommutativeRing a) => CommutativeRing (Const a b)`

`(Field a) => Field (Const a b)`

`(HeytingAlgebra a) => HeytingAlgebra (Const a b)`

`(BooleanAlgebra a) => BooleanAlgebra (Const a b)`

`Functor (Const a)`

`Invariant (Const a)`

`Contravariant (Const a)`

`(Semigroup a) => Apply (Const a)`

`(Semigroup a) => Bind (Const a)`

`(Monoid a) => Applicative (Const a)`

`Foldable (Const a)`

`Traversable (Const a)`

## Re-exports from **Data.**Decidable

### #Decidable

`class (Decide f, Divisible f) <= Decidable f where`

`Decidable`

is the contravariant analogue of `Alternative`

.

#### Members

`lose :: forall a. (a -> Void) -> f a`

#### Instances

`Decidable Comparison`

`Decidable Equivalence`

`Decidable Predicate`

`(Monoid r) => Decidable (Op r)`

### #lost

`lost :: forall f. Decidable f => f Void`

## Re-exports from **Data.**Decide

### #Decide

`class (Divide f) <= Decide f where`

`Decide`

is the contravariant analogue of `Alt`

.

#### Members

`choose :: forall a b c. (a -> Either b c) -> f b -> f c -> f a`

#### Instances

`Decide Comparison`

`Decide Equivalence`

`Decide Predicate`

`(Semigroup r) => Decide (Op r)`

### #chosen

`chosen :: forall f a b. Decide f => f a -> f b -> f (Either a b)`

`chosen = choose id`

## Re-exports from **Data.**Divide

### #Divide

`class (Contravariant f) <= Divide f where`

`Divide`

is the contravariant analogue of `Apply`

.

For example, to test equality of `Point`

s, we can use the `Divide`

instance
for `Equivalence`

:

```
type Point = Tuple Int Int
pointEquiv :: Equivalence Point
pointEquiv = divided defaultEquivalence defaultEquivalence
```

#### Members

`divide :: forall a b c. (a -> Tuple b c) -> f b -> f c -> f a`

#### Instances

`Divide Comparison`

`Divide Equivalence`

`Divide Predicate`

`(Semigroup r) => Divide (Op r)`

### #divided

`divided :: forall f a b. Divide f => f a -> f b -> f (Tuple a b)`

`divided = divide id`

## Re-exports from **Data.**Divisible

### #Divisible

`class (Divide f) <= Divisible f where`

`Divisible`

is the contravariant analogue of `Applicative`

.

#### Members

`conquer :: forall a. f a`

#### Instances

`Divisible Comparison`

`Divisible Equivalence`

`Divisible Predicate`

`(Monoid r) => Divisible (Op r)`

## Re-exports from **Data.**Either

### #Either Source

`data Either a b`

The `Either`

type is used to represent a choice between two types of value.

A common use case for `Either`

is error handling, where `Left`

is used to
carry an error value and `Right`

is used to carry a success value.

#### Constructors

#### Instances

`Functor (Either a)`

`Invariant (Either a)`

`Bifunctor Either`

`Apply (Either e)`

The

`Apply`

instance allows functions contained within a`Right`

to transform a value contained within a`Right`

using the`(<*>)`

operator:`Right f <*> Right x == Right (f x)`

`Left`

values are left untouched:`Left f <*> Right x == Left x Right f <*> Left y == Left y`

Combining

`Functor`

's`<$>`

with`Apply`

's`<*>`

can be used to transform a pure function to take`Either`

-typed arguments so`f :: a -> b -> c`

becomes`f :: Either l a -> Either l b -> Either l c`

:`f <$> Right x <*> Right y == Right (f x y)`

The

`Left`

-preserving behaviour of both operators means the result of an expression like the above but where any one of the values is`Left`

means the whole result becomes`Left`

also, taking the first`Left`

value found:`f <$> Left x <*> Right y == Left x f <$> Right x <*> Left y == Left y f <$> Left x <*> Left y == Left x`

`Applicative (Either e)`

The

`Applicative`

instance enables lifting of values into`Either`

with the`pure`

function:`pure x :: Either _ _ == Right x`

Combining

`Functor`

's`<$>`

with`Apply`

's`<*>`

and`Applicative`

's`pure`

can be used to pass a mixture of`Either`

and non-`Either`

typed values to a function that does not usually expect them, by using`pure`

for any value that is not already`Either`

typed:`f <$> Right x <*> pure y == Right (f x y)`

Even though

`pure = Right`

it is recommended to use`pure`

in situations like this as it allows the choice of`Applicative`

to be changed later without having to go through and replace`Right`

with a new constructor.`Alt (Either e)`

The

`Alt`

instance allows for a choice to be made between two`Either`

values with the`<|>`

operator, where the first`Right`

encountered is taken.`Right x <|> Right y == Right x Left x <|> Right y == Right y Left x <|> Left y == Left y`

`Bind (Either e)`

The

`Bind`

instance allows sequencing of`Either`

values and functions that return an`Either`

by using the`>>=`

operator:`Left x >>= f = Left x Right x >>= f = f x`

`Monad (Either e)`

The

`Monad`

instance guarantees that there are both`Applicative`

and`Bind`

instances for`Either`

. This also enables the`do`

syntactic sugar:`do x' <- x y' <- y pure (f x' y')`

Which is equivalent to:

`x >>= (\x' -> y >>= (\y' -> pure (f x' y')))`

`Extend (Either e)`

The

`Extend`

instance allows sequencing of`Either`

values and functions that accept an`Either`

and return a non-`Either`

result using the`<<=`

operator.`f <<= Left x = Left x f <<= Right x = Right (f (Right x))`

`(Show a, Show b) => Show (Either a b)`

The

`Show`

instance allows`Either`

values to be rendered as a string with`show`

whenever there is an`Show`

instance for both type the`Either`

can contain.`(Eq a, Eq b) => Eq (Either a b)`

`(Eq a) => Eq1 (Either a)`

`(Ord a, Ord b) => Ord (Either a b)`

`(Ord a) => Ord1 (Either a)`

`(Bounded a, Bounded b) => Bounded (Either a b)`

`Foldable (Either a)`

`Bifoldable Either`

`Traversable (Either a)`

`Bitraversable Either`

`(Semiring b) => Semiring (Either a b)`

`(Semigroup b) => Semigroup (Either a b)`

### #either Source

`either :: forall a b c. (a -> c) -> (b -> c) -> Either a b -> c`

Takes two functions and an `Either`

value, if the value is a `Left`

the
inner value is applied to the first function, if the value is a `Right`

the inner value is applied to the second function.

```
either f g (Left x) == f x
either f g (Right y) == g y
```

## Re-exports from **Data.**Eq

### #Eq1

`class Eq1 f where`

The `Eq1`

type class represents type constructors with decidable equality.

#### Members

`eq1 :: forall a. Eq a => f a -> f a -> Boolean`

#### Instances

`Eq1 Array`

### #notEq1

`notEq1 :: forall f a. Eq1 f => Eq a => f a -> f a -> Boolean`

## Re-exports from **Data.**Exists

### #Exists Source

`data Exists :: (Type -> Type) -> Type`

This type constructor can be used to existentially quantify over a type of kind `Type`

.

Specifically, the type `Exists f`

is isomorphic to the existential type `exists a. f a`

.

Existential types can be encoded using universal types (`forall`

) for endofunctors in more general
categories. The benefit of this library is that, by using the FFI, we can create an efficient
representation of the existential by simply hiding type information.

For example, consider the type `exists s. Tuple s (s -> Tuple s a)`

which represents infinite streams
of elements of type `a`

.

This type can be constructed by creating a type constructor `StreamF`

as follows:

```
data StreamF a s = StreamF s (s -> Tuple s a)
```

We can then define the type of streams using `Exists`

:

```
type Stream a = Exists (StreamF a)
```

### #runExists Source

`runExists :: forall f r. (forall a. f a -> r) -> Exists f -> r`

The `runExists`

function is used to eliminate a value of type `Exists f`

. The rank 2 type ensures
that the existentially-quantified type does not escape its scope. Since the function is required
to work for *any* type `a`

, it will work for the existentially-quantified type.

For example, we can write a function to obtain the head of a stream by using `runExists`

as follows:

```
head :: forall a. Stream a -> a
head = runExists head'
where
head' :: forall s. StreamF a s -> a
head' (StreamF s f) = snd (f s)
```

### #mkExists Source

`mkExists :: forall f a. f a -> Exists f`

The `mkExists`

function is used to introduce a value of type `Exists f`

, by providing a value of
type `f a`

, for some type `a`

which will be hidden in the existentially-quantified type.

For example, to create a value of type `Stream Number`

, we might use `mkExists`

as follows:

```
nats :: Stream Number
nats = mkExists $ StreamF 0 (\n -> Tuple (n + 1) n)
```

## Re-exports from **Data.**Foldable

### #Foldable

`class Foldable f where`

`Foldable`

represents data structures which can be *folded*.

`foldr`

folds a structure from the right`foldl`

folds a structure from the left`foldMap`

folds a structure by accumulating values in a`Monoid`

Default implementations are provided by the following functions:

`foldrDefault`

`foldlDefault`

`foldMapDefaultR`

`foldMapDefaultL`

Note: some combinations of the default implementations are unsafe to use together - causing a non-terminating mutually recursive cycle. These combinations are documented per function.

#### Members

`foldr :: forall a b. (a -> b -> b) -> b -> f a -> b`

`foldl :: forall a b. (b -> a -> b) -> b -> f a -> b`

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

#### Instances

`Foldable Array`

`Foldable Maybe`

`Foldable First`

`Foldable Last`

`Foldable Additive`

`Foldable Dual`

`Foldable Disj`

`Foldable Conj`

`Foldable Multiplicative`

### #traverse_

`traverse_ :: forall a b f m. Applicative m => Foldable f => (a -> m b) -> f a -> m Unit`

Traverse a data structure, performing some effects encoded by an
`Applicative`

functor at each value, ignoring the final result.

For example:

```
traverse_ print [1, 2, 3]
```

### #sum

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

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

### #sequence_

`sequence_ :: forall a f m. Applicative m => Foldable f => f (m a) -> m Unit`

Perform all of the effects in some data structure in the order
given by the `Foldable`

instance, ignoring the final result.

For example:

```
sequence_ [ trace "Hello, ", trace " world!" ]
```

### #product

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

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

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

.

### #oneOf

`oneOf :: forall f g a. Foldable f => Plus g => f (g a) -> g a`

Combines a collection of elements using the `Alt`

operation.

### #notElem

`notElem :: forall a f. Foldable f => Eq a => a -> f a -> Boolean`

Test whether a value is not an element of a data structure.

### #minimumBy

`minimumBy :: forall a f. Foldable f => (a -> a -> Ordering) -> f a -> Maybe a`

Find the smallest element of a structure, according to a given comparison
function. The comparison function should represent a total ordering (see
the `Ord`

type class laws); if it does not, the behaviour is undefined.

### #minimum

`minimum :: forall a f. Ord a => Foldable f => f a -> Maybe a`

Find the smallest element of a structure, according to its `Ord`

instance.

### #maximumBy

`maximumBy :: forall a f. Foldable f => (a -> a -> Ordering) -> f a -> Maybe a`

Find the largest element of a structure, according to a given comparison
function. The comparison function should represent a total ordering (see
the `Ord`

type class laws); if it does not, the behaviour is undefined.

### #maximum

`maximum :: forall a f. Ord a => Foldable f => f a -> Maybe a`

Find the largest element of a structure, according to its `Ord`

instance.

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

### #for_

`for_ :: forall a b f m. Applicative m => Foldable f => f a -> (a -> m b) -> m Unit`

A version of `traverse_`

with its arguments flipped.

This can be useful when running an action written using do notation for every element in a data structure:

For example:

```
for_ [1, 2, 3] \n -> do
print n
trace "squared is"
print (n * n)
```

### #fold

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

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

.

### #findMap

`findMap :: forall a b f. Foldable f => (a -> Maybe b) -> f a -> Maybe b`

Try to find an element in a data structure which satisfies a predicate mapping.

### #find

`find :: forall a f. Foldable f => (a -> Boolean) -> f a -> Maybe a`

Try to find an element in a data structure which satisfies a predicate.

### #elem

`elem :: forall a f. Foldable f => Eq a => a -> f a -> Boolean`

Test whether a value is an element of a data structure.

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

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

.

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

## Re-exports from **Data.**Function

### #on

`on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c`

The `on`

function is used to change the domain of a binary operator.

For example, we can create a function which compares two records based on the values of their `x`

properties:

```
compareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering
compareX = compare `on` _.x
```

## Re-exports from **Data.**Functor.Compose

### #Compose Source

`newtype Compose f g a`

`Compose f g`

is the composition of the two functors `f`

and `g`

.

#### Constructors

`Compose (f (g a))`

#### Instances

`Newtype (Compose f g a) _`

`(Eq1 f, Eq1 g) => Eq1 (Compose f g)`

`(Eq1 f, Eq1 g, Eq a) => Eq (Compose f g a)`

`(Ord1 f, Ord1 g) => Ord1 (Compose f g)`

`(Ord1 f, Ord1 g, Ord a) => Ord (Compose f g a)`

`(Show (f (g a))) => Show (Compose f g a)`

`(Functor f, Functor g) => Functor (Compose f g)`

`(Apply f, Apply g) => Apply (Compose f g)`

`(Applicative f, Applicative g) => Applicative (Compose f g)`

`(Foldable f, Foldable g) => Foldable (Compose f g)`

`(Traversable f, Traversable g) => Traversable (Compose f g)`

`(Alt f, Functor g) => Alt (Compose f g)`

`(Plus f, Functor g) => Plus (Compose f g)`

`(Alternative f, Applicative g) => Alternative (Compose f g)`

## Re-exports from **Data.**Functor.Contravariant

### #Contravariant

`class Contravariant f where`

A `Contravariant`

functor can be seen as a way of changing the input type
of a consumer of input, in contrast to the standard covariant `Functor`

that can be seen as a way of changing the output type of a producer of
output.

`Contravariant`

instances should satisfy the following laws:

- Identity
`(>$<) id = id`

- Composition
`(f >$<) <<< (g >$<) = (>$<) (g <<< f)`

#### Members

`cmap :: forall a b. (b -> a) -> f a -> f b`

### #coerce

`coerce :: forall f a b. Contravariant f => Functor f => f a -> f b`

### #(>$<)

Operator alias for Data.Functor.Contravariant.cmap *(left-associative / precedence 4)*

### #(>#<)

Operator alias for Data.Functor.Contravariant.cmapFlipped *(left-associative / precedence 4)*

## Re-exports from **Data.**Functor.Coproduct

### #Coproduct Source

`newtype Coproduct f g a`

`Coproduct f g`

is the coproduct of two functors `f`

and `g`

#### Constructors

#### Instances

`Newtype (Coproduct f g a) _`

`(Eq1 f, Eq1 g, Eq a) => Eq (Coproduct f g a)`

`(Eq1 f, Eq1 g) => Eq1 (Coproduct f g)`

`(Ord1 f, Ord1 g, Ord a) => Ord (Coproduct f g a)`

`(Ord1 f, Ord1 g) => Ord1 (Coproduct f g)`

`(Show (f a), Show (g a)) => Show (Coproduct f g a)`

`(Functor f, Functor g) => Functor (Coproduct f g)`

`(Extend f, Extend g) => Extend (Coproduct f g)`

`(Comonad f, Comonad g) => Comonad (Coproduct f g)`

`(Foldable f, Foldable g) => Foldable (Coproduct f g)`

`(Traversable f, Traversable g) => Traversable (Coproduct f g)`

## Re-exports from **Data.**Functor.Coproduct.Nested

### #type (<\/>) Source

Operator alias for Data.Functor.Coproduct.Coproduct *(right-associative / precedence 6)*

## Re-exports from **Data.**Functor.Invariant

### #Invariant Source

`class Invariant f where`

A type of functor that can be used to adapt the type of a wrapped function
where the parameterised type occurs in both the positive and negative
position, for example, `F (a -> a)`

.

An `Invariant`

instance should satisfy the following laws:

- Identity:
`imap id id = id`

- Composition:
`imap g1 g2 <<< imap f1 f2 = imap (g1 <<< f1) (f2 <<< g2)`

#### Members

`imap :: forall a b. (a -> b) -> (b -> a) -> f a -> f b`

#### Instances

## Re-exports from **Data.**Functor.Mu

### #Mu Source

`newtype Mu f`

`Mu f`

is the least fixed point of a functor `f`

, when it exists.

#### Constructors

#### Instances

`Newtype (Mu f) _`

`(Eq1 f) => Eq (Mu f)`

To implement

`Eq`

, we require`f`

to have higher-kinded equality.`(Eq1 f, Ord1 f) => Ord (Mu f)`

To implement

`Ord`

, we require`f`

to have higher-kinded comparison.`(Show (f TacitString), Functor f) => Show (Mu f)`

`Show`

is compositional, so we only`f`

to be able to show a single layer of structure.

## Re-exports from **Data.**Functor.Nu

## Re-exports from **Data.**Functor.Product

### #Product Source

`newtype Product f g a`

`Product f g`

is the product of the two functors `f`

and `g`

.

#### Constructors

#### Instances

`Newtype (Product f g a) _`

`(Eq1 f, Eq1 g, Eq a) => Eq (Product f g a)`

`(Eq1 f, Eq1 g) => Eq1 (Product f g)`

`(Ord1 f, Ord1 g, Ord a) => Ord (Product f g a)`

`(Ord1 f, Ord1 g) => Ord1 (Product f g)`

`(Show (f a), Show (g a)) => Show (Product f g a)`

`(Functor f, Functor g) => Functor (Product f g)`

`(Foldable f, Foldable g) => Foldable (Product f g)`

`(Traversable f, Traversable g) => Traversable (Product f g)`

`(Apply f, Apply g) => Apply (Product f g)`

`(Applicative f, Applicative g) => Applicative (Product f g)`

`(Bind f, Bind g) => Bind (Product f g)`

`(Monad f, Monad g) => Monad (Product f g)`

## Re-exports from **Data.**Functor.Product.Nested

### #type (</\>) Source

Operator alias for Data.Functor.Product.Product *(right-associative / precedence 6)*

## Re-exports from **Data.**Group

### #Abelian Source

`type Abelian a b = Group a => Commutative a => b`

An Abelian group is a group with a commutative operation.

### #Group Source

## Re-exports from **Data.**Identity

### #Identity Source

`newtype Identity a`

#### Constructors

`Identity a`

#### Instances

`Newtype (Identity a) _`

`(Eq a) => Eq (Identity a)`

`(Ord a) => Ord (Identity a)`

`(Bounded a) => Bounded (Identity a)`

`(HeytingAlgebra a) => HeytingAlgebra (Identity a)`

`(BooleanAlgebra a) => BooleanAlgebra (Identity a)`

`(Semigroup a) => Semigroup (Identity a)`

`(Monoid a) => Monoid (Identity a)`

`(Semiring a) => Semiring (Identity a)`

`(EuclideanRing a) => EuclideanRing (Identity a)`

`(Ring a) => Ring (Identity a)`

`(CommutativeRing a) => CommutativeRing (Identity a)`

`(Field a) => Field (Identity a)`

`(Lazy a) => Lazy (Identity a)`

`(Show a) => Show (Identity a)`

`Eq1 Identity`

`Ord1 Identity`

`Functor Identity`

`Invariant Identity`

`Alt Identity`

`Apply Identity`

`Applicative Identity`

`Bind Identity`

`Monad Identity`

`Extend Identity`

`Comonad Identity`

`Foldable Identity`

`Traversable Identity`

## Re-exports from **Data.**Int

## Re-exports from **Data.**Int.Bits

## Re-exports from **Data.**Lazy

### #Lazy Source

`data Lazy :: Type -> Type`

`Lazy a`

represents lazily-computed values of type `a`

.

A lazy value is computed at most once - the result is saved after the first computation, and subsequent attempts to read the value simply return the saved value.

`Lazy`

values can be created with `defer`

, or by using the provided
type class instances.

`Lazy`

values can be evaluated by using the `force`

function.

#### Instances

`(Semiring a) => Semiring (Lazy a)`

`(Ring a) => Ring (Lazy a)`

`(CommutativeRing a) => CommutativeRing (Lazy a)`

`(EuclideanRing a) => EuclideanRing (Lazy a)`

`(Field a) => Field (Lazy a)`

`(Eq a) => Eq (Lazy a)`

`(Ord a) => Ord (Lazy a)`

`(Bounded a) => Bounded (Lazy a)`

`(Semigroup a) => Semigroup (Lazy a)`

`(Monoid a) => Monoid (Lazy a)`

`(HeytingAlgebra a) => HeytingAlgebra (Lazy a)`

`(BooleanAlgebra a) => BooleanAlgebra (Lazy a)`

`Functor Lazy`

`Invariant Lazy`

`Apply Lazy`

`Applicative Lazy`

`Bind Lazy`

`Monad Lazy`

`Extend Lazy`

`Comonad Lazy`

`(Show a) => Show (Lazy a)`

`Lazy (Lazy a)`

## Re-exports from **Data.**Leibniz

### #Leibniz

`newtype Leibniz a b`

Two types are equal if they are *equal in all contexts*.

#### Constructors

`Leibniz (forall f. f a -> f b)`

#### Instances

`Semigroupoid Leibniz`

`Category Leibniz`

### #type (~)

Operator alias for Data.Leibniz.Leibniz *(non-associative / precedence 4)*

## Re-exports from **Data.**List

### #List

`data List a`

#### Constructors

`Nil`

#### Instances

`(Show a) => Show (List a)`

`(Eq a) => Eq (List a)`

`Eq1 List`

`(Ord a) => Ord (List a)`

`Ord1 List`

`Semigroup (List a)`

`Monoid (List a)`

`Functor List`

`Foldable List`

`Unfoldable List`

`Traversable List`

`Apply List`

`Applicative List`

`Bind List`

`Monad List`

`Alt List`

`Plus List`

`Alternative List`

`MonadZero List`

`MonadPlus List`

`Extend List`

### #(:)

Operator alias for Data.List.Types.Cons *(right-associative / precedence 6)*

## Re-exports from **Data.**Maybe

### #Maybe Source

`data Maybe a`

The `Maybe`

type is used to represent optional values and can be seen as
something like a type-safe `null`

, where `Nothing`

is `null`

and `Just x`

is the non-null value `x`

.

#### Constructors

#### Instances

`Functor Maybe`

The

`Functor`

instance allows functions to transform the contents of a`Just`

with the`<$>`

operator:`f <$> Just x == Just (f x)`

`Nothing`

values are left untouched:`f <$> Nothing == Nothing`

`Apply Maybe`

The

`Apply`

instance allows functions contained within a`Just`

to transform a value contained within a`Just`

using the`apply`

operator:`Just f <*> Just x == Just (f x)`

`Nothing`

values are left untouched:`Just f <*> Nothing == Nothing Nothing <*> Just x == Nothing`

Combining

`Functor`

's`<$>`

with`Apply`

's`<*>`

can be used transform a pure function to take`Maybe`

-typed arguments so`f :: a -> b -> c`

becomes`f :: Maybe a -> Maybe b -> Maybe c`

:`f <$> Just x <*> Just y == Just (f x y)`

The

`Nothing`

-preserving behaviour of both operators means the result of an expression like the above but where any one of the values is`Nothing`

means the whole result becomes`Nothing`

also:`f <$> Nothing <*> Just y == Nothing f <$> Just x <*> Nothing == Nothing f <$> Nothing <*> Nothing == Nothing`

`Applicative Maybe`

The

`Applicative`

instance enables lifting of values into`Maybe`

with the`pure`

or`return`

function (`return`

is an alias for`pure`

):`pure x :: Maybe _ == Just x return x :: Maybe _ == Just x`

Combining

`Functor`

's`<$>`

with`Apply`

's`<*>`

and`Applicative`

's`pure`

can be used to pass a mixture of`Maybe`

and non-`Maybe`

typed values to a function that does not usually expect them, by using`pure`

for any value that is not already`Maybe`

typed:`f <$> Just x <*> pure y == Just (f x y)`

Even though

`pure = Just`

it is recommended to use`pure`

in situations like this as it allows the choice of`Applicative`

to be changed later without having to go through and replace`Just`

with a new constructor.`Alt Maybe`

The

`Alt`

instance allows for a choice to be made between two`Maybe`

values with the`<|>`

operator, where the first`Just`

encountered is taken.`Just x <|> Just y == Just x Nothing <|> Just y == Just y Nothing <|> Nothing == Nothing`

`Plus Maybe`

The

`Plus`

instance provides a default`Maybe`

value:`empty :: Maybe _ == Nothing`

`Alternative Maybe`

The

`Alternative`

instance guarantees that there are both`Applicative`

and`Plus`

instances for`Maybe`

.`Bind Maybe`

The

`Bind`

instance allows sequencing of`Maybe`

values and functions that return a`Maybe`

by using the`>>=`

operator:`Just x >>= f = f x Nothing >>= f = Nothing`

`Monad Maybe`

The

`Monad`

instance guarantees that there are both`Applicative`

and`Bind`

instances for`Maybe`

. This also enables the`do`

syntactic sugar:`do x' <- x y' <- y pure (f x' y')`

Which is equivalent to:

`x >>= (\x' -> y >>= (\y' -> pure (f x' y')))`

`MonadZero Maybe`

`Extend Maybe`

The

`Extend`

instance allows sequencing of`Maybe`

values and functions that accept a`Maybe a`

and return a non-`Maybe`

result using the`<<=`

operator.`f <<= Nothing = Nothing f <<= Just x = Just (f x)`

`Invariant Maybe`

`(Semigroup a) => Semigroup (Maybe a)`

The

`Semigroup`

instance enables use of the operator`<>`

on`Maybe`

values whenever there is a`Semigroup`

instance for the type the`Maybe`

contains. The exact behaviour of`<>`

depends on the "inner"`Semigroup`

instance, but generally captures the notion of appending or combining things.`Just x <> Just y = Just (x <> y) Just x <> Nothing = Just x Nothing <> Just y = Just y Nothing <> Nothing = Nothing`

`(Semigroup a) => Monoid (Maybe a)`

`(Eq a) => Eq (Maybe a)`

`Eq1 Maybe`

`(Ord a) => Ord (Maybe a)`

`Ord1 Maybe`

`(Bounded a) => Bounded (Maybe a)`

`(Show a) => Show (Maybe a)`

The

`Show`

instance allows`Maybe`

values to be rendered as a string with`show`

whenever there is an`Show`

instance for the type the`Maybe`

contains.

### #maybe' Source

`maybe' :: forall a b. (Unit -> b) -> (a -> b) -> Maybe a -> b`

Similar to `maybe`

but for use in cases where the default value may be
expensive to compute. As PureScript is not lazy, the standard `maybe`

has
to evaluate the default value before returning the result, whereas here
the value is only computed when the `Maybe`

is known to be `Nothing`

.

```
maybe' (\_ -> x) f Nothing == x
maybe' (\_ -> x) f (Just y) == f y
```

### #maybe Source

`maybe :: forall a b. b -> (a -> b) -> Maybe a -> b`

Takes a default value, a function, and a `Maybe`

value. If the `Maybe`

value is `Nothing`

the default value is returned, otherwise the function
is applied to the value inside the `Just`

and the result is returned.

```
maybe x f Nothing == x
maybe x f (Just y) == f y
```

### #fromMaybe' Source

`fromMaybe' :: forall a. (Unit -> a) -> Maybe a -> a`

Similar to `fromMaybe`

but for use in cases where the default value may be
expensive to compute. As PureScript is not lazy, the standard `fromMaybe`

has to evaluate the default value before returning the result, whereas here
the value is only computed when the `Maybe`

is known to be `Nothing`

.

```
fromMaybe' (\_ -> x) Nothing == x
fromMaybe' (\_ -> x) (Just y) == y
```

## Re-exports from **Data.**Maybe.First

### #First Source

`newtype First a`

Monoid returning the first (left-most) non-`Nothing`

value.

```
First (Just x) <> First (Just y) == First (Just x)
First Nothing <> First (Just y) == First (Just y)
First Nothing <> Nothing == First Nothing
mempty :: First _ == First Nothing
```

#### Constructors

#### Instances

## Re-exports from **Data.**Maybe.Last

### #Last Source

`newtype Last a`

Monoid returning the last (right-most) non-`Nothing`

value.

```
Last (Just x) <> Last (Just y) == Last (Just y)
Last (Just x) <> Nothing == Last (Just x)
Last Nothing <> Nothing == Last Nothing
mempty :: Last _ == Last Nothing
```

#### Constructors

#### Instances

## Re-exports from **Data.**Module

### #LeftModule Source

`class (Ring r) <= LeftModule x r | x -> r`

Left modules over rings.

Instances must satisfy the following laws:

- Left distributivity:
`r ^* (x ^+ y) = r ^* x ^+ r ^* y`

- Left distributivity:
`(r + s) ^* x = r ^* x ^+ s ^* x`

- Left compatibility:
`(r * s) ^* x = r ^* (s ^* x)`

- Left identity:
`one ^* x = x`

#### Instances

`(Ring a) => LeftModule Unit a`

### #RightModule Source

`class (Ring r) <= RightModule x r | x -> r`

Right modules over rings.

Instances must satisfy the following laws:

- Right distributivity:
`(x +^ y) *^ r = x *^ r +^ y *^ r`

- Right distributivity:
`x *^ (r + s) = x *^ r +^ x *^ s`

- Right compatibility:
`x *^ (r * s) = (x *^ r) *^ s`

- Right identity:
`x *^ one = x`

#### Instances

`(Ring a) => RightModule Unit a`

### #mnegateR Source

`mnegateR :: forall x r. RightModule x r => x -> x`

### #mnegateL Source

`mnegateL :: forall x r. LeftModule x r => x -> x`

## Re-exports from **Data.**Monoid

### #Monoid Source

`class (Semigroup m) <= Monoid m where`

A `Monoid`

is a `Semigroup`

with a value `mempty`

, which is both a
left and right unit for the associative operation `<>`

:

```
forall x. mempty <> x = x <> mempty = x
```

`Monoid`

s are commonly used as the result of fold operations, where
`<>`

is used to combine individual results, and `mempty`

gives the result
of folding an empty collection of elements.

#### Members

`mempty :: m`

#### Instances

## Re-exports from **Data.**Monoid.Additive

### #Additive Source

`newtype Additive a`

Monoid and semigroup for semirings under addition.

```
Additive x <> Additive y == Additive (x + y)
mempty :: Additive _ == Additive zero
```

#### Constructors

`Additive a`

#### Instances

`Newtype (Additive a) _`

`(Eq a) => Eq (Additive a)`

`(Ord a) => Ord (Additive a)`

`(Bounded a) => Bounded (Additive a)`

`Functor Additive`

`Invariant Additive`

`Apply Additive`

`Applicative Additive`

`Bind Additive`

`Monad Additive`

`Extend Additive`

`Comonad Additive`

`(Show a) => Show (Additive a)`

`(Semiring a) => Semigroup (Additive a)`

`(Semiring a) => Monoid (Additive a)`

## Re-exports from **Data.**Monoid.Alternate

### #Alternate Source

`newtype Alternate f a`

Monoid and semigroup instances corresponding to `Plus`

and `Alt`

instances
for `f`

```
Alternate fx <> Alternate fy == Alternate (fx <|> fy)
mempty :: Alternate _ == Alternate empty
```

#### Constructors

`Alternate (f a)`

#### Instances

`Newtype (Alternate f a) _`

`(Eq (f a)) => Eq (Alternate f a)`

`(Ord (f a)) => Ord (Alternate f a)`

`(Bounded (f a)) => Bounded (Alternate f a)`

`(Functor f) => Functor (Alternate f)`

`(Invariant f) => Invariant (Alternate f)`

`(Apply f) => Apply (Alternate f)`

`(Applicative f) => Applicative (Alternate f)`

`(Alt f) => Alt (Alternate f)`

`(Plus f) => Plus (Alternate f)`

`(Alternative f) => Alternative (Alternate f)`

`(Bind f) => Bind (Alternate f)`

`(Monad f) => Monad (Alternate f)`

`(Extend f) => Extend (Alternate f)`

`(Comonad f) => Comonad (Alternate f)`

`(Show (f a)) => Show (Alternate f a)`

`(Alt f) => Semigroup (Alternate f a)`

`(Plus f) => Monoid (Alternate f a)`

## Re-exports from **Data.**Monoid.Conj

### #Conj Source

`newtype Conj a`

Monoid under conjuntion.

```
Conj x <> Conj y == Conj (x && y)
mempty :: Conj _ == Conj top
```

#### Constructors

`Conj a`

#### Instances

`Newtype (Conj a) _`

`(Eq a) => Eq (Conj a)`

`(Ord a) => Ord (Conj a)`

`(Bounded a) => Bounded (Conj a)`

`Functor Conj`

`Invariant Conj`

`Apply Conj`

`Applicative Conj`

`Bind Conj`

`Monad Conj`

`Extend Conj`

`Comonad Conj`

`(Show a) => Show (Conj a)`

`(HeytingAlgebra a) => Semigroup (Conj a)`

`(HeytingAlgebra a) => Monoid (Conj a)`

`(HeytingAlgebra a) => Semiring (Conj a)`

## Re-exports from **Data.**Monoid.Disj

### #Disj Source

`newtype Disj a`

Monoid under disjuntion.

```
Disj x <> Disj y == Disj (x || y)
mempty :: Disj _ == Disj bottom
```

#### Constructors

`Disj a`

#### Instances

`Newtype (Disj a) _`

`(Eq a) => Eq (Disj a)`

`(Ord a) => Ord (Disj a)`

`(Bounded a) => Bounded (Disj a)`

`Functor Disj`

`Invariant Disj`

`Apply Disj`

`Applicative Disj`

`Bind Disj`

`Monad Disj`

`Extend Disj`

`Comonad Disj`

`(Show a) => Show (Disj a)`

`(HeytingAlgebra a) => Semigroup (Disj a)`

`(HeytingAlgebra a) => Monoid (Disj a)`

`(HeytingAlgebra a) => Semiring (Disj a)`

## Re-exports from **Data.**Monoid.Dual

### #Dual Source

## Re-exports from **Data.**Monoid.Endo

### #Endo Source

## Re-exports from **Data.**Monoid.Multiplicative

### #Multiplicative Source

`newtype Multiplicative a`

Monoid and semigroup for semirings under multiplication.

```
Multiplicative x <> Multiplicative y == Multiplicative (x * y)
mempty :: Multiplicative _ == Multiplicative one
```

#### Constructors

#### Instances

`Newtype (Multiplicative a) _`

`(Eq a) => Eq (Multiplicative a)`

`(Ord a) => Ord (Multiplicative a)`

`(Bounded a) => Bounded (Multiplicative a)`

`Functor Multiplicative`

`Invariant Multiplicative`

`Apply Multiplicative`

`Applicative Multiplicative`

`Bind Multiplicative`

`Monad Multiplicative`

`Extend Multiplicative`

`Comonad Multiplicative`

`(Show a) => Show (Multiplicative a)`

`(Semiring a) => Semigroup (Multiplicative a)`

`(Semiring a) => Monoid (Multiplicative a)`

## Re-exports from **Data.**Newtype

### #Newtype Source

`class Newtype t a | t -> a where`

A type class for `newtype`

s to enable convenient wrapping and unwrapping,
and the use of the other functions in this module.

The compiler can derive instances of `Newtype`

automatically:

```
newtype EmailAddress = EmailAddress String
derive instance newtypeEmailAddress :: Newtype EmailAddress _
```

Note that deriving for `Newtype`

instances requires that the type be
defined as `newtype`

rather than `data`

declaration (even if the `data`

structurally fits the rules of a `newtype`

), and the use of a wildcard for
the wrapped type.

Instances must obey the following laws:

```
unwrap <<< wrap = id
wrap <<< unwrap = id
```

#### Members

### #underF Source

`underF :: forall f g t a s b. Functor f => Functor g => Newtype t a => Newtype s b => (a -> t) -> (f t -> g s) -> f a -> g b`

Much like `under`

, but where the lifted function operates on values in a
`Functor`

:

```
newtype EmailAddress = EmailAddress String
derive instance newtypeEmailAddress :: Newtype EmailAddress _
isValid :: EmailAddress -> Boolean
isValid x = false -- imagine a slightly less strict predicate here
findValidEmailString :: Array String -> Maybe String
findValidEmailString = underF EmailAddress (Foldable.find isValid)
```

The above example also demonstrates that the functor type is polymorphic
here too, the input is an `Array`

but the result is a `Maybe`

.

### #under Source

`under :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (t -> s) -> a -> b`

The opposite of `over`

: lowers a function that operates on `Newtype`

d
values to operate on the wrapped value instead.

```
newtype Degrees = Degrees Number
derive instance newtypeDegrees :: Newtype Degrees _
newtype NormalDegrees = NormalDegrees Number
derive instance newtypeNormalDegrees :: Newtype NormalDegrees _
normaliseDegrees :: Degrees -> NormalDegrees
normaliseDegrees (Degrees deg) = NormalDegrees (deg % 360.0)
asNormalDegrees :: Number -> Number
asNormalDegrees = under Degrees normaliseDegrees
```

As with `over`

the `Newtype`

is polymorphic, as illustrated in the example
above - both `Degrees`

and `NormalDegrees`

are instances of `Newtype`

,
so even though `normaliseDegrees`

changes the result type we can still put
a `Number`

in and get a `Number`

out via `under`

.

### #overF Source

`overF :: forall f g t a s b. Functor f => Functor g => Newtype t a => Newtype s b => (a -> t) -> (f a -> g b) -> f t -> g s`

Much like `over`

, but where the lifted function operates on values in a
`Functor`

:

```
findLabel :: String -> Array Label -> Maybe Label
findLabel s = overF Label (Foldable.find (_ == s))
```

The above example also demonstrates that the functor type is polymorphic
here too, the input is an `Array`

but the result is a `Maybe`

.

### #over2 Source

`over2 :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (a -> a -> b) -> t -> t -> s`

Lifts a binary function to operate over newtypes.

```
newtype Meter = Meter Int
derive newtype instance newtypeMeter :: Newtype Meter _
newtype SquareMeter = SquareMeter Int
derive newtype instance newtypeSquareMeter :: Newtype SquareMeter _
area :: Meter -> Meter -> SquareMeter
area = over2 Meter (*)
```

The above example also demonstrates that the return type is polymorphic here too.

### #over Source

`over :: forall t a s b. Newtype t a => Newtype s b => (a -> t) -> (a -> b) -> t -> s`

Lifts a function operate over newtypes. This can be used to lift a
function to manipulate the contents of a single newtype, somewhat like
`map`

does for a `Functor`

:

```
newtype Label = Label String
derive instance newtypeLabel :: Newtype Label _
toUpperLabel :: Label -> Label
toUpperLabel = over Label String.toUpper
```

But the result newtype is polymorphic, meaning the result can be returned as an alternative newtype:

```
newtype UppercaseLabel = UppercaseLabel String
derive instance newtypeUppercaseLabel :: Newtype UppercaseLabel _
toUpperLabel' :: Label -> UppercaseLabel
toUpperLabel' = over Label String.toUpper
```

### #ala Source

`ala :: forall f t a s b. Functor f => Newtype t a => Newtype s b => (a -> t) -> ((b -> s) -> f t) -> f a`

This combinator is for when you have a higher order function that you want
to use in the context of some newtype - `foldMap`

being a common example:

```
ala Additive foldMap [1,2,3,4] -- 10
ala Multiplicative foldMap [1,2,3,4] -- 24
ala Conj foldMap [true, false] -- false
ala Disj foldMap [true, false] -- true
```

## Re-exports from **Data.**Op

### #Op

`newtype Op a b`

The opposite of the function category.

#### Constructors

`Op (b -> a)`

#### Instances

`Newtype (Op a b) _`

`Semigroupoid Op`

`Category Op`

`Contravariant (Op a)`

## Re-exports from **Data.**Ord

### #Ord1

`class (Eq1 f) <= Ord1 f where`

The `Ord1`

type class represents totally ordered type constructors.

#### Members

`compare1 :: forall a. Ord a => f a -> f a -> Ordering`

#### Instances

`Ord1 Array`

### #signum

`signum :: forall a. Ord a => Ring a => a -> a`

The sign function; always evaluates to either `one`

or `negate one`

. For
any `x`

, we should have `signum x * abs x == x`

.

### #abs

`abs :: forall a. Ord a => Ring a => a -> a`

The absolute value function. `abs x`

is defined as ```
if x >= zero then x
else negate x
```

.

## Re-exports from **Data.**Ord.Max

### #Max Source

## Re-exports from **Data.**Ord.Min

### #Min Source

## Re-exports from **Data.**Profunctor

### #Profunctor

`class Profunctor p where`

A `Profunctor`

is a `Functor`

from the pair category `(Type^op, Type)`

to `Type`

.

In other words, a `Profunctor`

is a type constructor of two type
arguments, which is contravariant in its first argument and covariant
in its second argument.

The `dimap`

function can be used to map functions over both arguments
simultaneously.

A straightforward example of a profunctor is the function arrow `(->)`

.

Laws:

- Identity:
`dimap id id = id`

- Composition:
`dimap f1 g1 <<< dimap f2 g2 = dimap (f1 >>> f2) (g1 <<< g2)`

#### Members

`dimap :: forall a b c d. (a -> b) -> (c -> d) -> p b c -> p a d`

#### Instances

`Profunctor Function`

### #arr

`arr :: forall a b p. Category p => Profunctor p => (a -> b) -> p a b`

Lift a pure function into any `Profunctor`

which is also a `Category`

.

## Re-exports from **Data.**Profunctor.Choice

### #Choice

`class (Profunctor p) <= Choice p where`

The `Choice`

class extends `Profunctor`

with combinators for working with
sum types.

`left`

and `right`

lift values in a `Profunctor`

to act on the `Left`

and
`Right`

components of a sum, respectively.

Looking at `Choice`

through the intuition of inputs and outputs
yields the following type signature:

```
left :: forall input output a. p input output -> p (Either input a) (Either output a)
right :: forall input output a. p input output -> p (Either a input) (Either a output)
```

If we specialize the profunctor `p`

to the `function`

arrow, we get the following type
signatures:

```
left :: forall input output a. (input -> output) -> (Either input a) -> (Either output a)
right :: forall input output a. (input -> output) -> (Either a input) -> (Either a output)
```

When the `profunctor`

is `Function`

application, `left`

allows you to map a function over the
left side of an `Either`

, and `right`

maps it over the right side (same as `map`

would do).

#### Members

`left :: forall a b c. p a b -> p (Either a c) (Either b c)`

`right :: forall a b c. p b c -> p (Either a b) (Either a c)`

#### Instances

`Choice Function`

### #(|||)

Operator alias for Data.Profunctor.Choice.fanin *(right-associative / precedence 2)*

### #(+++)

Operator alias for Data.Profunctor.Choice.splitChoice *(right-associative / precedence 2)*

## Re-exports from **Data.**Profunctor.Closed

### #Closed

`class (Profunctor p) <= Closed p where`

The `Closed`

class extends the `Profunctor`

class to work with functions.

#### Members

`closed :: forall a b x. p a b -> p (x -> a) (x -> b)`

#### Instances

`Closed Function`

## Re-exports from **Data.**Profunctor.Costar

### #Costar

`newtype Costar f b a`

`Costar`

turns a `Functor`

into a `Profunctor`

"backwards".

`Costar f`

is also the co-Kleisli category for `f`

.

#### Constructors

`Costar (f b -> a)`

#### Instances

`Newtype (Costar f a b) _`

`(Extend f) => Semigroupoid (Costar f)`

`(Comonad f) => Category (Costar f)`

`Functor (Costar f a)`

`Invariant (Costar f a)`

`Apply (Costar f a)`

`Applicative (Costar f a)`

`Bind (Costar f a)`

`Monad (Costar f a)`

`Distributive (Costar f a)`

`(Functor f) => Profunctor (Costar f)`

`(Comonad f) => Strong (Costar f)`

`(Functor f) => Costrong (Costar f)`

`(Applicative f) => Cochoice (Costar f)`

`(Functor f) => Closed (Costar f)`

## Re-exports from **Data.**Profunctor.Costrong

### #Costrong

`class (Profunctor p) <= Costrong p where`

The `Costrong`

class provides the dual operations of the `Strong`

class.

#### Members

`unfirst :: forall a b c. p (Tuple a c) (Tuple b c) -> p a b`

`unsecond :: forall a b c. p (Tuple a b) (Tuple a c) -> p b c`

## Re-exports from **Data.**Profunctor.Star

### #Star

`newtype Star f a b`

`Star`

turns a `Functor`

into a `Profunctor`

.

`Star f`

is also the Kleisli category for `f`

#### Constructors

`Star (a -> f b)`

#### Instances

`Newtype (Star f a b) _`

`(Bind f) => Semigroupoid (Star f)`

`(Monad f) => Category (Star f)`

`(Functor f) => Functor (Star f a)`

`(Invariant f) => Invariant (Star f a)`

`(Apply f) => Apply (Star f a)`

`(Applicative f) => Applicative (Star f a)`

`(Bind f) => Bind (Star f a)`

`(Monad f) => Monad (Star f a)`

`(Alt f) => Alt (Star f a)`

`(Plus f) => Plus (Star f a)`

`(Alternative f) => Alternative (Star f a)`

`(MonadZero f) => MonadZero (Star f a)`

`(MonadPlus f) => MonadPlus (Star f a)`

`(Distributive f) => Distributive (Star f a)`

`(Functor f) => Profunctor (Star f)`

`(Functor f) => Strong (Star f)`

`(Applicative f) => Choice (Star f)`

`(Distributive f) => Closed (Star f)`

## Re-exports from **Data.**Profunctor.Strong

### #Strong

`class (Profunctor p) <= Strong p where`

The `Strong`

class extends `Profunctor`

with combinators for working with
product types.

`first`

and `second`

lift values in a `Profunctor`

to act on the first and
second components of a `Tuple`

, respectively.

Another way to think about Strong is to piggyback on the intuition of inputs and outputs. Rewriting the type signature in this light then yields:

```
first :: forall input output a. p input output -> p (Tuple input a) (Tuple output a)
second :: forall input output a. p input output -> p (Tuple a input) (Tuple a output)
```

If we specialize the profunctor p to the function arrow, we get the following type signatures, which may look a bit more familiar:

```
first :: forall input output a. (input -> output) -> (Tuple input a) -> (Tuple output a)
second :: forall input output a. (input -> output) -> (Tuple a input) -> (Tuple a output)
```

So, when the `profunctor`

is `Function`

application, `first`

essentially applies your function
to the first element of a `Tuple`

, and `second`

applies it to the second element (same as `map`

would do).

#### Members

`first :: forall a b c. p a b -> p (Tuple a c) (Tuple b c)`

`second :: forall a b c. p b c -> p (Tuple a b) (Tuple a c)`

#### Instances

`Strong Function`

### #(***)

Operator alias for Data.Profunctor.Strong.splitStrong *(right-associative / precedence 3)*

### #(&&&)

Operator alias for Data.Profunctor.Strong.fanout *(right-associative / precedence 3)*

## Re-exports from **Data.**Semigroup.Commutative

### #Commutative Source

`class (Semigroup g) <= Commutative g `

A `Commutative`

is a `Semigroup`

with a commutative operation. Instances
must satisfy the following law in addition to the group laws:

- Commutativity:
`forall x, y. x <> y = y <> x`

#### Instances

`Commutative Void`

`Commutative Unit`

`(Commutative g) => Commutative (Dual g)`

`(Ring r) => Commutative (Additive r)`

## Re-exports from **Data.**Symbol

### #IsSymbol Source

`class IsSymbol (sym :: Symbol) where`

A class for known symbols

#### Members

`reflectSymbol :: SProxy sym -> String`

#### Instances

`(IsSymbol left, IsSymbol right) => IsSymbol (TypeConcat left right)`

### #reifySymbol Source

`reifySymbol :: forall r. String -> (forall sym. IsSymbol sym => SProxy sym -> r) -> r`

## Re-exports from **Data.**Traversable

### #Traversable

`class (Functor t, Foldable t) <= Traversable t where`

`Traversable`

represents data structures which can be *traversed*,
accumulating results and effects in some `Applicative`

functor.

`traverse`

runs an action for every element in a data structure, and accumulates the results.`sequence`

runs the actions*contained*in a data structure, and accumulates the results.

The `traverse`

and `sequence`

functions should be compatible in the
following sense:

`traverse f xs = sequence (f <$> xs)`

`sequence = traverse id`

`Traversable`

instances should also be compatible with the corresponding
`Foldable`

instances, in the following sense:

`foldMap f = runConst <<< traverse (Const <<< f)`

Default implementations are provided by the following functions:

`traverseDefault`

`sequenceDefault`

#### Members

`traverse :: forall a b m. Applicative m => (a -> m b) -> t a -> m (t b)`

`sequence :: forall a m. Applicative m => t (m a) -> m (t a)`

#### Instances

`Traversable Array`

`Traversable Maybe`

`Traversable First`

`Traversable Last`

`Traversable Additive`

`Traversable Dual`

`Traversable Conj`

`Traversable Disj`

`Traversable Multiplicative`

### #scanr

`scanr :: forall a b f. Traversable f => (a -> b -> b) -> b -> f a -> f b`

Fold a data structure from the right, keeping all intermediate results
instead of only the final result. Note that the initial value does not
appear in the result (unlike Haskell's `Prelude.scanr`

).

```
scanr (+) 0 [1,2,3] = [1,3,6]
scanr (flip (-)) 10 [1,2,3] = [4,5,7]
```

### #scanl

`scanl :: forall a b f. Traversable f => (b -> a -> b) -> b -> f a -> f b`

Fold a data structure from the left, keeping all intermediate results
instead of only the final result. Note that the initial value does not
appear in the result (unlike Haskell's `Prelude.scanl`

).

```
scanl (+) 0 [1,2,3] = [1,3,6]
scanl (-) 10 [1,2,3] = [9,7,4]
```

### #for

`for :: forall a b m t. Applicative m => Traversable t => t a -> (a -> m b) -> m (t b)`

A version of `traverse`

with its arguments flipped.

This can be useful when running an action written using do notation for every element in a data structure:

For example:

```
for [1, 2, 3] \n -> do
print n
return (n * n)
```

## Re-exports from **Data.**Tuple

### #Tuple Source

`data Tuple a b`

A simple product type for wrapping a pair of component values.

#### Constructors

`Tuple a b`

#### Instances

`(Show a, Show b) => Show (Tuple a b)`

Allows

`Tuple`

s to be rendered as a string with`show`

whenever there are`Show`

instances for both component types.`(Eq a, Eq b) => Eq (Tuple a b)`

`(Eq a) => Eq1 (Tuple a)`

`(Ord a, Ord b) => Ord (Tuple a b)`

`(Ord a) => Ord1 (Tuple a)`

`(Bounded a, Bounded b) => Bounded (Tuple a b)`

`Semigroupoid Tuple`

`(Semigroup a, Semigroup b) => Semigroup (Tuple a b)`

The

`Semigroup`

instance enables use of the associative operator`<>`

on`Tuple`

s whenever there are`Semigroup`

instances for the component types. The`<>`

operator is applied pairwise, so:`(Tuple a1 b1) <> (Tuple a2 b2) = Tuple (a1 <> a2) (b1 <> b2)`

`(Monoid a, Monoid b) => Monoid (Tuple a b)`

`(Semiring a, Semiring b) => Semiring (Tuple a b)`

`(Ring a, Ring b) => Ring (Tuple a b)`

`(CommutativeRing a, CommutativeRing b) => CommutativeRing (Tuple a b)`

`(HeytingAlgebra a, HeytingAlgebra b) => HeytingAlgebra (Tuple a b)`

`(BooleanAlgebra a, BooleanAlgebra b) => BooleanAlgebra (Tuple a b)`

`Functor (Tuple a)`

The

`Functor`

instance allows functions to transform the contents of a`Tuple`

with the`<$>`

operator, applying the function to the second component, so:`f <$> (Tuple x y) = Tuple x (f y)`

`Invariant (Tuple a)`

`Bifunctor Tuple`

`(Semigroup a) => Apply (Tuple a)`

The

`Functor`

instance allows functions to transform the contents of a`Tuple`

with the`<*>`

operator whenever there is a`Semigroup`

instance for the`fst`

component, so:`(Tuple a1 f) <*> (Tuple a2 x) == Tuple (a1 <> a2) (f x)`

`Biapply Tuple`

`(Monoid a) => Applicative (Tuple a)`

`Biapplicative Tuple`

`(Semigroup a) => Bind (Tuple a)`

`(Monoid a) => Monad (Tuple a)`

`Extend (Tuple a)`

`Comonad (Tuple a)`

`(Lazy a, Lazy b) => Lazy (Tuple a b)`

`Foldable (Tuple a)`

`Bifoldable Tuple`

`Traversable (Tuple a)`

`Bitraversable Tuple`

`(TypeEquals a Unit) => Distributive (Tuple a)`

## Re-exports from **Data.**Tuple.Nested

### #(/\) Source

Operator alias for Data.Tuple.Tuple *(right-associative / precedence 6)*

Shorthand for constructing n-tuples as nested pairs.
`a /\ b /\ c /\ d /\ unit`

becomes `Tuple a (Tuple b (Tuple c (Tuple d unit)))`

### #type (/\) Source

Operator alias for Data.Tuple.Tuple *(right-associative / precedence 6)*

Shorthand for constructing n-tuple types as nested pairs.
`forall a b c d. a /\ b /\ c /\ d /\ Unit`

becomes
`forall a b c d. Tuple a (Tuple b (Tuple c (Tuple d Unit)))`

## Re-exports from **Debug.**Trace

### #traceShowM Source

`traceShowM :: forall m a. DebugWarning => Show a => Monad m => a -> m a`

Same as `traceAnyM`

but only for `Show`

able values

### #traceShowA Source

`traceShowA :: forall a b. DebugWarning => Show b => Applicative a => b -> a Unit`

Log a `Show`

able value to the console for debugging purposes and then
return the unit value of the Applicative `a`

.

### #traceShow Source

`traceShow :: forall a b. DebugWarning => Show a => a -> (Unit -> b) -> b`

Log a `Show`

able value to the console for debugging purposes and then
return a value.

### #traceAnyM Source

`traceAnyM :: forall m a. DebugWarning => Monad m => a -> m a`

Log any PureScript value to the console and return it in `Monad`

useful when one has monadic chains

```
mbArray :: Maybe (Array Int)
foo :: Int
foo = fromMaybe zero
$ mbArray
>>= traceAnyM
>>= head
>>= traceAnyM
```

### #traceAnyA Source

`traceAnyA :: forall a b. DebugWarning => Applicative a => b -> a Unit`

Log any PureScript value to the console and return the unit value of the
Applicative `a`

.

### #traceAny Source

`traceAny :: forall a b. DebugWarning => a -> (Unit -> b) -> b`

Log any PureScript value to the console for debugging purposes and then return a value. This will log the value's underlying representation for low-level debugging.

### #traceA Source

`traceA :: forall a. DebugWarning => Applicative a => String -> a Unit`

Log a message to the console for debugging purposes and then return the
unit value of the Applicative `a`

.

For example:

```
doSomething = do
traceA "Hello"
... some value or computation ...
```

### #trace Source

`trace :: forall a. DebugWarning => String -> (Unit -> a) -> a`

Log a message to the console for debugging purposes and then return a value. The return value is thunked so it is not evaluated until after the message has been printed, to preserve a predictable console output.

For example:

```
doSomething = trace "Hello" \_ -> ... some value or computation ...
```

### #spy Source

`spy :: forall a. DebugWarning => a -> a`

Log any value and return it

## Re-exports from **Partial
**

## Re-exports from **Partial.**Unsafe

### #unsafePartial Source

`unsafePartial :: forall a. (Partial => a) -> a`

Discharge a partiality constraint, unsafely.

### #unsafeCrashWith Source

`unsafeCrashWith :: forall a. String -> a`

A function which crashes with the specified error message.

## Re-exports from **Prelude
**

### #Void

`newtype Void`

An uninhabited data type.

`Void`

is useful to eliminate the possibility of a value being created.
For example, a value of type `Either Void Boolean`

can never have
a Left value created in PureScript.

#### Instances

`Show Void`

### #Unit

`data Unit :: Type`

The `Unit`

type has a single inhabitant, called `unit`

. It represents
values with no computational content.

`Unit`

is often used, wrapped in a monadic type constructor, as the
return type of a computation where only
the *effects* are important.

#### Instances

`Show Unit`

### #Ordering

`data Ordering`

The `Ordering`

data type represents the three possible outcomes of
comparing two values:

`LT`

- The first value is *less than* the second.
`GT`

- The first value is *greater than* the second.
`EQ`

- The first value is *equal to* the second.

#### Constructors

`LT`

`GT`

`EQ`

#### Instances

`Eq Ordering`

`Semigroup Ordering`

`Show Ordering`

### #Applicative

`class (Apply f) <= Applicative f where`

The `Applicative`

type class extends the `Apply`

type class
with a `pure`

function, which can be used to create values of type `f a`

from values of type `a`

.

Where `Apply`

provides the ability to lift functions of two or
more arguments to functions whose arguments are wrapped using `f`

, and
`Functor`

provides the ability to lift functions of one
argument, `pure`

can be seen as the function which lifts functions of
*zero* arguments. That is, `Applicative`

functors support a lifting
operation for any number of function arguments.

Instances must satisfy the following laws in addition to the `Apply`

laws:

- Identity:
`(pure id) <*> v = v`

- Composition:
`pure (<<<) <*> f <*> g <*> h = f <*> (g <*> h)`

- Homomorphism:
`(pure f) <*> (pure x) = pure (f x)`

- Interchange:
`u <*> (pure y) = (pure (_ $ y)) <*> u`

#### Members

`pure :: forall a. a -> f a`

#### Instances

`Applicative (Function r)`

`Applicative Array`

### #Apply

`class (Functor f) <= Apply f where`

The `Apply`

class provides the `(<*>)`

which is used to apply a function
to an argument under a type constructor.

`Apply`

can be used to lift functions of two or more arguments to work on
values wrapped with the type constructor `f`

. It might also be understood
in terms of the `lift2`

function:

```
lift2 :: forall f a b c. Apply f => (a -> b -> c) -> f a -> f b -> f c
lift2 f a b = f <$> a <*> b
```

`(<*>)`

is recovered from `lift2`

as `lift2 ($)`

. That is, `(<*>)`

lifts
the function application operator `($)`

to arguments wrapped with the
type constructor `f`

.

Instances must satisfy the following law in addition to the `Functor`

laws:

- Associative composition:
`(<<<) <$> f <*> g <*> h = f <*> (g <*> h)`

Formally, `Apply`

represents a strong lax semi-monoidal endofunctor.

#### Members

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

#### Instances

`Apply (Function r)`

`Apply Array`

### #Bind

`class (Apply m) <= Bind m where`

The `Bind`

type class extends the `Apply`

type class with a
"bind" operation `(>>=)`

which composes computations in sequence, using
the return value of one computation to determine the next computation.

The `>>=`

operator can also be expressed using `do`

notation, as follows:

```
x >>= f = do y <- x
f y
```

where the function argument of `f`

is given the name `y`

.

Instances must satisfy the following law in addition to the `Apply`

laws:

- Associativity:
`(x >>= f) >>= g = x >>= (\k -> f k >>= g)`

Associativity tells us that we can regroup operations which use `do`

notation so that we can unambiguously write, for example:

```
do x <- m1
y <- m2 x
m3 x y
```

#### Members

`bind :: forall a b. m a -> (a -> m b) -> m b`

#### Instances

`Bind (Function r)`

`Bind Array`

### #BooleanAlgebra

`class (HeytingAlgebra a) <= BooleanAlgebra a `

The `BooleanAlgebra`

type class represents types that behave like boolean
values.

Instances should satisfy the following laws in addition to the
`HeytingAlgebra`

law:

- Excluded middle:
`a || not a = tt`

#### Instances

`BooleanAlgebra Boolean`

`BooleanAlgebra Unit`

`(BooleanAlgebra b) => BooleanAlgebra (a -> b)`

### #Bounded

`class (Ord a) <= Bounded a where`

The `Bounded`

type class represents totally ordered types that have an
upper and lower boundary.

Instances should satisfy the following law in addition to the `Ord`

laws:

- Bounded:
`bottom <= a <= top`

#### Members

`top :: a`

`bottom :: a`

#### Instances

`Bounded Boolean`

`Bounded Int`

`Bounded Char`

Characters fall within the Unicode range.

`Bounded Ordering`

`Bounded Unit`

### #Category

`class (Semigroupoid a) <= Category a where`

`Category`

s consist of objects and composable morphisms between them, and
as such are `Semigroupoids`

, but unlike `semigroupoids`

must have an identity element.

Instances must satisfy the following law in addition to the
`Semigroupoid`

law:

- Identity:
`id <<< p = p <<< id = p`

#### Members

`id :: forall t. a t t`

#### Instances

`Category Function`

### #CommutativeRing

`class (Ring a) <= CommutativeRing a `

The `CommutativeRing`

class is for rings where multiplication is
commutative.

Instances must satisfy the following law in addition to the `Ring`

laws:

- Commutative multiplication:
`a * b = b * a`

#### Instances

`CommutativeRing Int`

`CommutativeRing Number`

`CommutativeRing Unit`

`(CommutativeRing b) => CommutativeRing (a -> b)`

### #Discard

`class Discard a where`

A class for types whose values can safely be discarded
in a `do`

notation block.

An example is the `Unit`

type, since there is only one
possible value which can be returned.

#### Members

`discard :: forall f b. Bind f => f a -> (a -> f b) -> f b`

#### Instances

`Discard Unit`

### #DivisionRing

`class (Ring a) <= DivisionRing a where`

The `DivisionRing`

class is for non-zero rings in which every non-zero
element has a multiplicative inverse. Division rings are sometimes also
called *skew fields*.

Instances must satisfy the following laws in addition to the `Ring`

laws:

- Non-zero ring:
`one /= zero`

- Non-zero multiplicative inverse:
`recip a * a = a * recip a = one`

for all non-zero`a`

The result of `recip zero`

is left undefined; individual instances may
choose how to handle this case.

If a type has both `DivisionRing`

and `CommutativeRing`

instances, then
it is a field and should have a `Field`

instance.

#### Members

`recip :: a -> a`

#### Instances

`DivisionRing Number`

### #Eq

`class Eq a where`

The `Eq`

type class represents types which support decidable equality.

`Eq`

instances should satisfy the following laws:

- Reflexivity:
`x == x = true`

- Symmetry:
`x == y = y == x`

- Transitivity: if
`x == y`

and`y == z`

then`x == z`

**Note:** The `Number`

type is not an entirely law abiding member of this
class due to the presence of `NaN`

, since `NaN /= NaN`

. Additionally,
computing with `Number`

can result in a loss of precision, so sometimes
values that should be equivalent are not.

#### Members

`eq :: a -> a -> Boolean`

#### Instances

`Eq Boolean`

`Eq Int`

`Eq Number`

`Eq Char`

`Eq String`

`Eq Unit`

`Eq Void`

`(Eq a) => Eq (Array a)`

### #EuclideanRing

`class (CommutativeRing a) <= EuclideanRing a where`

The `EuclideanRing`

class is for commutative rings that support division.
The mathematical structure this class is based on is sometimes also called
a *Euclidean domain*.

Instances must satisfy the following laws in addition to the `Ring`

laws:

- Integral domain:
`one /= zero`

, and if`a`

and`b`

are both nonzero then so is their product`a * b`

- Euclidean function
`degree`

:- Nonnegativity: For all nonzero
`a`

,`degree a >= 0`

- Quotient/remainder: For all
`a`

and`b`

, where`b`

is nonzero, let`q = a / b`

and`r = a `mod` b`

; then`a = q*b + r`

, and also either`r = zero`

or`degree r < degree b`

- Nonnegativity: For all nonzero
- Submultiplicative euclidean function:
- For all nonzero
`a`

and`b`

,`degree a <= degree (a * b)`

- For all nonzero

The behaviour of division by `zero`

is unconstrained by these laws,
meaning that individual instances are free to choose how to behave in this
case. Similarly, there are no restrictions on what the result of
`degree zero`

is; it doesn't make sense to ask for `degree zero`

in the
same way that it doesn't make sense to divide by `zero`

, so again,
individual instances may choose how to handle this case.

For any `EuclideanRing`

which is also a `Field`

, one valid choice
for `degree`

is simply `const 1`

. In fact, unless there's a specific
reason not to, `Field`

types should normally use this definition of
`degree`

.

#### Members

`degree :: a -> Int`

`div :: a -> a -> a`

`mod :: a -> a -> a`

#### Instances

`EuclideanRing Int`

`EuclideanRing Number`

### #Field

`class (EuclideanRing a) <= Field a `

The `Field`

class is for types that are (commutative) fields.

Instances must satisfy the following law in addition to the
`EuclideanRing`

laws:

- Non-zero multiplicative inverse:
`a `mod` b = zero`

for all`a`

and`b`

If a type has a `Field`

instance, it should also have a `DivisionRing`

instance. In a future release, `DivisionRing`

may become a superclass of
`Field`

.

#### Instances

`Field Number`

### #Functor

`class Functor f where`

A `Functor`

is a type constructor which supports a mapping operation
`map`

.

`map`

can be used to turn functions `a -> b`

into functions
`f a -> f b`

whose argument and return types use the type constructor `f`

to represent some computational context.

Instances must satisfy the following laws:

- Identity:
`map id = id`

- Composition:
`map (f <<< g) = map f <<< map g`

#### Members

`map :: forall a b. (a -> b) -> f a -> f b`

#### Instances

`Functor (Function r)`

`Functor Array`

### #HeytingAlgebra

`class HeytingAlgebra a where`

The `HeytingAlgebra`

type class represents types that are bounded lattices with
an implication operator such that the following laws hold:

- Associativity:
`a || (b || c) = (a || b) || c`

`a && (b && c) = (a && b) && c`

- Commutativity:
`a || b = b || a`

`a && b = b && a`

- Absorption:
`a || (a && b) = a`

`a && (a || b) = a`

- Idempotent:
`a || a = a`

`a && a = a`

- Identity:
`a || ff = a`

`a && tt = a`

- Implication:
`a `implies` a = tt`

`a && (a `implies` b) = a && b`

`b && (a `implies` b) = b`

`a `implies` (b && c) = (a `implies` b) && (a `implies` c)`

- Complemented:
`not a = a `implies` ff`

#### Members

`conj :: a -> a -> a`

`disj :: a -> a -> a`

`not :: a -> a`

#### Instances

`HeytingAlgebra Boolean`

`HeytingAlgebra Unit`

`(HeytingAlgebra b) => HeytingAlgebra (a -> b)`

### #Monad

`class (Applicative m, Bind m) <= Monad m `

The `Monad`

type class combines the operations of the `Bind`

and
`Applicative`

type classes. Therefore, `Monad`

instances represent type
constructors which support sequential composition, and also lifting of
functions of arbitrary arity.

Instances must satisfy the following laws in addition to the
`Applicative`

and `Bind`

laws:

- Left Identity:
`pure x >>= f = f x`

- Right Identity:
`x >>= pure = x`

#### Instances

`Monad (Function r)`

`Monad Array`

### #Ord

`class (Eq a) <= Ord a where`

The `Ord`

type class represents types which support comparisons with a
*total order*.

`Ord`

instances should satisfy the laws of total orderings:

- Reflexivity:
`a <= a`

- Antisymmetry: if
`a <= b`

and`b <= a`

then`a = b`

- Transitivity: if
`a <= b`

and`b <= c`

then`a <= c`

#### Members

`compare :: a -> a -> Ordering`

#### Instances

`Ord Boolean`

`Ord Int`

`Ord Number`

`Ord String`

`Ord Char`

`Ord Unit`

`Ord Void`

`(Ord a) => Ord (Array a)`

`Ord Ordering`

### #Ring

`class (Semiring a) <= Ring a where`

The `Ring`

class is for types that support addition, multiplication,
and subtraction operations.

Instances must satisfy the following law in addition to the `Semiring`

laws:

- Additive inverse:
`a - a = (zero - a) + a = zero`

#### Members

`sub :: a -> a -> a`

#### Instances

`Ring Int`

`Ring Number`

`Ring Unit`

`(Ring b) => Ring (a -> b)`

### #Semigroup

`class Semigroup a where`

The `Semigroup`

type class identifies an associative operation on a type.

Instances are required to satisfy the following law:

- Associativity:
`(x <> y) <> z = x <> (y <> z)`

One example of a `Semigroup`

is `String`

, with `(<>)`

defined as string
concatenation.

#### Members

`append :: a -> a -> a`

#### Instances

`Semigroup String`

`Semigroup Unit`

`Semigroup Void`

`(Semigroup s') => Semigroup (s -> s')`

`Semigroup (Array a)`

### #Semigroupoid

`class Semigroupoid a where`

A `Semigroupoid`

is similar to a `Category`

but does not
require an identity element `id`

, just composable morphisms.

`Semigroupoid`

s must satisfy the following law:

- Associativity:
`p <<< (q <<< r) = (p <<< q) <<< r`

One example of a `Semigroupoid`

is the function type constructor `(->)`

,
with `(<<<)`

defined as function composition.

#### Members

`compose :: forall b c d. a c d -> a b c -> a b d`

#### Instances

`Semigroupoid Function`

### #Semiring

`class Semiring a where`

The `Semiring`

class is for types that support an addition and
multiplication operation.

Instances must satisfy the following laws:

- Commutative monoid under addition:
- Associativity:
`(a + b) + c = a + (b + c)`

- Identity:
`zero + a = a + zero = a`

- Commutative:
`a + b = b + a`

- Associativity:
- Monoid under multiplication:
- Associativity:
`(a * b) * c = a * (b * c)`

- Identity:
`one * a = a * one = a`

- Associativity:
- Multiplication distributes over addition:
- Left distributivity:
`a * (b + c) = (a * b) + (a * c)`

- Right distributivity:
`(a + b) * c = (a * c) + (b * c)`

- Left distributivity:
- Annihilation:
`zero * a = a * zero = zero`

**Note:** The `Number`

and `Int`

types are not fully law abiding
members of this class hierarchy due to the potential for arithmetic
overflows, and in the case of `Number`

, the presence of `NaN`

and
`Infinity`

values. The behaviour is unspecified in these cases.

#### Members

`add :: a -> a -> a`

`zero :: a`

`mul :: a -> a -> a`

`one :: a`

#### Instances

`Semiring Int`

`Semiring Number`

`(Semiring b) => Semiring (a -> b)`

`Semiring Unit`

### #Show

`class Show a where`

The `Show`

type class represents those types which can be converted into
a human-readable `String`

representation.

While not required, it is recommended that for any expression `x`

, the
string `show x`

be executable PureScript code which evaluates to the same
value as the expression `x`

.

#### Members

`show :: a -> String`

#### Instances

`Show Boolean`

`Show Int`

`Show Number`

`Show Char`

`Show String`

`(Show a) => Show (Array a)`

### #whenM

`whenM :: forall m. Monad m => m Boolean -> m Unit -> m Unit`

Perform a monadic action when a condition is true, where the conditional value is also in a monadic context.

### #when

`when :: forall m. Applicative m => Boolean -> m Unit -> m Unit`

Perform an applicative action when a condition is true.

### #void

`void :: forall f a. Functor f => f a -> f Unit`

The `void`

function is used to ignore the type wrapped by a
`Functor`

, replacing it with `Unit`

and keeping only the type
information provided by the type constructor itself.

`void`

is often useful when using `do`

notation to change the return type
of a monadic computation:

```
main = forE 1 10 \n -> void do
print n
print (n * n)
```

### #unlessM

`unlessM :: forall m. Monad m => m Boolean -> m Unit -> m Unit`

Perform a monadic action unless a condition is true, where the conditional value is also in a monadic context.

### #unless

`unless :: forall m. Applicative m => Boolean -> m Unit -> m Unit`

Perform an applicative action unless a condition is true.

### #unit

`unit :: Unit`

`unit`

is the sole inhabitant of the `Unit`

type.

### #otherwise

`otherwise :: Boolean`

An alias for `true`

, which can be useful in guard clauses:

```
max x y | x >= y = x
| otherwise = y
```

### #notEq

`notEq :: forall a. Eq a => a -> a -> Boolean`

`notEq`

tests whether one value is *not equal* to another. Shorthand for
`not (eq x y)`

.

### #negate

`negate :: forall a. Ring a => a -> a`

`negate x`

can be used as a shorthand for `zero - x`

.

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

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

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

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

### #lcm

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

The *least common multiple* of two values.

### #join

`join :: forall a m. Bind m => m (m a) -> m a`

Collapse two applications of a monadic type constructor into one.

### #ifM

`ifM :: forall a m. Bind m => m Boolean -> m a -> m a -> m a`

Execute a monadic action if a condition holds.

For example:

```
main = ifM ((< 0.5) <$> random)
(trace "Heads")
(trace "Tails")
```

### #gcd

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

The *greatest common divisor* of two values.

### #flip

`flip :: forall a b c. (a -> b -> c) -> b -> a -> c`

Flips the order of the arguments to a function of two arguments.

```
flip const 1 2 = const 2 1 = 2
```

### #flap

`flap :: forall f a b. Functor f => f (a -> b) -> a -> f b`

Apply a value in a computational context to a value in no context.

Generalizes `flip`

.

```
longEnough :: String -> Bool
hasSymbol :: String -> Bool
hasDigit :: String -> Bool
password :: String
validate :: String -> List Bool
validate = flap [longEnough, hasSymbol, hasDigit]
```

```
flap (-) 3 4 == 1
threeve <$> Just 1 <@> 'a' <*> Just true == Just (threeve 1 'a' true)
```

### #const

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

Returns its first argument and ignores its second.

```
const 1 "hello" = 1
```

### #comparing

`comparing :: forall a b. Ord b => (a -> b) -> (a -> a -> Ordering)`

Compares two values by mapping them to a type with an `Ord`

instance.

### #clamp

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

Clamp a value between a minimum and a maximum. For example:

```
let f = clamp 0 10
f (-5) == 0
f 5 == 5
f 15 == 10
```

### #between

`between :: forall a. Ord a => a -> a -> a -> Boolean`

Test whether a value is between a minimum and a maximum (inclusive). For example:

```
let f = between 0 10
f 0 == true
f (-5) == false
f 5 == true
f 10 == true
f 15 == false
```

### #ap

`ap :: forall m a b. Monad m => m (a -> b) -> m a -> m b`

`ap`

provides a default implementation of `(<*>)`

for any
`Monad`

, without using `(<*>)`

as provided by the
`Apply`

-`Monad`

superclass relationship.

`ap`

can therefore be used to write `Apply`

instances as
follows:

```
instance applyF :: Apply F where
apply = ap
```

### #absurd

`absurd :: forall a. Void -> a`

### #(||)

Operator alias for Data.HeytingAlgebra.disj *(right-associative / precedence 2)*

### #(>>>)

Operator alias for Control.Semigroupoid.composeFlipped *(right-associative / precedence 9)*

### #(>>=)

Operator alias for Control.Bind.bind *(left-associative / precedence 1)*

### #(>=>)

Operator alias for Control.Bind.composeKleisli *(right-associative / precedence 1)*

### #(>=)

Operator alias for Data.Ord.greaterThanOrEq *(left-associative / precedence 4)*

### #(>)

Operator alias for Data.Ord.greaterThan *(left-associative / precedence 4)*

### #(==)

Operator alias for Data.Eq.eq *(non-associative / precedence 4)*

### #(=<<)

Operator alias for Control.Bind.bindFlipped *(right-associative / precedence 1)*

### #(<@>)

Operator alias for Data.Functor.flap *(left-associative / precedence 4)*

### #(<>)

Operator alias for Data.Semigroup.append *(right-associative / precedence 5)*

### #(<=<)

Operator alias for Control.Bind.composeKleisliFlipped *(right-associative / precedence 1)*

### #(<=)

Operator alias for Data.Ord.lessThanOrEq *(left-associative / precedence 4)*

### #(<<<)

Operator alias for Control.Semigroupoid.compose *(right-associative / precedence 9)*

### #(<*>)

Operator alias for Control.Apply.apply *(left-associative / precedence 4)*

### #(<*)

Operator alias for Control.Apply.applyFirst *(left-associative / precedence 4)*

### #(<$>)

Operator alias for Data.Functor.map *(left-associative / precedence 4)*

### #(<$)

Operator alias for Data.Functor.voidRight *(left-associative / precedence 4)*

### #(<#>)

Operator alias for Data.Functor.mapFlipped *(left-associative / precedence 1)*

### #(<)

Operator alias for Data.Ord.lessThan *(left-associative / precedence 4)*

### #(/=)

Operator alias for Data.Eq.notEq *(non-associative / precedence 4)*

### #(/)

Operator alias for Data.EuclideanRing.div *(left-associative / precedence 7)*

### #(-)

Operator alias for Data.Ring.sub *(left-associative / precedence 6)*

### #(+)

Operator alias for Data.Semiring.add *(left-associative / precedence 6)*

### #(*>)

Operator alias for Control.Apply.applySecond *(left-associative / precedence 4)*

### #(*)

Operator alias for Data.Semiring.mul *(left-associative / precedence 7)*

### #(&&)

Operator alias for Data.HeytingAlgebra.conj *(right-associative / precedence 3)*

### #($>)

Operator alias for Data.Functor.voidLeft *(left-associative / precedence 4)*

### #($)

Operator alias for Data.Function.apply *(right-associative / precedence 0)*

Applies a function to an argument: the reverse of `(#)`

.

```
length $ groupBy productCategory $ filter isInStock $ products
```

is equivalent to:

```
length (groupBy productCategory (filter isInStock products))
```

Or another alternative equivalent, applying chain of composed functions to a value:

```
length <<< groupBy productCategory <<< filter isInStock $ products
```

### #(#)

Operator alias for Data.Function.applyFlipped *(left-associative / precedence 1)*

Applies an argument to a function: the reverse of `($)`

.

```
products # filter isInStock # groupBy productCategory # length
```

is equivalent to:

```
length (groupBy productCategory (filter isInStock products))
```

Or another alternative equivalent, applying a value to a chain of composed functions:

```
products # filter isInStock >>> groupBy productCategory >>> length
```

### #type (~>)

Operator alias for Data.NaturalTransformation.NaturalTransformation *(right-associative / precedence 4)*

## Re-exports from **Type.**Proxy

### #Proxy3 Source

### #Proxy2 Source

## Re-exports from **Unsafe.**Coerce

### #unsafeCoerce Source

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

A *highly unsafe* function, which can be used to persuade the type system that
any type is the same as any other type. When using this function, it is your
(that is, the caller's) responsibility to ensure that the underlying
representation for both types is the same.

One application for this function is to avoid doing work that you know is a
no-op because of newtypes. For example, if you have an `Array (Conj a)`

and you
want an `Array (Disj a)`

, you could do `Data.Array.map (runConj >>> Disj)`

, but
this performs an unnecessary traversal. `unsafeCoerce`

accomplishes the same
for free.

It is highly recommended to define specializations of this function rather than using it as-is. For example:

```
mapConjToDisj :: forall a. Array (Conj a) -> Array (Disj a)
mapConjToDisj = unsafeCoerce
```

This way, you won't have any nasty surprises due to the inferred type being different to what you expected.

- Modules
- Stuff

The

`Functor`

instance allows functions to transform the contents of a`Right`

with the`<$>`

operator:`Left`

values are untouched: