tut
tut copied to clipboard
Type rewriting?
@milessabin asked if types could be rewritten ... perhaps by removing prefixes like shapeless.
or scalaz.
and then rewriting selected type constructors like (::
and \/
) in infix form. Would be nice if this could be done without rewriting the output stream, but so far IMain
has been immune to hacking attempts. Worth another look.
It also occurs to me that this might be a better contribution to Scala itself since most of us would like to have this behavior for real in the REPL.
Might be possible via some kind of integration with Ammonite?
Ammonite already does this... feel free to use it, or just grab the code to vendor in your own projects. It's like one file:
https://github.com/lihaoyi/Ammonite/blob/master/repl/src/main/scala-2.11/ammonite/repl/frontend/TPrintImpl.scala#L1
- some autogenerated thing to TPrint functions and some interfaces so 2.10.x can fall back to
.toString
really interested in this feature, going to do some digging around ammonite with an eye toward whether a tut integration is possible
any more recent context on the state/plausibility of this is welcome!
my immediate use-case is overhauling the docs on hammerlab/iterators, where a lot of examples' return-values' toString
is non-empty iterator
😆
vaguely related is also a ToLines
type-class I wrote/use, and customizable auto-derivations for it