Options
All
  • Public
  • Public/Protected
  • All
Menu

Type class laws defined for Comonad.

This is an abstract definition. In order to use it in unit testing, the implementor must think of a strategy to evaluate the truthiness of the returned Equiv values.

Even though in TypeScript the Funfix library is using classes to express these laws, when implementing this class it is recommended that you implement it as a mixin using implements, instead of extending it directly with extends. See TypeScript: Mixins for details and note that we already have applyMixins defined.

We are doing this in order to support multiple inheritance and to avoid inheriting any static members. In the Flow definitions (e.g. .js.flow files) for Funfix these classes are defined with interface, as they are meant to be interfaces that sometimes have default implementations and not classes.

Type parameters

  • F

Hierarchy

  • ComonadLaws

Implements

Index

Properties

F

F: Comonad<F>

The Comonad designated instance for F, to be tested.

coflatMapAssociativity

coflatMapAssociativity: function

Type declaration

    • <A, B, C>(fa: HK<F, A>, f: function, g: function): Equiv<HK<F, C>>
    • Type parameters

      • A

      • B

      • C

      Parameters

      • fa: HK<F, A>
      • f: function
          • (a: HK<F, A>): B
          • Parameters

            • a: HK<F, A>

            Returns B

      • g: function
          • (b: HK<F, B>): C
          • Parameters

            • b: HK<F, B>

            Returns C

      Returns Equiv<HK<F, C>>

coflatMapIdentity

coflatMapIdentity: function

Type declaration

    • Type parameters

      • A

      Parameters

      • fa: HK<F, A>

      Returns Equiv<HK<F, HK<F, A>>>

coflattenCoherence

coflattenCoherence: function

Type declaration

    • <A, B>(fa: HK<F, A>, f: function): Equiv<HK<F, B>>
    • Type parameters

      • A

      • B

      Parameters

      • fa: HK<F, A>
      • f: function
          • (a: HK<F, A>): B
          • Parameters

            • a: HK<F, A>

            Returns B

      Returns Equiv<HK<F, B>>

coflattenThroughMap

coflattenThroughMap: function

Type declaration

    • Type parameters

      • A

      Parameters

      • fa: HK<F, A>

      Returns Equiv<HK<F, HK<F, HK<F, A>>>>

covariantComposition

covariantComposition: function

Type declaration

    • <A, B, C>(fa: HK<F, A>, f: function, g: function): Equiv<HK<F, C>>
    • Type parameters

      • A

      • B

      • C

      Parameters

      • fa: HK<F, A>
      • f: function
          • (a: A): B
          • Parameters

            • a: A

            Returns B

      • g: function
          • (b: B): C
          • Parameters

            • b: B

            Returns C

      Returns Equiv<HK<F, C>>

covariantIdentity

covariantIdentity: function

Type declaration

    • Type parameters

      • A

      Parameters

      • fa: HK<F, A>

      Returns Equiv<HK<F, A>>

Methods

comonadLeftIdentity

  • comonadLeftIdentity<A>(fa: HK<F, A>): Equiv<HK<F, A>>
  • fa.coflatMap(_.extract) <-> fa
    

    Type parameters

    • A

    Parameters

    • fa: HK<F, A>

    Returns Equiv<HK<F, A>>

comonadRightIdentity

  • comonadRightIdentity<A, B>(fa: HK<F, A>, f: function): Equiv<B>
  • fa.coflatMap(f).extract <-> f(fa)
    

    Type parameters

    • A

    • B

    Parameters

    • fa: HK<F, A>
    • f: function
        • (a: HK<F, A>): B
        • Parameters

          • a: HK<F, A>

          Returns B

    Returns Equiv<B>

extractCoflattenIdentity

  • extractCoflattenIdentity<A>(fa: HK<F, A>): Equiv<HK<F, A>>
  • fa.coflatten.extract <-> fa
    

    Type parameters

    • A

    Parameters

    • fa: HK<F, A>

    Returns Equiv<HK<F, A>>

mapCoflatMapCoherence

  • mapCoflatMapCoherence<A, B>(fa: HK<F, A>, f: function): Equiv<HK<F, B>>
  • fa.map(f) <-> fa.coflatMap(fa0 => f(fa0.extract))
    

    Type parameters

    • A

    • B

    Parameters

    • fa: HK<F, A>
    • f: function
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    Returns Equiv<HK<F, B>>

mapCoflattenIdentity

  • mapCoflattenIdentity<A>(fa: HK<F, A>): Equiv<HK<F, A>>
  • fa.coflatten.map(_.extract) <-> fa
    

    Type parameters

    • A

    Parameters

    • fa: HK<F, A>

    Returns Equiv<HK<F, A>>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc