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 java.sql.{Connection, PreparedStatement} | |
object SqlInterpolation { | |
case class StatementPreparation(string: String, effect: PreparedStatement => Unit) { | |
override def toString: String = s"""StatementPreparation("$string", $effect)""" | |
} | |
implicit class ConnectionOps(val connection: Connection) extends AnyVal { | |
def prepareStatement(sp: StatementPreparation): PreparedStatement = { |
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 | |
import Effects | |
import Effect.StdIO | |
FOO : Type -> EFFECT | |
FOO t = ?FOO | |
------------- This works ----------- | |
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 java.util.concurrent.{TimeUnit, Executors} | |
import scala.annotation.tailrec | |
import scalaz.{\/-, -\/, \/} | |
import java.util.concurrent.atomic.AtomicReference | |
object TM { | |
case class Baseline[A](baseline: A) | |
case class Transaction[A](baseline: Baseline[A], update: 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
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) |
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
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 | |
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
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
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
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)} |
NewerOlder