Last active
August 29, 2015 14:02
-
-
Save non/800d395284c5f3f5d3c7 to your computer and use it in GitHub Desktop.
Attempt to use kind-projector to support @mandubian's use case as presented here: https://gist.github.com/mandubian/55f8b1fb9f9bec2c0a99
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, +?], ?]]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is the first "in-the-wild" use of the covariance/contravariance support I added awhile ago.