prat
02/17/2018, 1:39 PM@instance(Either::class)
interface EitherHashInstance<L, R> : EitherEqInstance<L, R>, Hash<Either<L, R>> {
override fun EQL(): Eq<L>
override fun EQR(): Eq<R>
fun HSL(): Hash<L>
fun HSR(): Hash<R>
override fun hash(a: Either<L, R>): Int = when (a) {
is Either.Left -> HSL().hash(a.a).hashCode()
is Either.Right -> HSR().hash(a.b).hashCode()
}
}
when running the testLaws againts Either<String, Int>>()
, HSR()
returns StringHashInstance
but I expected IntHashInstance
. any thought of where i might mess things up