Created
July 7, 2011 09:18
-
-
Save folone/1069162 to your computer and use it in GitHub Desktop.
Rank 2 polymorphism in Scala, from http://apocalisp.wordpress.com/2010/07/02/higher-rank-polymorphism-in-scala/
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
trait ~>[F[_],G[_]] { | |
def apply[A](a: F[A]): G[A] | |
} | |
type Id[A] = A | |
def apply[B](f: Id ~> List, b: B, s: String): (List[B], List[String]) = (f(b), f(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment