Suppose we want to lift an OptionT[List, Int]
into a ReaderT[OptionT[List, _], String, Int]
. The nice way (liftReaderT
) currently doesn't work:
scala> List(1, 2, 3).liftM[OptionT].liftReaderT[String]
<console>:14: error: could not find implicit value for parameter F0: scalaz.UnapplyCo[scalaz.Monad,scalaz.OptionT[List,Int]]
List(1, 2, 3).liftM[OptionT].liftReaderT[String]
^
<console>:14: error: value liftReaderT is not a member of scalaz.OptionT[List,Int]
List(1, 2, 3).liftM[OptionT].liftReaderT[String]
^
Adding this UnapplyCo
instance makes everything okay:
implicit def unapplyMFA1[TC[_[_]], F[+_], M0[F[+_], +_], A0](
implicit TC0: TC[({ type L[x] = M0[F, x] })#L]
): UnapplyCo[TC, M0[F, A0]] {
type M[+X] = M0[F, X]
type A = A0
} = new UnapplyCo[TC, M0[F, A0]] {
type M[+X] = M0[F, X]
type A = A0
def TC = TC0
def leibniz = Leibniz.refl
}
I don't see any problem here. Is there a reason this isn't included, when apparently more complex instances (like the one provided by unapplyMFAB1
) are?