Skip to content

Instantly share code, notes, and snippets.

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
#include <string>
#include <utility>
#include <cstdio>
#include <iostream>
#include <tr1/memory>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@lyricallogical
lyricallogical / FizzBuzz.hs
Created October 10, 2011 15:04 — forked from konn/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
@lyricallogical
lyricallogical / imihu
Created January 17, 2012 14:03
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
@lyricallogical
lyricallogical / gist:1710853
Created January 31, 2012 14:44
virtpatmat
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
@lyricallogical
lyricallogical / gist:1710868
Created January 31, 2012 14:48
virtpatmat diff
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 February 1, 2012 05:05
virtpatmat diff for type error
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
@lyricallogical
lyricallogical / rpscala67
Created February 1, 2012 05:21
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:
@lyricallogical
lyricallogical / rpscala69
Created February 15, 2012 10:23
rpscala69
!SLIDE
sclaz7 の scalaz.Iteratee の紹介
================================
!SLIDE
発端
----
> @halcat0x15a: @lyrical_logical 7のiterateeが別物になってて読めないです・・・・ 11:38 PM - 14 Feb 12
parseOpt(request.body) map { json =>
(json \\ "events" \\ "message").values
} collect { case msg : Map[String, String] =>
hoge
} getOrElse {
huga
}