Skip to content

Instantly share code, notes, and snippets.

@non
Last active Aug 29, 2015
Embed
What would you like to do?
Attempt to use kind-projector to support @mandubian's use case as presented here: https://gist.github.com/mandubian/55f8b1fb9f9bec2c0a99
package xyz
import language.higherKinds
import scalaz._
import Scalaz._
import scala.concurrent.Future
// see https://github.com/non/kind-projector for more info about what is going on here
object Test {
// consumes a type *
def type0[U]: Int = 0
// consumes a type * -> *
def type1[U[_]]: Int = 1
// OptionT part
type1[({ type L[B] = OptionT[Future, B] })#L]
type1[OptionT[Future, ?]]
// ListT part
type1[({ type M[A] = ListT[({ type L[+B] = OptionT[Future, B] })#L, A] })#M]
type1[({ type M[A] = ListT[Lambda[+[B] => OptionT[Future, B]], A] })#M]
type1[({ type M[A] = ListT[OptionT[Future, +?], A] })#M]
type1[Lambda[A => ListT[OptionT[Future, +?], A]]]
type1[ListT[OptionT[Future, +?], ?]]
// MonadPlus part
type0[MonadPlus[ListT[OptionT[Future, +?], ?]]]
}
@non

This comment has been minimized.

Copy link
Owner Author

@non non commented Jun 6, 2014

I think this is the first "in-the-wild" use of the covariance/contravariance support I added awhile ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment