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 Test extends App { | |
trait CanEqual[-A] { | |
def equals(a1: A, a2: A): Boolean | |
} | |
object CanEqual { | |
def apply[A](implicit ev: CanEqual[A]): CanEqual[A] = ev | |
def equals[A](f: (A, A) => Boolean): CanEqual[A] = new CanEqual[A] { | |
def equals(a1: A, a2: A): Boolean = f(a1, a2) | |
} |
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
#!/bin/bash | |
[ $# -eq 0 ] && { echo "Usage: $0 <projectName>"; exit 1; } | |
PROJECT=$1 | |
echo "Creating project in ./$PROJECT" | |
mkdir -p $PROJECT/{js,jvm,project} | |
mkdir -p $PROJECT/shared/src/{main,test}/{scala,resources} | |
cd $PROJECT |
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
// The following, models a HAL Resource based on HAL specification: | |
// http://stateless.co/hal_specification.html | |
// And provides Argonaut JSON encoders for that model | |
// (Argonaut is a purely functional Scala JSON library) | |
// http://argonaut.io/ | |
import shapeless._ | |
import shapeless.ops.hlist.{ToTraversable, Mapper} | |
import argonaut._, Argonaut._ | |
import scala.language.existentials | |
import scala.language.higherKinds |
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 com.github.benhutchison.richutil | |
import org.specs2.ScalaCheck | |
import org.specs2.mutable.Specification | |
import org.scalacheck.Arbitrary | |
import spire.math.Natural | |
class QueueUtilSpec extends Specification with ScalaCheck { | |
import collection.immutable.Queue | |
import ScalacheckIntegration._ |
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
Welcome to the Ammonite Repl 0.5.1 | |
(Scala 2.11.7 Java 1.8.0_66) | |
ben_hutchison-ben_hutchison@ load.ivy("org.typelevel" %% "cats" % "0.4.1") | |
ben_hutchison-ben_hutchison@ load.ivy("org.typelevel" %% "alleycats-core" % "0.1.3") | |
ben_hutchison-ben_hutchison@ import cats._, cats.std.all._ | |
import cats._, cats.std.all._ | |
ben_hutchison-ben_hutchison@ import alleycats._ | |
import alleycats._ |
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
Welcome to the Ammonite Repl 0.5.2 | |
(Scala 2.11.7 Java 1.8.0_51) | |
@ load.ivy("com.chuusai" %% "shapeless" % "2.2.5") | |
@ import shapeless._ | |
import shapeless._ | |
@ sealed trait Country | |
defined trait Country | |
@ case object Germany extends Country | |
defined object Germany |
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 org.atnos.eff._ | |
import cats.syntax.all._ | |
import cats.data._ | |
import Eff._ | |
object EffPlay extends App { | |
import Effects._ | |
import WriterEffect._ | |
import ReaderEffect._ |
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
> effJVM/bench:compile | |
[warn] Credentials file /Users/ben/.sbt/specs2.credentials does not exist | |
[info] Updating {file:/Users/ben/others-code/eff-cats/}effJVM... | |
[info] Resolving jline#jline;2.12.1 ... | |
[info] Done updating. | |
[info] Compiling 1 Scala source to /Users/ben/others-code/eff-cats/jvm/target/scala-2.11/bench-classes... | |
[error] /Users/ben/others-code/eff-cats/jvm/src/bench/scala/EffBenchmark.scala:21: type mismatch; | |
[error] found : scalaz.Name[V] | |
[error] required: org.atnos.eff.EvalEffect.Eval[?] | |
[error] (which expands to) cats.Eval[?] |
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
> testsJVM/whatDependsOn org.scalacheck scalacheck_2.11 1.12.5 | |
[info] org.scalacheck:scalacheck_2.11:1.12.5 (evicted by: 1.13.1) | |
[info] +-org.spire-math:algebra-laws_2.11:0.4.2 [S] | |
[info] | +-org.typelevel:cats-laws_2.11:0.5.0 [S] | |
[info] | +-org.typelevel:alleycats-laws_2.11:0.1.6-SNAPSHOT [S] | |
[info] | +-org.typelevel:alleycats-tests_2.11:0.1.6-SNAPSHOT [S] | |
[info] | | |
[info] +-org.typelevel:alleycats-laws_2.11:0.1.6-SNAPSHOT [S] | |
[info] | +-org.typelevel:alleycats-tests_2.11:0.1.6-SNAPSHOT [S] | |
[info] | |
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
~$> ./amm | |
Loading... | |
Welcome to the Ammonite Repl 0.6.2 | |
(Scala 2.11.8 Java 1.8.0_51) | |
@ load.plugin.ivy("org.spire-math" %% "kind-projector" % "0.8.0") | |
@ load.ivy(("org.atnos" %% "eff-cats" % "1.7.4")) | |
@ import cats.data._ | |
import cats.data._ |
OlderNewer