Skip to content

Commit

Permalink
Upgrade to Cats 0.9.0
Browse files Browse the repository at this point in the history
Fixes #41.
  • Loading branch information
durban committed Feb 13, 2017
1 parent 57aae75 commit 8087947
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ lazy val scodecSettings = Seq[Setting[_]](

lazy val dependencies = new {

val catsVersion = "0.8.1"
val circeVersion = "0.6.1"
val catsVersion = "0.9.0"
val circeVersion = "0.7.0"

val shapeless = "com.chuusai" %% "shapeless" % "2.3.2"
val cats = "org.typelevel" %% "cats-core" % catsVersion
Expand All @@ -173,8 +173,8 @@ lazy val dependencies = new {
"io.circe" %% "circe-parser" % circeVersion
)

val scodecBits = "org.scodec" %% "scodec-bits" % "1.1.2"
val scodecCats = "org.scodec" %% "scodec-cats" % "0.2.0"
val scodecBits = "org.scodec" %% "scodec-bits" % "1.1.4"
val scodecCats = "org.scodec" %% "scodec-cats" % "0.3.0"
val scodec = Seq(
scodecBits,
"org.scodec" %% "scodec-core" % "1.10.3",
Expand Down
20 changes: 11 additions & 9 deletions circe/src/main/scala/io/sigs/seals/circe/Codecs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,22 @@ trait Codecs {
},
hNil = { cur => cur.as[JsonObject](Decoder.decodeJsonObject).map(_ => cur) },
hCons = { (cur, sym) =>
cur.downField(sym.name).either.leftMap { fc =>
DecodingFailure(s"missing key: '${sym.name}'", fc.history)
}.map { hc =>
Either.right((hc, (_: HCursor) => Either.right(cur)))
}
val c2 = cur.downField(sym.name)
c2.success
.toRight(left = DecodingFailure(s"missing key: '${sym.name}'", c2.history))
.map { hc =>
Either.right((hc, (_: HCursor) => Either.right(cur)))
}
},
cNil = { cur =>
DecodingFailure("no variant matched (CNil reached)", cur.history)
},
cCons = { (cur, sym) =>
cur.downField(sym.name).either.fold(
fc => Either.right(Right(cur)),
sc => Either.right(Left(sc))
)
cur.downField(sym.name).success.fold {
Either.right(Either.right[HCursor, HCursor](cur))
} { hc =>
Either.right(Either.left(hc))
}
},
vectorInit = { cur =>
for {
Expand Down

0 comments on commit 8087947

Please sign in to comment.