The EqK2 typeclass abstracts the ability to lift the Eq class to binary type constructors.

Main Combinators

Kind2<F, A, B>.eqK(other: Kind2<F, A, B>, EQA: Eq, EQB: Eq): Boolean

Compares two instances of a type F with a binary type constructor using the provided Eq<A> and Eq<B>. Returns true if they’re considered equal.

import arrow.core.extensions.*
import arrow.core.extensions.either.eqK2.eqK2
import arrow.core.*

// lift String Eq to Either
Either.eqK2().run {
    Either.right("hello").eqK(Either.right("arrow"), String.eq(), String.eq())
// false


Arrow provides EqK2Laws in the form of test cases for internal verification of lawful instances and third party apps creating their own EqK2 instances. See the existing EqK2 instances implementations and accompanying tests for reference.

See Deriving and creating custom typeclass to provide your own EqK2 instances for custom datatypes.

Data types

Module Data types
arrow.core Either, Ior, Validated

Type Class Hierarchy

Do you like Arrow?

Arrow Org