Instantly share code, notes, and snippets.

View MoneyTransfer.scala
case class Account(var amount: Int)
import MoneyTransfer._
class MoneyTransfer private (src: Account with SourceRole,
dst: Account with DestinationRole,
amount: Int) {
def transfer(): Unit = {
src transfer amount
View macro.scala
/** Akshaal, 2012. */
import language.experimental.macros
import scala.reflect.macros.Context
import scala.annotation.Annotation
* Macros for traversing over annotated elements.
* See for more information.
View scala_existential_map.scala
// ---------------------------------------------------------------------------------------------
// Here is the definition of TypedKeyMap
import scala.language.implicitConversions
import scala.language.higherKinds
import scala.language.existentials
import scala.collection.immutable.{ MapLike, HashMap }
trait TypedKey {
type Value