DynamicF is used in a lot of places in remote.Format because type synonyms are always expanding, leading to an explosion of type information, especially for formats that are expanded over and over, leading scalac to try to generate invalid classfiles.
This uses abstract singleton format types to "erase" format information after it's been used to verify that a Reader and Writer are consistent. This also has the effect of preventing expansion of formats; that is, in error messages, they remain their singleton-dependent F types without expansion.
The biggest benefits are to be had from erasing more primitive formats; note below how much erasing PrimExprF saved, despite that most of its expansions had already been erased unsafely with DynamicF.
total remote directory
no more dyn
These were derived with
$ java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM)64-Bit Server VM (build 25.92-b14, mixed mode)
$ uname -a
Darwin ... 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 1918:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
There was another interesting benefit: the erasure means that full mutual and polymorphic recursion of codecs (the latter via higher-kinded existentials like CodecPair2) can be safely described, because the [infinite] type no longer expands. This also obviates FixF generally, but I haven't done that. So this change removes all use of DynamicF and erase.
This also fixes a bug where Relation reading didn't implement one of the writing cases, which was found by the use of its proper Format instead of DynamicF.
I haven't built everything, because utilJavafx doesn't build on Java 8. There might be a few things in htmlWriter that won't compile, either needing more type parameters (e.g. extW) or not calling erase. I also don't know whether you'd want to do this in scala-2.9.2, but it should work if you do.