Hi, over the last few days I've been working on im...
# arrow
j
Hi, over the last few days I've been working on improving the prettyprinter I've written a while back (https://github.com/1Jajen1/kotlin-pretty). It is now pretty much stable and comes with documentation! (https://1jajen1.github.io/kotlin-pretty/docs/). For those not familiar with prettyprinters: A prettyprinter allows you to define dynamic (or static) text in a layout agnostic way which can then later be rendered to string with optimal newlines for the specified width constraints. Check out the readme or the doc page to learn more! The project is written with arrow and mainly makes use of
Eval
for stacksafety and optimization and provides primitives to render Documents with applicative effects (for rendering straight to e.g. an output stream). The docs currently include a landing page, a getting started guide and a full api reference. Everything else in the docs is wip, so if you have any questions feel free to ask directly ask me (or open issues). Feedback is much appreciated!
👏 7
arrow 6
Oh and @pakoito a while back when I released a first version of this, I said I was going to release a parser combinator library and a generic-toString output prettifier sooner or later: The parser combinators: https://github.com/1Jajen1/Kparsec Without docs, but reading the megaparsec docs will get you quite far ^^ And the generic prettifier: https://github.com/1Jajen1/propCheck/blob/902d81c856034b5985d5fc012e78b0b3065e5f7e/src/main/kotlin/propCheck/pretty/Parser.kt Just needs to be extracted to some library ^^ Will add docs for both of these sometime in the next month
p
I bow to your productivity, I'm so happy these things are panning out 😄
I'll check them tonight
j
This is all offspring from rewriting propCheck to have good looking output. The parser is used for not only later pretty printing, but also to produce a git-like diff of output if you check with eqv/neqv. I am currently cleaning up that branch and writing tests (to see if everything works) and I'll have a version out in 1-2 days. It took a long long time to get everything this far (I started the rewrite back in october/november last year)^^ (Both the parser and the prettyprinter were developed first in propCheck and then extracted). And even though most of these are ports of existing libraries, porting from haskell is not easy (especially because of stacksafety and performance).
Here is an example of such output. The code is verbose because I used it to test many different scenarios^^ Both tests have a fault, so ignore what the names etc say, they are supposed to fail 😅
btw the shrinking is automatic and derived, no more manual labour writing (or as is usually the case, not writing) shrinkers^^
😍 2
Oh and yes, those are autogenerated functions which return different deterministic values for different input^^