Module

# ApplicativePhases

Package
purescript-applicative-phases
Repository
artemisSystem/purescript-applicative-phases

### #PhasesSource

``data Phases :: (Type -> Type) -> Type -> Type``data Phases f a``

#### Constructors

• `Nil a`
• `Cons (forall r. (forall y z. (y -> z -> a) -> f y -> Phases f z -> r) -> r)`

#### Instances

• `Functor (Phases f)`
• `(Apply f) => Apply (Phases f)`
• `(Apply f) => Applicative (Phases f)`

### #nowSource

``now :: forall @f @a. f a -> Phases f a``

Create a singleton list.

### #laterSource

``later :: forall @f @a. Applicative f => Phases f a -> Phases f a``

Delay all of a list's computations by one phase.

### #phaseSource

``phase :: forall @f @a. Applicative f => Int -> f a -> Phases f a``

Insert a computation at the given index/"phase". The first phase is 0, and providing a number lower than 0 also inserts at phase 0.

### #foldPhasesSource

``foldPhases :: forall @f. Applicative f => (Phases f) ~> f``

Fold a list of computations into a single computation.

### #consSource

``cons :: forall @f @a @b. f (a -> b) -> Phases f a -> Phases f b``

Append a computation to the start of a list, applying the result of the new computation to the result of the rest of the list.

### #(:)Source

Operator alias for ApplicativePhases.cons (right-associative / precedence 6)

### #consFstSource

``consFst :: forall @f @a @b. f a -> Phases f b -> Phases f a``

Append a computation to the start of a list, keeping only the result of that first computation.

### #consSndSource

``consSnd :: forall @f @a @b. f a -> Phases f b -> Phases f b``

Append a computation to the start of a list, keeping only the result of the tail of the list.

### #cons'Source

``cons' :: forall @f @a @b @c. (a -> b -> c) -> f a -> Phases f b -> Phases f c``

Append a computation to the start of a list, providing a combining function.

### #indexSource

``index :: forall @f @a. Applicative f => Int -> Phases f a -> f Unit``

Get the computation at a certain index, returning `pure unit` if out of bounds.

### #index'Source

``index' :: forall @f @a. Functor f => Int -> Phases f a -> Maybe (f Unit)``

Get the computation at a certain index.

``head :: forall @f @a. Applicative f => Phases f a -> f Unit``

Get the first computation, returning `pure unit` if there isn't one.

### #tailSource

``tail :: forall @f @a. Applicative f => Phases f a -> Phases f Unit``

Get all the computations except the first, returning an empty list if there are none.

``head' :: forall @f @a. Functor f => Phases f a -> Maybe (f Unit)``

Get the first computation.

### #tail'Source

``tail' :: forall @f @a. Phases f a -> Maybe (Phases f Unit)``

Get all the computations except the first.

### #nullSource

``null :: forall @f @a. Phases f a -> Boolean``

Check if a list is empty.

### #lengthSource

``length :: forall @f @a. Phases f a -> Int``

Find the length of a list.