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 cats._ | |
import cats.data.OptionT | |
import cats.free._ | |
import cats.syntax.option._ | |
import shapeless.{ Id ⇒ _, _ } | |
import shapeless.labelled.{ field, FieldType } | |
//import shapeless.ops.record._ | |
import shapeless.syntax.RecordOps |
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 cats._ | |
import monix.eval.Task | |
import monix.execution.Scheduler | |
import scala.concurrent.Await | |
import scala.concurrent.duration._ | |
object FizzBuzzer { | |
def main(args: Array[String]): Unit = { |
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
implicit class StateTProjections[F[_]: Monad, S, A](state: StateT[F, S, A]) { | |
def project2_1[R2]: StateT[F, (S, R2), A] = | |
state.transformS(_._1, (r, s) ⇒ r.copy(_1 = s)) | |
def project2_2[R1]: StateT[F, (R1, S), A] = | |
state.transformS(_._2, (r, s) ⇒ r.copy(_2 = s)) | |
def project3_1[R2, R3]: StateT[F, (S, R2, R3), A] = | |
state.transformS(_._1, (r, s) ⇒ r.copy(_1 = 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
object StateTExtras { | |
// this is your brain, on drugs | |
implicit class StateTTupler[F[_]: Monad, S, A](state: StateT[F, S, A]) { | |
def tupled2_1[R2]: StateT[F, (S, R2), A] = | |
state.transformS(_._1, (r, s) ⇒ r.copy(_1 = s)) | |
def tupled2_2[R1]: StateT[F, (R1, S), A] = | |
state.transformS(_._2, (r, s) ⇒ r.copy(_2 = 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 cats._ | |
import cats.syntax.all._ | |
object FooAlgebra { | |
sealed trait Op[A] | |
case object Foo extends Op[String] | |
case class FooOps[F[_]](lift: Op ~> F = interpreter) { | |
def foo(): F[String] = lift(Foo) | |
} |
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 com.typesafe.config.Config | |
import classy.core.Decoder | |
import classy.generic.derive._ | |
import classy.config._ | |
case class Bar(value: String) | |
case class Foo( | |
a: String, | |
b: Option[Int], | |
c: List[String], |
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 shapeless._ | |
object emptyList extends Poly0 { | |
implicit def default[T] = at[List[T]](List.empty) | |
} | |
object appendList extends Poly2 { | |
implicit def default[T] = at[T, List[T]](_ :: _) | |
} |
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
/* - | |
* Mezzo [core] | |
*/ | |
package mezzo | |
import scala.Predef.<:< | |
import scala.reflect.ClassTag | |
import shapeless._ |
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
abstract class LiteralValue[S] { | |
def value: S | |
} | |
object LiteralValue { | |
def apply[S](implicit ev: LiteralValue[S]): LiteralValue[S] = ev | |
implicit def makeLiteralValue[S <: Singleton]: LiteralValue[S] = | |
macro LiteralValueMacros.makeLiteralValue[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
package iota_bench | |
import iota._ | |
import cats._ | |
import cats.arrow.FunctionK | |
import cats.data.{ State => _, _ } | |
import cats.free._ | |
import org.scalacheck._ |