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.concurrent.Task | |
import scalaz.stream._ | |
import scalaz.stream.Process._ | |
import scalaz.stream.Process.Emit | |
import scalaz.stream.Tee | |
object MatchTee { | |
def matchTee[I: Ordering]: Tee[I, I, (Option[I], Option[I])] = { | |
val ord = implicitly[Ordering[I]] |
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 scala.annotation.tailrec | |
object MyIo2 { | |
sealed trait IO[+A] { | |
def flatMap[B](f: A => IO[B]): IO[B] = this match { | |
case FlatMap(x, g) => FlatMap(x, (a: Any) => g(a).flatMap(f)) | |
case x => FlatMap(x, f) | |
} |
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 scala.util.control.Exception | |
import scalaz._ | |
import scalaz.Free.FreeC | |
import scalaz.Scalaz._ | |
object Kasten { | |
///////////////////////// | |
// The State stuff | |
///////////////////////// |
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 Type { | |
class |:|[A, B] | |
implicit def orTypeA[A, B](implicit a: A): |:|[A, B] = new |:|[A, B] | |
implicit def orTypeB[A, B](implicit b: B): |:|[A, B] = new |:|[A, B] | |
type \:/[T, U] = {type λ[X] = (X <:< T) |:| (X <:< U)} |
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
type M[_] is a monad | |
def f(as: List[A])(m: A => M[B](c0: C)(g: (C, B) => C)(implicit MM: Monad[M]): M[C] = { | |
def go(c: C, ras: List[A]): M[C] = ras match { | |
case Nil => MM.point(c) | |
case head :: tail => m(head).flatMap(b => go(g(c, b), tail)) | |
} | |
go(c0, as) |
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._ | |
object WE { | |
type EA[+A] = (String \/ A) | |
type WT[+A] = WriterT[EA, Seq[Any], A] | |
def replace(j: Int)(i: Int): (String \/ Int) = { | |
if (j > 9) -\/("Failed with " + j.toString) |
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 smt | |
import scalaz.concurrent.Future | |
import scalaz.Scalaz._ | |
import org.scalatest.FunSuite | |
import scalaz._ | |
class KleisliTest extends FunSuite { | |
lazy val s: List[Int] = List.fill(1000000)(1) |
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 smt.util | |
import scalaz.syntax.Ops | |
import scalaz._ | |
import Kleisli._ | |
object EitherTKleisli { | |
type EitherTKleisli[M[+ _], D, E, A] = EitherT[({type λ[+α] = Kleisli[M, D, α]})#λ, E, 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
package smt.util | |
import scalaz.{Monad, Bind, Kleisli} | |
import scalaz.syntax.Ops | |
import scalaz.Kleisli._ | |
import scalaz.Scalaz._ | |
trait KleisliCombineDep { | |
type Logger |
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
module Main | |
data ElemMV : (f : Fin (S n)) -> a -> Vect n a -> Type where | |
NotThereMV : ElemMV fZ x xs | |
HereMV : ElemMV f x xs -> ElemMV (fS f) x (x :: xs) | |
ThereMV : ElemMV f x xs -> ElemMV (weaken f) x (y :: xs) | |
elemMV : DecEq a => (x : a) -> (xs : Vect n a) -> (f ** (ElemMV f x xs)) | |
elemMV x [] = (fZ ** NotThereMV) | |
elemMV x (y :: xs) with (decEq x y) |
OlderNewer