Skip to content

Instantly share code, notes, and snippets.

@pelotom
Created April 27, 2013 08:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pelotom/5472335 to your computer and use it in GitHub Desktop.
Save pelotom/5472335 to your computer and use it in GitHub Desktop.
// Here's the problem I was having:
scala> val unapply = implicitly[Unapply[Applicative, List[Int]]]
unapply: scalaz.Unapply[scalaz.Applicative,List[Int]] = scalaz.Unapply$$anon$14@5a977cac
scala> implicitly[Unapply[Applicative, unapply.M[unapply.A]]]
<console>:15: error: Unable to unapply type `unapply.M[unapply.A]` into a type constructor of kind `M[_]` that is classified by the type class `scalaz.Applicative`
1) Check that the type class is defined by compiling `implicitly[scalaz.Applicative[<type constructor>]]`.
2) Review the implicits in object Unapply, which only cover common type 'shapes'
(implicit not found: scalaz.Unapply[scalaz.Applicative, unapply.M[unapply.A]])
implicitly[Unapply[Applicative, unapply.M[unapply.A]]]
^
// Here's how I solved it:
scala> implicit val evidence: Applicative[unapply.M] = unapply.TC
evidence: scalaz.Applicative[unapply.M] = scalaz.std.ListInstances$$anon$1@23dc9fb9
scala> implicitly[Unapply[Applicative, unapply.M[unapply.A]]]
res1: scalaz.Unapply[scalaz.Applicative,unapply.M[unapply.A]] = scalaz.Unapply$$anon$14@d6e32d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment