Skip to content

Instantly share code, notes, and snippets.

View moduuuuuuuleeeeeeeeeeeeee
module A
export type Base
export val global.f : Base -> Base -> Ret # vtbl 作りたいけど、作れない
module B
export type X can cast from Base
export val global.f : X -> Base -> Ret
module C
export type Y can cast from Base
View gist:843534
#include <string>
#include <utility>
#include <cstdio>
#include <iostream>
#include <tr1/memory>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@lyricallogical
lyricallogical / FizzBuzz.hs
Created Oct 10, 2011 — forked from konn/FizzBuzz.hs
コンパイル通るか知りません こんな感じのほうが人間に優しいのでは…!
View FizzBuzz.hs
fizzbuzz = zipWith max (map show [0..]) fb
where
fb = zipWith (++) f b
f = cycle ["Fizz", "", ""]
b = cycle ["Buzz", "", "", "", ""]
main = mapM_ putStrLn $ tail $ fizzBuzz
View imihu
$ scala
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.
scala> trait A[T] { def t : T }
defined trait A
scala> trait B extends A[Int]
defined trait B
View gist:1710853
m:.../quick/bin % cat vpm.scala
object vpm {
Option(0) match {
case Some(0) => 1
case None => 2
}
}
m:.../quick/bin % ./scalac -Xprint:typer vpm.scala
[[syntax trees at end of typer]]// Scala source: vpm.scala
View gist:1710868
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.sc
ala
index 4457940..bb9f538 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
@@ -648,7 +648,7 @@ defined class Foo */
trait TreeMakers {
def inMatchMonad(tp: Type): Type = appliedType(matchingMonadType, List(tp))
- lazy val optimizingCodeGen = matchingMonadType.typeSymbol eq OptionClass
@lyricallogical
lyricallogical / gist:1715208
Created Feb 1, 2012
virtpatmat diff for type error
View gist:1715208
diff --git a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.sc
ala
index 4457940..8642727 100644
--- a/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/PatMatVirtualiser.scala
@@ -648,7 +648,7 @@ defined class Foo */
trait TreeMakers {
def inMatchMonad(tp: Type): Type = appliedType(matchingMonadType, List(tp))
- lazy val optimizingCodeGen = matchingMonadType.typeSymbol eq OptionClass
View rpscala67
!SLIDE
# virtualized pattern matcher の紹介
!SLIDE
注意:大きな仕様変更があったので、このスライドの内容は古くなってしまいました
!SLIDE
## [Scala 2.10.0 Milestone 1 is released!](http://www.scala-lang.org/node/12250)
Included in this release are:
View rpscala69
!SLIDE
sclaz7 の scalaz.Iteratee の紹介
================================
!SLIDE
発端
----
> @halcat0x15a: @lyrical_logical 7のiterateeが別物になってて読めないです・・・・ 11:38 PM - 14 Feb 12
View gist:1877224
parseOpt(request.body) map { json =>
(json \\ "events" \\ "message").values
} collect { case msg : Map[String, String] =>
hoge
} getOrElse {
huga
}