I wanted to create an optimised, universally quantified, instance (which can be cached across the E parameter)
implicit def mercatorDisjunction[E]: mercator.Monadic[E \/ ?] = new mercator.Monadic[E \/ ?] {
def point[A](a: A): E \/ A = \/-(a)
def flatMap[A, B](fa: E \/ A, f: A => E \/ B): E \/ B = fa.flatMap(f)
def map[A, B](fa: E \/ A, f: A => B): E \/ B = fa.map(f)
}
but using this I get
[error] /home/fommil/Projects/scalaz-deriving/examples/jsonformat/src/main/scala/jsonformat/JsMagnolia.scala:140:32: ambiguous implicit values:
[error] both method mercatorDisjunction in object JsMagnoliaDecoder of type [E]=> mercator.Monadic[[β$0$]scalaz.\/[E,β$0$]]
[error] and macro method monadicEvidence in package mercator of type [F[_]]=> mercator.Monadic[F]
[error] match expected type mercator.Monadic[[+B]scalaz.\/[String,B]]
[error] ctx.constructMonadic { p =>
[error] ^
I wanted to create an optimised, universally quantified, instance (which can be cached across the
E
parameter)but using this I get