17 October 2016
This file contains 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 monocle.macros.GenIso | |
import scalaz.std.option._ | |
object Test extends App { | |
case class Bar(blub: Option[String]) | |
case class Foo(bar: Option[Bar]) | |
val bar = GenIso[Foo, Option[Bar]] | |
val blub = GenIso[Bar, Option[String]] |
This file contains 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 Semigroup[A] {} | |
trait Monoid[A] extends Semigroup[A] {} | |
trait Functor[F[_]] {} | |
trait Applicative[F[_]] extends Functor[F] {} | |
trait Foo[A] { override def toString: String = "Foo"} | |
trait Foo2[A] extends Foo[A] { override def toString: String = "Foo2"} | |
trait Foo3[A] extends Foo2[A] {override def toString: String = "Foo3"} |
This file contains 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 vanilla | |
sealed trait Optic[G[_,_] <: Optic[G, _, _], S, A] { | |
def compose[F[_, _] <: Optic[F, _, _], B](o: F[A, B])(implicit lub : Lub[G,F]) : lub.T[S, B] = | |
lub.compose(self, o) | |
def self: G[S,A] | |
def desc: List[String] | |
} | |
case class Traversal[A,B](desc : List[String]) extends Optic[Traversal,A,B] { |
This file contains 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 foobar.style | |
import scalacss.Defaults._ | |
object ExampleStyle extends StyleSheet.Inline { | |
import dsl._ | |
val ul = style( | |
backgroundColor.blue | |
) |
This file contains 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
λ> parseString parseSemVer mempty "1.0.0-alpha+001" | |
Success (SemVer 1 0 0 [NOSS "alpha"] [NOSI 1]) | |
λ> parseString parseSemVer mempty "1.0.0+20130313144700" | |
Success (SemVer 1 0 0 [] [NOSI 20130313144700]) | |
λ> parseString parseSemVer mempty "1.0.0" | |
Success (SemVer 1 0 0 [] []) |
This file contains 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
sealed trait Alg1[A] | |
case class Foo1(s: String) extends Alg1[Int] | |
case object Bar1 extends Alg1[Boolean] | |
sealed trait Alg2[A] | |
case class Foo2[A](s: String, f: String => A) extends Alg2[A] | |
case class Bar[A](f: Boolean => A) extends Alg2[A] |
This file contains 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 sandbox | |
import cats.data.Coproduct | |
import cats.free.{Free, Inject} | |
sealed trait Alg1[A] | |
sealed trait Alg2[A] | |
sealed trait Alg3[A] | |
class Alg1Ops[F[_]](implicit I: Inject[Alg1, F]){ |
This file contains 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 freee | |
import scalaz.\/ | |
import scalaz.concurrent.Task | |
object Example extends App { | |
import Interact._ | |
val program: API[Unit] = for { | |
_ <- tell("Hey") |
This file contains 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 bilberry.snippet | |
import scalaz.syntax.functor._ | |
trait MyShow[A] { | |
def show(a: A): String | |
} | |
object MyShow { | |
def apply[A](implicit ev: MyShow[A]): MyShow[A] = ev // summon the implicit using syntax MyShow[X] |