Example with `default` doesn't compile for me
I was trying to make a small change to the default example, and wanted to test that my change didn't break anything. The compilation error I see looks like it's an issue between Mercator and Either, my guess is because Either has two type parameters (for Left and Right) and Monad only has one (equivalent to Right), but I don't know enough to submit a PR to fix. Please let me know if there's any more information I can provide!
sbt:root> test
[info] Compiling 9 Scala sources to /home/anned/github/magnolia/examples/native/target/scala-2.11/classes ...
[error] /home/anned/github/magnolia/examples/shared/src/main/scala/default.scala:31:23: no type parameters for method constructMonadic: (makeParam: magnolia.Param[magnolia.examples.Default,T] => Monad[PType])(implicit monadic: mercator.Monadic[Monad])Monad[T] exist so that it can be applied to arguments (magnolia.Param[magnolia.examples.Default,T] => scala.util.Either[String,magnolia.Param[magnolia.examples.Default,T]#PType])
[error] --- because ---
[error] argument expression's type is not compatible with formal parameter type;
[error] found : magnolia.Param[magnolia.examples.Default,T] => scala.util.Either[String,magnolia.Param[magnolia.examples.Default,T]#PType]
[error] required: magnolia.Param[magnolia.examples.Default,T] => ?Monad[?PType]
[error] def default = ctx.constructMonadic { param =>
[error] ^
[error] /home/anned/github/magnolia/examples/shared/src/main/scala/default.scala:31:48: type mismatch;
[error] found : magnolia.Param[magnolia.examples.Default,T] => scala.util.Either[String,magnolia.Param[magnolia.examples.Default,T]#PType]
[error] required: magnolia.Param[magnolia.examples.Default,T] => Monad[PType]
[error] def default = ctx.constructMonadic { param =>
[error] ^
[error] /home/anned/github/magnolia/examples/shared/src/main/scala/default.scala:31:40: could not find implicit value for parameter monadic: mercator.Monadic[Monad]
[error] def default = ctx.constructMonadic { param =>
[error] ^
[error] three errors found
Without investigating, given that this error is occurring without your changes, I think the reason is that I didn't yet find time to publish a more recent version of Mercator that Magnolia needs. I've got a few higher priorities to sort to sort out first, but I'll get round to this later this week, I hope.
when you're fixing that, I think you'll want to modify your .travis.yml to compile the examplesJVM project (at least), which doesn't currently compile (because of 884eb078cbca57644e37acf8284d77cb269521a5, I think) — this turned up in the Scala community build
#149 should fix the compilation issue in examplesJVM
I had this issue, adding the types to constructMonadic solved it.
import mercator.Monadic
type Result[A] = Either[Throwable, A]
ctx.constructMonadic[Result, Any] { p =>
//...
}
Maybe the PType should not be exposed?