This file contains hidden or 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
18:15 ~/Projects/6240 (ticket/6240)$ ant test.osgi | |
Buildfile: /Users/xeno_by/Projects/6240/build.xml | |
desired.jars.uptodate: | |
boot: | |
init: | |
[artifact:dependencies] [WARNING] POM for 'biz.aQute:bndlib:pom:1.43.0:compile' is invalid. | |
[artifact:dependencies] |
This file contains hidden or 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
~/210x $ scala -Xshow-phases | |
phase name id description | |
---------- -- ----------- | |
parser 1 parse source into ASTs, perform simple desugaring | |
macroparadise 2 let our powers combine | |
namer 3 resolve names, attach symbols to named trees in paradise | |
packageobjects 4 load package objects in paradise | |
typer 5 the meat and potatoes: type the trees in paradise | |
... |
This file contains hidden or 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
// TreeCreator is conceptually a dependent function that: | |
// 1) Takes a universe-bound mirror | |
// 2) Produces a tree from the same universe | |
// So I would like to write it as follows (imaginary syntax) | |
// e.g. as per this proposal: http://blaisorbladeprog.blogspot.de/2013/01/flexible-implicits-from-agda-for-scala.html | |
abstract class TreeCreator { | |
def apply[[u: Universe]](m: u.Mirror): u.Tree | |
} |
This file contains hidden or 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
scala> class Foo[B[_], T] | |
defined class Foo | |
scala> def test[B[_]](implicit tt: TypeTag[B[_]]) = typeOf[Foo[B, _]] | |
<console>:30: error: No TypeTag available for Foo[B, _] | |
def test[B[_]](implicit tt: TypeTag[B[_]]) = typeOf[Foo[B, _]] | |
^ |
This file contains hidden or 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
sealed abstract class Character | |
case object Violent extends Character | |
case object Weak extends Character | |
case object Clever extends Character | |
case object Dumb extends Character | |
case object Stupid extends Character | |
case class Person ( | |
id: DId, | |
name: String |
This file contains hidden or 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 scala.annotation.StaticAnnotation | |
import scala.reflect.macros.Macro | |
import language.experimental.macros | |
class body(tree: Any) extends StaticAnnotation | |
trait Macros extends Macro { | |
import c.universe._ | |
def selFieldImpl = { |
This file contains hidden or 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 scala.reflect.macros.Context | |
import language.experimental.macros | |
object Macros { | |
def impl1(c: Context) = { | |
import c.universe._ | |
q"new { def x = macro Macros.impl2 }" | |
} | |
def foo = macro impl1 |
This file contains hidden or 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
def RefTree(qual: Tree, sym: Symbol) = self.RefTree(qual, sym.name) setSymbol sym |
This file contains hidden or 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
val protocol: Consumer[ByteBuffer, Message] = | |
for { | |
hdr <- msgHdr | |
(body, sha) <- bodyProcessor(hdr) zip sha1sum | |
if sha == hdr.sha | |
} yield Message(hdr,body) |
This file contains hidden or 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
withFile(file) { c => | |
val bytes: Producer[ImmutableBuffer[Byte,Read]] = | |
bytechannels.read_channel_bytes(c, directBuffers=true) | |
val chars = Producer[ImmutableBuffer[Char,Read]] = | |
bytes convert charsets.decoder() | |
val wordCount: Consumer[ImmutableBuffer[Char, Read], Long] = | |
charchannels.words convert utils.counter | |
val lineCount: Consumer[ImmutableBuffer[Char, Read], Long] = | |
charchannels.lines convert utils.counter | |
val allCount: Consumer[ImmutableBuffer[Char,Read], String] = |