linebreak

linebreak is a very simple library for Haskell to appropriately break a sentence into fixed-width lines, using Knuth-Liang hyphenation to obtain a better result. An example is worth a thousand words; say I wanted to cram this paragraph in 60 columns-width lines, the result would be:

|linebreak| is a very simple library for Haskell to appro-
priately break a sentence into fixed-width lines, using
Knuth-Liang hyphenation to obtain a better result. An exam-
ple is worth a thousand words; say I wanted to cram this
paragraph in 60 columns-width lines, the result would be:

Without hypens (same 60 columns max width):

|linebreak| is a very simple library for Haskell to
appropriately break a sentence into fixed-width lines, using
Knuth-Liang hyphenation to obtain a better result. An
example is worth a thousand words; say I wanted to cram this
paragraph in 60 columns-width lines, the result would be:

As you can see the right margin in the hyphenated text is less ragged (and probably the best result we can obtain, since with fixed-width fonts with double-margin justification look ugly); linebreak attains the result with efficiency and minimal dependencies.

The library

You can find linebreak on Hackage. If you want to contribute, check the darcs repository. As a user, you just need to:

cabal install linebreak

and then read the examples in the module page. For bug reports and feature requests, contact me.