Use pretty printing library such as pprint #83
Comments
The issue here (as discussed on gitter, repeated here for the record) is that tut just hooks into an |
Can it be reimplemented on top of Ammonite? That seems to pretty print values pretty well. I don't think it pretty prints types yet, but it might be a step in the right direction. Edit: Ammonite uses a separate pretty printing library, so one wouldn't necessarily need to rely on the whole codebase. However, I tinkered with this tuff a while back and I found it easier to use Ammonite's wrapped IMain than raw IMain. |
I tried Ammonite a couple times and it blew up (here and here) so I don't think it's quite ready to deal with the kinds of types that I need to support for my personal work. But this may just be a matter of contributing some fixes; I haven't looked at the implementation at all. I also am somewhat hesitant to change the look and feel because the intent is that tut should present realistic REPL interactions. Maybe there is some kind of middle ground. This issue is related to #33. |
Understood. As you know, @d6y, @noelwelsh and I are interested in using tut for our books at Underscore, so we're a bit of an odd customer. We'd be happy if we could write a thin wrapper around the core library, to customise the output without messing up the out-of-the-box behaviour. Edit: Having tried to work directly with IMain, I think there's a worthwhile project simply providing a functional wrapper that gives control over input and output without having to capture stdout and so on. I haven't looked at the tut codebase in detail, but if that abstraction is there we could definitely make use of it. |
Turns out I was mistaken in thinking that Ammonite/PPrint would support customizable pretty-printing for various types (com-lihaoyi/PPrint#11), which somewhat saps my motivation to work on this 🙁 |
At the risk of sounding like a crazy person, making the compiler itself pluggable in this regard seems like a better strategy. We just need to nerdsnipe someone into figuring out how to do it. |
That sounds good… but at the risk of sounding like a crazier person, I am going to work in parallel on a version of tut that e.g. wraps lines in |
👍 You can do better with something like |
Making sure I'm following: you've formalized customizable display of both the type and value, piggy-backing on PPrint's existing |
Yeah just saying you can derive pretty-printers for types too. Whether with Ammonite/PPrint or without. |
Taking a break from this for today; here's a branch with some minimal progress:
|
It is sometimes difficult to read the output of the REPL, could it be possible to use something like pprint
The text was updated successfully, but these errors were encountered: