Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal.renderLazy isn't lazy #175

Closed
georgefst opened this issue Jun 30, 2020 · 1 comment · Fixed by #176
Closed

Terminal.renderLazy isn't lazy #175

georgefst opened this issue Jun 30, 2020 · 1 comment · Fixed by #176

Comments

@georgefst
Copy link
Contributor

georgefst commented Jun 30, 2020

This originally came up in discussion at cdepillabout/pretty-simple#67. Although it returns a lazy Text, there doesn't really seem to be any laziness in Data.Text.Prettyprint.Doc.Render.Terminal.renderLazy, presumably due to the use of ST.

For example, I would expect to see:

(TL.take 5 . renderLazy . fix $ SChar 'a') == "aaaaa"

but instead the left-hand-side is just .

I could submit a PR fixing this, since I've already written the code (though I haven't benchmarked it...).

@sjakobi
Copy link
Collaborator

sjakobi commented Jul 1, 2020

While I do feel hat pretty-simple is a bit of an outlier with its laziness requirement, I agree that it would be nice if the renderLazy output could be consumed in a streaming fashion.

The function is somewhat performance sensitive though. See e.g. #121. So I hope we can keep the performance within 20% or so of the current implementation.

I think I'd also slightly prefer not to use monad transformers in the implementation, if that's possible.

sjakobi pushed a commit that referenced this issue Jul 21, 2020
* Make 'Terminal.renderLazy' lazy

* Format extension pragmas

* Add module header

* Reorganise imports

* De-wibbling

Fixes #175.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants