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
Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37). | |
Type in expressions to have them evaluated. | |
Type :help for more information. | |
scala> import scalaz._, Scalaz._, stream._ | |
import scalaz._ | |
import Scalaz._ | |
import stream._ | |
scala> val chan = io.fileChunkR("build.sbt").mapOut { s => new String(s) } |
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 scalaz._, Scalaz._ | |
trait Root { | |
type FT[A[+_], +B] | |
val FT: MonadTrans[FT] | |
def value: FT[Id, Unit] | |
} | |
trait Child extends Root { child => | |
// error: an't existentially abstract over parameterized type A |
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 scalaz.{ Free, Functor, Monad, Scalaz, \/, syntax } | |
import Free._ | |
import Scalaz.Id | |
import syntax.id._ | |
import syntax.monad._ | |
package times { | |
case class Times[+A](times: Vector[(Long, String)], a: A) | |
object Times { |
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
package koto | |
import scalaz.{Comonad, Equal, Free, Functor, Scalaz } | |
import scalaz.syntax.equal._ | |
import scalaz.syntax.monad._ | |
object box extends Interpreted { | |
trait Box[+A] extends HasFree[A] { | |
def get: A = free.go { _.a } | |
} |
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 scalaz.Monad | |
import scalaz.syntax.monad._ | |
/** | |
* Non stack-using Foldable substitute | |
*/ | |
trait Folder[F[_], A] { | |
def foldLefterM[G[_], B](z: B)(f: (B, A) => G[B])(implicit M: Monad[G]): G[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
package com.atlassian.variance.test; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.Matchers.notNullValue; | |
import org.junit.Test; | |
import com.google.common.base.Function; | |
final class Optional<A> { | |
private final A a; |
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 scalaz._ | |
import Scalaz._ | |
import java.lang.{Long => JLong} | |
object ParameterizedTags { | |
trait Nanoseconds[A] | |
type SampleDuration[A] = JLong @@ Nanoseconds[A] | |
case class Bar(a: BarDuration) |
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
object Tuples { | |
type AsMap[A] = A => Map[String, String] | |
case class Dooby(a: String) | |
case class Foo(b: String) | |
implicit val DoobyMapper = | |
(ev: Dooby) => Map("a" -> ev.a) |
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
trait Higher[F[_]] | |
trait Box[A] | |
object Box { | |
implicit def HigherBox = new Higher[Box] {} | |
} | |
object Foo { | |
val box = implicitly[Higher[Box]] // compiles fine !!! |
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
package com.fayi.ftp | |
object CSVParser { | |
val ADDRESS = "ftp://mirrors.kernel.org/gnu/README.DESCRIPTIONS" | |
val ADDRESS2 = "ftp://ftp.gnu.org/README" | |
def main(args: Array[String]) { | |
def parse(s: Stream[String]) = { | |
val cells = (_: String).split(",") |