Skip to content

Instantly share code, notes, and snippets.

Ben Hutchison benhutchison

Block or report user

Report or block benhutchison

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benhutchison
benhutchison / JsonObjectOptics.scala
Created Mar 10, 2017
Circe: Failing test output for JsonObject Iso List[(String, Json)]
View JsonObjectOptics.scala
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 Feb 3, 2017
Example: Change an Effect stack part way through a program
View ChangeEffectExample.scala
//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._
View MemberInTransform.scala
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 Sep 22, 2016
Collect Non-empty options within an Eff-monad
View ammonite.repl
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 Sep 10, 2016
Problems translating Effect stack in eff-cats 2.0-RC7
View ammonite.repl
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._;
View ammonite.repl
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 Aug 20, 2016 — forked from labra/ComputationOrder1.scala
Another example with computation order...
View ComputationOrder1.scala
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 Jul 14, 2016
Any simpler way to write Refined Higher-kinded types?
View AmmoniteReplSession
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 Jul 5, 2016
Eff: Can a Member type that takes a type parameter be expressed as a context bound of the effect type?
View AmmoniteReplSession
~$> ./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._
@benhutchison
benhutchison / gist:9353b7ff96ace04f488f7fb884c8b7e1
Created Jun 20, 2016
Alleycats SBT> whatDependsOn Scalacheck 0.12.x vs 0.13.x
View gist:9353b7ff96ace04f488f7fb884c8b7e1
> 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] |
You can’t perform that action at this time.