Skip to content

Instantly share code, notes, and snippets.

View benhutchison's full-sized avatar

Ben Hutchison benhutchison

View GitHub Profile
~/workspace/binance-scala-client (master)$> sbt test
Getting org.scala-sbt sbt 1.6.1 (this may take some time)...
[snip]
[info] compiling 11 Scala sources to /Users/ben/workspace/binance-scala-client/target/scala-2.13/classes ...
[info] Non-compiled module 'compiler-bridge_2.13' for Scala 2.13.7. Compiling...
[info] Compilation completed in 8.261s.
[info] compiling 13 Scala sources to /Users/ben/workspace/binance-scala-client/target/scala-2.13/test-classes ...
[warn] 1 feature warning; re-run with -feature for details
@benhutchison
benhutchison / JsonObjectOptics.scala
Created March 10, 2017 11:02
Circe: Failing test output for JsonObject Iso List[(String, Json)]
package io.circe.optics
import cats.instances.list.catsStdInstancesForList
import io.circe.{Json, JsonObject}
import monocle.{Iso, Lens, Traversal}
import monocle.function.{At, Each, FilterIndex, Index}
import scalaz.{Applicative, Traverse}
import scalaz.std.ListInstances
@benhutchison
benhutchison / ChangeEffectExample.scala
Created February 3, 2017 21:48
Example: Change an Effect stack part way through a program
//See this example at http://scastie.org/26026
/***
scalaVersion := "2.12.1"
libraryDependencies += "org.atnos" %% "eff" % "2.2.0"
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.3")
scalacOptions += "-Ypartial-unification"
*/
import cats._
@benhutchison
benhutchison / MemberInTransform.scala
Created September 27, 2016 23:08 — forked from etorreborre/MemberInTransform.scala
transform a MemberIn
object Test {
import cats._
import cats.data._
import cats.implicits._
import org.atnos.eff._
import org.atnos.eff.all._
import org.atnos.eff.syntax.all._
case class Address()
@benhutchison
benhutchison / ammonite.repl
Created September 22, 2016 04:39
Collect Non-empty options within an Eff-monad
Welcome to the Ammonite Repl 0.6.2
(Scala 2.11.8 Java 1.8.0_66)
ben_hutchison-ben_hutchison@ load.ivy("org.typelevel" %% "cats" % "0.7.1")
ben_hutchison-ben_hutchison@ load.plugin.ivy("org.spire-math" %% "kind-projector" % "0.9.0")
ben_hutchison-ben_hutchison@
load.plugin.ivy("com.milessabin" % "si2712fix-plugin_2.11.8" % "1.2.0")
ben_hutchison-ben_hutchison@ load.ivy("org.atnos" %% "eff-cats" % "2.0.0-RC7")
@benhutchison
benhutchison / ammonite.repl
Created September 10, 2016 13:09
Problems translating Effect stack in eff-cats 2.0-RC7
Welcome to the Ammonite Repl 0.6.2
(Scala 2.11.8 Java 1.8.0_51)
@ load.plugin.ivy("com.milessabin" % "si2712fix-plugin_2.11.8" % "1.2.0")
@ load.plugin.ivy("org.spire-math" %% "kind-projector" % "0.8.0")
@ load.ivy("org.atnos" %% "eff-cats" % "2.0.0-RC7")
@ import org.atnos.eff._, all._, syntax.all._;
import org.atnos.eff._, all._, syntax.all._;
@benhutchison
benhutchison / ammonite.repl
Created September 6, 2016 18:35
Eff 2.0 Woes
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" % "2.0.0-RC7")
@ import cats._, data._, implicits._;
import cats._, data._, implicits._;
@ import org.atnos.eff._, all._, org.atnos.eff.syntax.all._;
import org.atnos.eff._, all._, org.atnos.eff.syntax.all._;
@benhutchison
benhutchison / ComputationOrder1.scala
Last active August 20, 2016 13:18 — forked from labra/ComputationOrder1.scala
Another example with computation order...
import cats._, data._
import org.atnos.eff._, all._
import org.atnos.eff.syntax.all._
object ComputationOrder {
//// With 3 effects, it fails when I use runNel at the beginning
type C3 = Fx.fx3[State[String,?],Choose,Validate[String,?]]
@benhutchison
benhutchison / AmmoniteReplSession
Created July 14, 2016 06:26
Any simpler way to write Refined Higher-kinded types?
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.typelevel" %% "cats" % "0.6.0")
@ import cats._; import implicits._
import cats._;
import implicits._
@ load.ivy("eu.timepit" %% "refined" % "0.5.0")
@benhutchison
benhutchison / AmmoniteReplSession
Last active July 5, 2016 05:06
Eff: Can a Member type that takes a type parameter be expressed as a context bound of the effect type?
~$> ./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._