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
import Pattern._ | |
import Family._ | |
def pattern[B](pf: PartialFunction[Name,B]) = new Extractor(pf.lift) | |
val Parents = new Extractor(parents.get) | |
val Children = new Extractor(children.get) | |
"Julie" match { | |
case Parents(p) => "Julies parents are: " + p |
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 HGHandleHacks { | |
implicit def richHandle(handle: HGHandle)(implicit graph: HyperGraph) = new { | |
// DEREFERENCING | |
// dereference and type cast - may throw ClassCastException | |
def d[T](implicit graph: HyperGraph): T = | |
graph.get(handle).asInstanceOf[T] | |