shapeless: Generic programming for Scala | This room deprecated in favour of #shapeless on the Typelevel Discord: https://discord.gg/bSQBZA3Ced
joroKr21 on main
Remove refinement from Witness.… Merge branch 'main' into witnes… Merge branch 'main' into witnes… and 2 more (compare)
joroKr21 on main
Update sbt to 1.7.1 Merge pull request #1263 from s… (compare)
joroKr21 on main
Update junit-plugin, junit-runt… Revert commit(s) ca4fe1de Merge branch 'main' into update… and 2 more (compare)
joroKr21 on main
Update sbt-scalajs, scalajs-com… Merge branch 'main' into update… Merge pull request #1260 from s… (compare)
joroKr21 on main
Update scala-compiler, scala-li… Merge pull request #1261 from s… (compare)
describer
probably needs some modification, it doesn't compile if your case classes have List
s in them
List
Option
, and in general, data types with alternatives?
Baz
and a List
?
Poly
towards a custom type class (even though you get to keep, with small adaptations, most of the code in the instances)
Lists
to be printed differently, e.g. 1..2
, add an instance to describer
forTraversable()
List
s to be printed differently which is why I added an implicit def
to construct a type class for List[Int]
. it should display lists as [1,2]
Describe
is not being resolved recursively
[1,2,3]
and so on right? or [1]
if they have one element
Poly
s
<: HList
to the R
type parameter in kv
base
in LowPrioDescriber
to take an implicit f: Format[V]
where Format
is a typeclass that converts types to String
.toString
with f(x: V)
Format
sounds similar to Describe
, it's because it is! Hence my point about all this being probably better if rewritten from scratch as a recursive typeclass
LabelledGeneric#Repr
type to get access to the field names later
HList
s themselves though. here's the latest: https://scalafiddle.io/sf/8e8Kbup/4
HList
since it can't create LabelledGeneric
for the example I tried. makes sense. :)
implicit def caseClassParser[Case, Repr <: HList]
(implicit
gen: LabelledGeneric.Aux[Case, Repr],
reprParser: Lazy[CsvParser[Repr]]): CsvParser[Case] = {
instance(reprParser.value.size) { cells =>
reprParser.value.parse(cells).right.map { parsed =>
(gen.from(parsed))
}
} { c => reprParser.value.to(gen.to(c)).init }
}
Repr
have a different type in Generic
and LabelledGeneric
, since in the latter the type also carries evidence of the field names