EqK

beginner

The EqK typeclass abstracts the ability to lift the Eq class to unary type constructors.

Main Combinators

Kind<F, A>.eqK(other: Kind<F, A>, EQ: Eq): Boolean

Compares two instances of A in the context of F using the provided Eq<A>. Returns true if they’re considered equal.


import arrow.core.extensions.*
import arrow.core.extensions.option.eqK.eqK
import arrow.core.*

// lift String Eq to Option
Option.eqK().run {
    Option.just("hello").eqK(Option.just("arrow"), String.eq())
}
// false

Laws

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

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

Data types

Module Data types
arrow.core Either, Id, Ior, ListK, MapK, NonEmptyList, Option, SequenceK, SetK, SortedMapK

Type Class Hierarchy