Skip to content

Instantly share code, notes, and snippets.

@suls
Created December 13, 2015 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suls/aa4c4a531c8f7b31e92d to your computer and use it in GitHub Desktop.
Save suls/aa4c4a531c8f7b31e92d to your computer and use it in GitHub Desktop.
scala> fooR
res15: scalaz.\/[String,Int] = \/-(1)
scala> def addOne[M[_]: Applicative](in: M[Int]) = in.map(_+1)
warning: there was one feature warning; re-run with -feature for details
addOne: [M[_]](in: M[Int])(implicit evidence$1: scalaz.Applicative[M])M[Int]
scala> addOne(fooR)
<console>:19: error: no type parameters for method addOne: (in: M[Int])(implicit evidence$1: scalaz.Applicative[M])M[Int] exist so that it can be applied to arguments (scalaz.\/[String,Int])
--- because ---
argument expression's type is not compatible with formal parameter type;
found : scalaz.\/[String,Int]
required: ?M[Int]
addOne(fooR)
^
<console>:19: error: type mismatch;
found : scalaz.\/[String,Int]
required: M[Int]
addOne(fooR)
^
<console>:19: error: could not find implicit value for evidence parameter of type scalaz.Applicative[M]
addOne(fooR)
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment