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 Test { | |
import scalaz._ | |
import scalaz.syntax.monad._ | |
case class M[A, R](r: R) | |
implicit def instance[A]: Monad[({type λ[α] = M[A, α]})#λ] = new Monad[({type λ[α] = M[A, α]})#λ] { | |
override def point[R](r: => R): M[A, R] = M(r) |
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 Test { | |
sealed trait Content | |
case class A() extends Content | |
case class B() extends Content | |
type L = A :: B :: HNil | |
object Append { |
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 Test { | |
class T { | |
def run(i: Int) = i | |
} | |
implicit class T2(t: T) { | |
def run: Int = t run 3 | |
} |
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
[error] | |
[error] while compiling: C:\System9\sourcesWintermute\wintermute\wintermute-app\src\main\scala\uz\wm\cases\ecg\EcgRepository.scala | |
[error] during phase: erasure | |
[error] library version: version 2.10.4 | |
[error] compiler version: version 2.10.4 | |
[error] reconstructed args: -bootclasspath C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\resources.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\rt.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\jce.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\charsets.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\lib\jfr.jar;C:\Program Files (x86)\Java\jdk1.7.0_65\jre\classes;C:\system9\sbt_ivy\ivy\ivy-cache\org.scala-lang\scala-library\jars\scala-library-2.10.4.jar -deprecation -feature -classpath C:\System9\sourcesWintermute\wintermute\wintermute-app\target\scala-2.10\classes;C:\System9\sourcesWintermute\wintermute |
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 Test { | |
import scala.language.higherKinds | |
import scalaz._ | |
import scalaz.std.list._ | |
private val monadStack = RWS.rwstMonad[Id.Id, Unit, List[String], Int] | |
import monadStack._ |
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
class Test { | |
case class PatientInfo(isVrouw: Boolean, leeftijd: Int) | |
case class Kalium(waarde: Double) | |
class QtVerlengd { | |
import scalaz._ | |
import scalaz.std.list._ |
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 ListFuture { | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scalaz._ | |
import scalaz.contrib.std.scalaFuture._ | |
import std.option._, std.list._ |
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 Chap5 { | |
import Stream._ | |
sealed trait Stream[+A] { | |
def fold [R] (nil: => R) (cons: (=> A, => R) => R): R | |
def isEmpty: Boolean = | |
fold (true) ((_,_) => false) |
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 map [B] (f: A => B): Stream[B] = { | |
val outer = this | |
new Stream[B] { | |
override def uncons = outer.uncons match { | |
case Some ((hd, tl)) => Some ((f(hd), tl map_ f)) | |
case None => None | |
} | |
} | |
} |
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 Data.Traversable (sequenceA) | |
filterAll :: [a -> Bool] -> [a] -> [a] | |
filterAll = filter . fmap and . sequenceA | |
--filterAll [(>4), (<8)] [1..10] | |
--[5,6,7] | |
--filterAll [] [1..10] | |
--[1,2,3,4,5,6,7,8,9,10] |
NewerOlder