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

Improving docs about lines processing #424

Open
wfranzini opened this issue Nov 14, 2019 · 1 comment
Open

Improving docs about lines processing #424

wfranzini opened this issue Nov 14, 2019 · 1 comment

Comments

@wfranzini
Copy link

wfranzini commented Nov 14, 2019

As a conduit and haskell newbie, I'm having problems understanding how conduit should be used processing text file one line at a time.

I'm going to list the things that confuses me, but I also volunteer to improve the docs (with some guidance)

  • Why lineC produce only one line?
  • Why linesUnbounded has a warning about memory exhaustion and lineC is immune from this problem?
  • What's the proper way to write a numbering lines function (aka nl) without using linesUnbounded or splitOnUnboundedE?
  • What's the proper way to process a text file where lines are split using
    • C convention (i.e. if the last char is '\' then the next line must be joined with the current one discarding the '\' and the '\n')
    • LDIF convention (i.e. if the first char is space then the line should be joined with the previous one discarding both '\n' and ' ')

Feel free to close the issue if you think the documentation is ok and my difficulties are only due to my ignorance :-)

@snoyberg
Copy link
Owner

There's a section in the README that addresses some of your questions (hopefully the first 3):

https://github.com/snoyberg/conduit#forced-consumption

There's no built-in solution for the C/LDIF convention approach you mention, you'd want to write your own ConduitT that awaits and yields, possibly with a leftover.

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

No branches or pull requests

2 participants