Commit 911d4f1
committed
New test case
A simplified test case which adopts several improvements from Miles Sabin's branch.
Compared to typeclass-derivation2c.scala:
- The alternatives and numberOfCases methods are gone
- All compiler-generated info is in the companion objects;
no additional classes are generated.
- The derivation code largely uses the type traversals of
the previous schemes instead of simple counting, as was
the case in typeclass-derivation2c.scala.
- Generic has been renamed to Mirror, following a suggestion
by Miles (but now all mirrors are static)
The key insight is that we do not need a mapping from the sum type
to its alternatives except knowing what the alternative types are.
Once we have an alternative type, we can use an implicit match
to retrieve the mirror for that alternative.1 parent fb6667b commit 911d4f1
File tree
2 files changed
+463
-0
lines changed- tests/run
2 files changed
+463
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
0 commit comments