-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
andyscott
commented
Dec 28, 2016
•
edited
Loading
edited
- Clean up type classes. Decoder is now more powerful and Read is only used for generic derivation.
- Split modules more cleanly, limiting dependencies in the process.
- Simplify tests
- Cross build for ScalaJS
- Support shocon or similar JVM/JS lib so there's a backend for ScalaJS
f63cccf
to
89d27fb
Compare
89d27fb
to
1760729
Compare
@raulraja I wouldn't mind feedback from you or anyone else over the next few days as I make improvements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments with some ideas. LGTM! Looking fwd to the first release to integrate in Freestyle! Cheers!
} | ||
|
||
sealed trait DecodeErrorInstances { | ||
import wheel._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😼
case (h, t) ⇒ field[K](h) :: t | ||
}) | ||
|
||
implicit def mkDecoderGeneric[A, B, L <: HList]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
} | ||
|
||
/* | ||
sealed abstract class UnconfiguredMkDecoder[A, B] extends Serializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a dirty WIP for supporting default values pulled from the case class constructors.
import org.scalacheck.Prop._ | ||
|
||
import org.scalacheck.derive._ | ||
import org.scalacheck.{ Shapeless ⇒ blackMagic } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤣
@@ -0,0 +1,69 @@ | |||
/* - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all examples should go in tut files as parts of the docs or they'll be invisible for most casual users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!
import classy.typesafe._ | ||
import TypesafeDecoders.std._ | ||
|
||
val decodeA = string("a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer a decode[String]('path)
over specific per datatype methods that are harder to remember.
val decodeBars = configList("bars") andThen decodeBar.sequence | ||
|
||
implicit val decodeFoo = (decodeA and decodeB and decodeC and decodeBars).map { | ||
case (((a, b), c), bar) ⇒ Foo(a, b, c, bar) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern matching this way can be cumbersome. We should provide alternatives through the applicative cartesian builder in the exampels and for the main module an Unapply
extractor to hide the nested tuples in the internals and not expose them to the end user so that we end up with something cleaner like:
(decodeA and decodeB and decodeC and decodeBars).map {
case Decoded(a, b, c, bar) ⇒ Foo(a, b, c, bar)
}
|
||
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match { | ||
case Some((2, 11)) => Seq( | ||
compilerPlugin("com.milessabin" % "si2712fix-plugin" % "1.2.0" cross CrossVersion.full)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If using the typelevel compiler, do you need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't get 2.11 working w/ the typelevel compiler-- so I just did this instead. 2.11.9 should come out soon and then I can just use LB Scala.
@@ -1,5 +1,7 @@ | |||
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.5.1") | |||
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0") | |||
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.3") | |||
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove most of these plugins when using sbt-microsites
77a50f4
to
b733cce
Compare
44e6a0e
to
41d9c4b
Compare
807f05b
to
cc4b84f
Compare