Skip to content

Instantly share code, notes, and snippets.

Introduction to scalaz-stream

Every application ever written can be viewed as some sort of transformation on data. Data can come from different sources, such as a network or a file or user input or the Large Hadron Collider. It can come from many sources all at once to be merged and aggregated in interesting ways, and it can be produced into many different output sinks, such as a network or files or graphical user interfaces. You might produce your output all at once, as a big data dump at the end of the world (right before your program shuts down), or you might produce it more incrementally. Every application fits into this model.

The scalaz-stream project is an attempt to make it easy to construct, test and scale programs that fit within this model (which is to say, everything). It does this by providing an abstraction around a "stream" of data, which is really just this notion of some number of data being sequentially pulled out of some unspecified data source. On top of this abstraction, sca

[2014-09-06 08:09:28 JST] (INFO) start
[2014-09-06 08:09:39 JST] (INFO) irc|taisukeoe|hello
[2014-09-06 08:09:38 JST] (INFO) twitter|niw|Okay, my presentation is not ready (ouch!) yet heading to Shibuya soon. #ScalaMatsuri
[2014-09-06 08:09:38 JST] (INFO) twitter|makoto78sasaki|#ScalaMatsuri へ出発
[2014-09-06 08:09:39 JST] (INFO) twitter|s_kozake|さて、向かうで!
#ScalaMatsuri
[2014-09-06 08:09:41 JST] (INFO) twitter|cbirchall|寝坊!今日に限って目覚ましが鳴らないとは。今向かっています #ScalaMatsuri
[2014-09-06 09:09:41 JST] (INFO) twitter|sm0kym0nkey|到着 #ScalaMatsuri
[2014-09-06 09:09:41 JST] (INFO) twitter|jagd5168|なんとか目を覚まし 9:45 到着予定 #ScalaMatsuri
[2014-09-06 09:09:41 JST] (INFO) twitter|iyunoriue|#ScalaMatsuri 今日ボランティアやってますv(*・∀・*)ピース
@xuwei-k
xuwei-k / test.md
Last active August 29, 2015 14:08 — forked from halcat0x15a/test.md

!SLIDE

テスト

(require '[test])

(defn f [a]
  a)
<RaceCondition> can I use Scalaz to get exhaustion checks when matching on numeric values? Scala obviously doesn't do that
<RaceCondition> ! 1.1 match { case x if 0.0 <= x && x < 0.5 => "bad"; case x if 0.5 <= x && x <= 1.0 => "good" }
<dibblego> doubt it
<multibot_> scala.MatchError: 1.1 (of class java.lang.Double)
<multibot_> ... 38 elided
<dibblego> use types though?
<RaceCondition> wdym?
<dibblego> use a type to note each range
<dibblego> you want a floating-point between 0.0 and 1.0?
<RaceCondition> wouldn't that just move the problem to a different stage?
/**
The Play (2.3) json combinator library is arguably the best in the scala world. However it doesnt
work with case classes with greater than 22 fields.
The following gist leverages the shapeless 'Automatic Typeclass Derivation' facility to work around this
limitation. Simply stick it in a common location in your code base, and use like so:
Note: ** Requires Play 2.3 and shapeless 2.0.0

As compiled by Kevin Wright a.k.a @thecoda

(executive producer of the movie, and I didn't even know it... clever huh?)

please, please, please - If you know of any slides/code/whatever not on here, then ping me on twitter or comment this Gist!

This gist will be updated as and when I find new information. So it's probably best not to fork it, or you'll miss the updates!

Monday June 16th

@xuwei-k
xuwei-k / build.sbt
Last active October 26, 2016 05:39 — forked from runarorama/gist:a8fab38e473fafa0921d
Coproduct Example
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
"org.scalaz" %% "scalaz-core" % "7.1.0-M7"
)
scalacOptions ++= Seq("-deprecation", "-language:_")
case class B()
trait A {
implicit val b = B()
}
object App extends A {
def main(args: Array[String]): Unit = {
printImplicit
}
import scalaz._
import \/._
import Free._
import scalaz.syntax.monad._
object Experiment {
sealed trait OI[A] {
def map[B](f: A => B): OI[B]
}
case class Async[A](k: (A => Trampoline[Unit]) => Unit) extends OI[A] {
@xuwei-k
xuwei-k / ints.scala
Created January 15, 2014 18:50 — forked from non/ints.scala
package quantity
// like Nat, but for integers
trait Z
// Pos means positive-or-zero, and Neg means negative-or-zero
trait Pos extends Z { type P <: Pos }
trait Neg extends Z { type N <: Neg }
class Zero extends Pos with Neg { type N = Zero }