Leibniz

object Leibniz extends LeibnizInstances
Companion
class
class Object
trait Matchable
class Any

Type members

Deprecated types

@deprecated("Use scalaz\'s package\'s type alias instead", "7.3.x")
type ===[A, B] = A === B

(A === B) is a supertype of Leibniz[L,H,A,B]

(A === B) is a supertype of Leibniz[L,H,A,B]

Deprecated

Value members

Concrete methods

def force[L, H >: L, A >: L <: H, B >: L <: H]: Leibniz[L, H, A, B]

Unsafe coercion between types. force abuses asInstanceOf to explicitly coerce types. It is unsafe, but needed where Leibnizian equality isn't sufficient

Unsafe coercion between types. force abuses asInstanceOf to explicitly coerce types. It is unsafe, but needed where Leibnizian equality isn't sufficient

def lift[LA, LT, HA >: LA, HT >: LT, T[_ >: LA <: HA], A >: LA <: HA, A2 >: LA <: HA](a: Leibniz[LA, HA, A, A2]): Leibniz[LT, HT, T[A], T[A2]]

We can lift equality into any type constructor

We can lift equality into any type constructor

def lift2[LA, LB, LT, HA >: LA, HB >: LB, HT >: LT, T[_ >: LA <: HA, _ >: LB <: HB], A >: LA <: HA, A2 >: LA <: HA, B >: LB <: HB, B2 >: LB <: HB](a: Leibniz[LA, HA, A, A2], b: Leibniz[LB, HB, B, B2]): Leibniz[LT, HT, T[A, B], T[A2, B2]]

We can lift equality into any type constructor

We can lift equality into any type constructor

def lift3[LA, LB, LC, LT, HA >: LA, HB >: LB, HC >: LC, HT >: LT, T[_ >: LA <: HA, _ >: LB <: HB, _ >: LC <: HC], A >: LA <: HA, A2 >: LA <: HA, B >: LB <: HB, B2 >: LB <: HB, C >: LC <: HC, C2 >: LC <: HC](a: Leibniz[LA, HA, A, A2], b: Leibniz[LB, HB, B, B2], c: Leibniz[LC, HC, C, C2]): Leibniz[LT, HT, T[A, B, C], T[A2, B2, C2]]

We can lift equality into any type constructor

We can lift equality into any type constructor

def lower[LA, HA >: LA, T[_ >: LA <: HA], A >: LA <: HA, A2 >: LA <: HA](t: T[A] === T[A2]): Leibniz[LA, HA, A, A2]

Emir Pasalic's PhD thesis mentions that it is unknown whether or not ((A,B) === (C,D)) => (A === C) is inhabited.

Emir Pasalic's PhD thesis mentions that it is unknown whether or not ((A,B) === (C,D)) => (A === C) is inhabited.

Haskell can work around this issue by abusing type families as noted in Leibniz equality can be injective (Oleg Kiselyov, Haskell Cafe Mailing List 2010) but we instead turn to force.

def lower2[LA, HA >: LA, LB, HB >: LB, T[_ >: LA <: HA, _ >: LB <: HB], A >: LA <: HA, A2 >: LA <: HA, B >: LB <: HB, B2 >: LB <: HB](t: T[A, B] === T[A2, B2]): (Leibniz[LA, HA, A, A2], Leibniz[LB, HB, B, B2])
def symm[L, H >: L, A >: L <: H, B >: L <: H](f: Leibniz[L, H, A, B]): Leibniz[L, H, B, A]

Equality is symmetric

Equality is symmetric

def trans[L, H >: L, A >: L <: H, B >: L <: H, C >: L <: H](f: Leibniz[L, H, B, C], g: Leibniz[L, H, A, B]): Leibniz[L, H, A, C]

Equality is transitive

Equality is transitive

Implicits

Implicits

implicit
def refl[A]: Leibniz[A, A, A, A]

Equality is reflexive -- we rely on subtyping to expand this type

Equality is reflexive -- we rely on subtyping to expand this type

implicit
def subst[A, B](a: A)(implicit f: A === B): B
implicit
def witness[A, B](f: A === B): A => B

We can witness equality by using it to convert between types We rely on subtyping to enable this to work for any Leibniz arrow

We can witness equality by using it to convert between types We rely on subtyping to enable this to work for any Leibniz arrow

Inherited implicits

implicit
Inherited from
LeibnizInstances