|
Scala example source code file (channels.scala)
The Scala channels.scala source code
class Channel[a]
import collection.mutable.Set
case class 
/*
object Bang {
def unapply[a](x: ![a]): Option[{Channel[a], a}] =
Some(x.chan, x.data)
}
*/
object Test extends App {
object IC extends Channel[Int]
def f[b](x: ![b]): Int = x match {
case send: ![c] =>
send.chan match {
case IC => send.data
}
}
}
object Test2 extends App {
object IC extends Channel[Set[Int]]
def f[b](s: ![b]): Set[Int] = s match {
case IC ! x => x
}
}
Other Scala examples (source code examples)Here is a short list of links related to this Scala channels.scala source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.