Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Type rewriting? #33

Open
tpolecat opened this issue Mar 26, 2015 · 4 comments
Open

Type rewriting? #33

tpolecat opened this issue Mar 26, 2015 · 4 comments
Milestone

Comments

@tpolecat
Copy link
Owner

@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.

@tpolecat
Copy link
Owner Author

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.

@tpolecat
Copy link
Owner Author

Might be possible via some kind of integration with Ammonite?

@lihaoyi
Copy link

lihaoyi commented Jan 31, 2016

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

@ryan-williams
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants