Writer overview
Added in v2.0.0
Table of contents
constructors
tell
Appends a value to the accumulator
Signature
export declare const tell: <W>(w: W) => Writer<W, void>
Added in v2.0.0
instances
Functor
Signature
export declare const Functor: Functor2<'Writer'>
Added in v2.7.0
getApplicative
Signature
export declare const getApplicative: <W>(M: Monoid<W>) => Applicative2C<'Writer', W>
Added in v2.10.0
getApply
Signature
export declare const getApply: <W>(S: Semigroup<W>) => Apply2C<'Writer', W>
Added in v2.10.0
getChain
Signature
export declare function getChain<W>(S: Semigroup<W>): Chain2C<URI, W>
Added in v2.10.0
getMonad
Signature
export declare function getMonad<W>(M: Monoid<W>): Monad2C<URI, W>
Added in v2.0.0
getPointed
Signature
export declare const getPointed: <W>(M: Monoid<W>) => Pointed2C<'Writer', W>
Added in v2.10.0
mapping
flap
Signature
export declare const flap: <A>(a: A) => <E, B>(fab: Writer<E, (a: A) => B>) => Writer<E, B>
Added in v2.10.0
map
map
can be used to turn functions (a: A) => B
into functions (fa: F<A>) => F<B>
whose argument and return types use the type constructor F
to represent some computational context.
Signature
export declare const map: <A, B>(f: (a: A) => B) => <E>(fa: Writer<E, A>) => Writer<E, B>
Added in v2.0.0
model
Writer (interface)
Signature
export interface Writer<W, A> {
(): [A, W]
}
Added in v2.0.0
type lambdas
URI
Signature
export declare const URI: 'Writer'
Added in v2.0.0
URI (type alias)
Signature
export type URI = typeof URI
Added in v2.0.0
utils
censor
Modify the final accumulator value by applying a function
Signature
export declare const censor: <W>(f: (w: W) => W) => <A>(fa: Writer<W, A>) => Writer<W, A>
Added in v2.0.0
evaluate
Signature
export declare const evaluate: <W, A>(fa: Writer<W, A>) => A
Added in v2.8.0
execute
Signature
export declare const execute: <W, A>(fa: Writer<W, A>) => W
Added in v2.8.0
listen
Modifies the result to include the changes to the accumulator
Signature
export declare const listen: <W, A>(fa: Writer<W, A>) => Writer<W, [A, W]>
Added in v2.0.0
listens
Projects a value from modifications made to the accumulator during an action
Signature
export declare const listens: <W, B>(f: (w: W) => B) => <A>(fa: Writer<W, A>) => Writer<W, [A, B]>
Added in v2.0.0
pass
Applies the returned function to the accumulator
Signature
export declare const pass: <W, A>(fa: Writer<W, [A, (w: W) => W]>) => Writer<W, A>
Added in v2.0.0
zone of death
evalWriter
Use evaluate
instead
Signature
export declare const evalWriter: <W, A>(fa: Writer<W, A>) => A
Added in v2.0.0
execWriter
Use execute
instead
Signature
export declare const execWriter: <W, A>(fa: Writer<W, A>) => W
Added in v2.0.0
writer
Use Functor
instead.
Signature
export declare const writer: Functor2<'Writer'>
Added in v2.0.0