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
val jettyWebPath = "src" / "main" / "webapp" / "WEB-INF" / "jetty-web.xml" | |
lazy val installProductionRunMode = task { | |
FileUtilities.copyFile("project" / "jetty-web.xml", | |
jettyWebPath, | |
log) | |
log.info("Copied jetty-web.xml into place") | |
None | |
} describedAs("Install a jetty-web.xml that sets the run mode to production") |
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 myna | |
package app | |
import bigtop.util.Uuid | |
import myna.model.external.User | |
import myna.util.Base64 | |
import play.api.libs.ws._ | |
import play.api.libs.json._ | |
import play.api.libs.concurrent.Promise | |
import play.api.mvc.Request |
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 scalaz.{Functor, Monad} | |
import scalaz.std.option._ | |
import scalaz.syntax.monad._ | |
import scalaz.syntax.functor._ | |
object SyntaxExamples { | |
// This works fine | |
Monad[Option].lift((x: Int) => x + 1) | |
// could not find implicit value for parameter F: scalaz.Functor[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
// Type class | |
trait Burp[A] { | |
def burp(in: A): String | |
} | |
object Burp { | |
def apply[A](implicit burp: Burp[A]): Burp[A] = burp | |
} | |
case class Foo(name: 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
import scalaz.\/ | |
import scalaz.syntax.either._ | |
object Example2 { | |
// This example simulates error handling for a simple three tier web application | |
// | |
// The tiers are: | |
// - the HTTP service | |
// - a user authentication layer | |
// - a database layer |
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
object Nullable { | |
sealed trait NullableTag | |
type Nullable[A] = A with NullableTag | |
def nullAs[B]: Nullable[B] = | |
null.asInstanceOf[Nullable[B]] | |
implicit class ToNullable[A](val a: A) extends AnyVal { | |
def `?`: Nullable[A] = a.asInstanceOf[Nullable[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
import cats.{Id,Monad} | |
import cats.state.State | |
import cats.std.function._ | |
import scala.language.higherKinds._ | |
// Call Example.example.run to see the example running | |
object Example { | |
type MyState[A] = State[Int, 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
sealed trait Observer[A] { | |
def observe(in :A): Unit = | |
this match { | |
case Map(f, o) => | |
// This is completely unsound. b should be of type B, which we don't | |
// have available at this point. The compiler allows us to insert | |
// anything here, causing a runtime crash. | |
val b = () | |
o.observe(b) | |
case Sink(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
Much software claims to scale horizontally | |
But don't take to these claims too wantonly | |
Too often things fail | |
To properly scale | |
And marketers talk irresponsibily |
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 nl.mdj | |
import cats.arrow.NaturalTransformation | |
import cats.functor.Invariant | |
import cats._ | |
import cats.syntax.all._ | |
import scala.language.higherKinds | |
sealed abstract class FreeInvariant[F[_], A] extends Product with Serializable { |
OlderNewer