Created
October 17, 2011 21:53
-
-
Save travisbrown/1293947 to your computer and use it in GitHub Desktop.
path-dependent-type-monad
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
object test { | |
trait M[X[_]] { | |
def map[A, B](a: X[A])(f: A => B): X[B] | |
} | |
trait Parsers { | |
trait Parser[Y] { | |
def map[B](f: Y => B): Parser[B] = null | |
} | |
} | |
def parserM[G <: Parsers with Singleton ]: M[({ type L[T] = G#Parser[T] })#L] = | |
new M[({ type L[T] = G#Parser[T] })#L] { | |
def map[A, B](a: G#Parser[A])(f: A => B): G#Parser[B] = a.map(f) | |
} | |
object a extends Parsers { | |
val x = parserM[a.type] | |
x: M[a.Parser] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment