Skip to main content

Writer

Instances

Constructors

Mapping

Model

Type lambdas

Utilities

Instances

Functor

Signature

export declare const Functor: Functor2<URI>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

getApplicative

Signature

export declare const getApplicative: <W>(M: Monoid<W>) => Applicative2C<'Writer', W>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

getApply

Signature

export declare const getApply: <W>(S: Semigroup<W>) => Apply2C<'Writer', W>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

getChain

Signature

export declare function getChain<W>(S: Semigroup<W>): Chain2C<URI, W>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

getMonad

Signature

export declare function getMonad<W>(M: Monoid<W>): Monad2C<URI, W>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

getPointed

Signature

export declare const getPointed: <W>(M: Monoid<W>) => Pointed2C<'Writer', W>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

Constructors

tell

Appends a value to the accumulator

Signature

export declare const tell: <W>(w: W) => Writer<W, void>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

Mapping

flap

Signature

export declare const flap: <A>(a: A) => <E, B>(fab: Writer<E, (a: A) => B>) => Writer<E, B>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

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>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

Model

Writer

Signature

export interface Writer<W, A> {
(): [A, W]
}

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

Type lambdas

URI

Signature

export type URI = typeof URI

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

URI

Signature

export declare const URI = 'Writer'

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

Utilities

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>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

evalWriter

Use evaluate instead

Signature

export declare const evalWriter: <W, A>(fa: Writer<W, A>) => A

Details

  • Added in 0.1.0
  • Deprecated

License

  • MIT – Copyright (c) 2017-present Giulio Canti

evaluate

Signature

export declare const evaluate: <W, A>(fa: Writer<W, A>) => A

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

execWriter

Use execute instead

Signature

export declare const execWriter: <W, A>(fa: Writer<W, A>) => W

Details

  • Added in 0.1.0
  • Deprecated

License

  • MIT – Copyright (c) 2017-present Giulio Canti

execute

Signature

export declare const execute: <W, A>(fa: Writer<W, A>) => W

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

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

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

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

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

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>

Details

  • Added in 0.1.0

License

  • MIT – Copyright (c) 2017-present Giulio Canti

writer

Use Functor instead.

Signature

export declare const writer: Functor2<URI>

Details

  • Added in 0.1.0
  • Deprecated

License

  • MIT – Copyright (c) 2017-present Giulio Canti