hi folks, I'm working on an `Either` instance for ...
# arrow
p
hi folks, I'm working on an
Either
instance for
Hash
. it's type checked at the compile time but i got
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
when I test laws. any pointer? how can i debug this?
the instance looks pretty straightforward
Copy code
@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()
    }
}