Permalink
Browse files

Remove `Strict` from the inductive steps

`Strict` isn't required anymore because we cache intermediary
derivations manually and therefore we are not affected by spurious
implicit divergence failures.
  • Loading branch information...
jvican committed May 31, 2018
1 parent 222cb13 commit 148ffb0a20226a6224ab53f87a8f7411036cdd3f
@@ -130,18 +130,18 @@ object HListParser {

implicit def hconsRecursive[K <: Symbol, H, HD, T <: HList, PT <: HList, DT <: HList, NT <: HList, VT <: HList, MT <: HList, HT <: HList, RT <: HList]
(implicit
headParser: Strict[Parser.Aux[H, HD]],
headParser: Parser.Aux[H, HD],
tail: Aux[T, DT, NT, VT, MT, HT, RT, PT]
): Aux[FieldType[K, H] :: T, Option[H] :: DT, Nil.type :: NT, None.type :: VT, None.type :: MT, None.type :: HT, Some[Recurse] :: RT, HD :: PT] =
instance { (default0, names, valueDescriptions, helpMessages, noHelp) =>
val tailParser = tail(default0.tail, names.tail, valueDescriptions.tail, helpMessages.tail, noHelp.tail)

new Parser[FieldType[K, H] :: T] {
val args = headParser.value.args ++ tailParser.args
val args = headParser.args ++ tailParser.args
type D = HD :: PT
def init = headParser.value.init :: tailParser.init
def init = headParser.init :: tailParser.init
def step(args: Seq[String], d: HD :: PT) =
headParser.value.step(args, d.head).right.flatMap {
headParser.step(args, d.head).right.flatMap {
case None =>
tailParser.step(args, d.tail).right.map(_.map {
case (t, args) => (d.head :: t, args)
@@ -151,7 +151,7 @@ object HListParser {
}
def get(d: HD :: PT) =
for {
h <- headParser.value.get(d.head).right
h <- headParser.get(d.head).right
t <- tailParser.get(d.tail).right
} yield field[K](h) :: t
}
@@ -81,9 +81,9 @@ abstract class LowPriorityParserImplicits {
helpMessages: Annotations.Aux[HelpMessage, CC, M],
noHelp: Annotations.Aux[Hidden, CC, H],
recurse: Annotations.Aux[Recurse, CC, R],
parser: Strict[HListParser.Aux[L, D, N, V, M, H, R, P]]
parser: HListParser.Aux[L, D, N, V, M, H, R, P]
): Parser.Aux[CC, P] =
parser.value(defaults(), names(), valuesDesc(), helpMessages(), noHelp()).map(gen.from)
parser(defaults(), names(), valuesDesc(), helpMessages(), noHelp()).map(gen.from)
}

object Parser extends LowPriorityParserImplicits {

0 comments on commit 148ffb0

Please sign in to comment.