Open lemastero opened 4 years ago
I actually tried that, but I found the Lawful/Laws/... from ZIO Test insufficient :disappointed: We would need in ZIO Test something like this
package object laws {
object LawfulF {
type Divariant[-CapsF[_[-_, +_]], -Caps[_]] = ZLawfulF.Divariant[CapsF, Caps, Any]
}
object LawsF {
type Divariant[-CapsF[_[-_, +_]], -Caps[_]] = ZLawsF.Divariant[CapsF, Caps, Any]
Given that, then we would need to write Derive2
and Derive2Equal
and coherent.DivariantDerive2Equal
but that should already be simple enough.
ticket in ZIO to implement this: https://github.com/zio/zio/issues/4211
Yes, the downside of the laws framework is that you need a different instance for each kind since we don't really have a way to abstract over kindedness in Scala 2, but that is definitely something we can add!
I am able to add laws using predicates like in
IdentityCompose
and instances, as I have done a decent amount of work around profunctors (Divariant).
But to handle laws using Lawful/Laws/.... I would need some hints on how to approach this.