Skip to content

Instantly share code, notes, and snippets.

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
@ib84
ib84 / HyperGraphDBScalaHacks.scala
Created July 24, 2012 08:12
Implicit conversions of HGHandle for improved usability of HyperGraphDB
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]