A dual of Monad, the framework of computing neighbor states in parallel.

All instances of the comonad c must satisfy the following laws:

  • Duplicate then extract: For all x; c.extract(c.duplicate(x)) equals to x,
  • Extract as identity of map: For all x; c.map(c.extract)(c.duplicate(x)) equals to x,
  • Duplicate as identity of map: For all x; c.duplicate(c.duplicate(x)) equals to c.map(c.duplicate)(c.duplicate(x)).

Type Parameters

  • S

  • W

Hierarchy

Properties

duplicate: (<A>(wa) => Instance<Apply1<W, Instance<Apply1<W, A>>>>)

Type declaration

extract: (<A>(wa) => A)

Type declaration

    • <A>(wa): A
    • Extracts the internal state of type A.

      Type Parameters

      • A

      Parameters

      Returns A

      The value of type A.

map: (<T, U>(fn) => ((t) => Instance<Apply1<W, U>>))

Type declaration

peek: ((position) => (<A>(store) => A))

Type declaration

    • (position): (<A>(store) => A)
    • Parameters

      • position: S

      Returns (<A>(store) => A)

        • <A>(store): A
        • Type Parameters

          • A

          Parameters

          Returns A

pos: (<A>(store) => S)

Type declaration

    • <A>(store): S
    • Type Parameters

      • A

      Parameters

      Returns S

Generated using TypeDoc