Created
February 5, 2014 12:21
-
-
Save possiblywrong/8822528 to your computer and use it in GitHub Desktop.
Rough sketch
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 TestCase { | |
trait MYtype[A] | |
case class Bob(i: Int) extends MYType[Int] | |
case class Wibble[A,B](t1: MYType[A], t2: MYType[B]) extends MYType[A\/B] | |
// MYType => ( List[(A,B)] => List[B] ) | |
// So we define myfun for each member of the MYType ADT | |
object myfun extends Poly1 { | |
implicit def caseOne = at[Bob]( i => { ... somefn } ) | |
implicit def caseTwo[A,B] = at[Wibble[A,B]]( i => { { xs => myfun(as) ++ myfun(bs) } } ) | |
} | |
object somefn extends Poly1 { | |
implicit def caseOne[A] = at[List[(Int,A)]]( ... ) | |
} | |
val t1 = myfun(Bob(42)) | |
val t2 = myfun(Wibble(Bob(5),Bob(101))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm still not getting it ... too many '...'s in critical places. What here are you either trying to close over? Or, alternatively, what is the binary function that you'd like to partially apply?