// @flow import { HKT } from './HKT' import { unsafeCoerce } from './Unsafe' import { of, extract, id } from './Identity' export type Leibnitz = { (a: HKT): HKT }; export function simm(proof: Leibnitz): Leibnitz { return unsafeCoerce(proof) } export function coerce(proof: Leibnitz): (a: A) => B { return a => extract(proof(of(a))) } export function coerceSymm(proof: Leibnitz): (b: B) => A { return coerce(simm(proof)) } export function refl(): Leibnitz { return unsafeCoerce(id) } export function subst(proof: Leibnitz, fa: HKT): HKT { return proof(fa) }