penny-0.32.0.8: Extensible double-entry accounting system

Safe HaskellSafe-Inferred

Penny.Cabin.TextFormat

Synopsis

Documentation

data Lines Source

Constructors

Lines 

Fields

unLines :: Seq Words
 

Instances

data Words Source

Constructors

Words 

Fields

unWords :: Seq Text
 

Instances

txtWords :: Text -> WordsSource

Splits a blank-separated text into words.

wordWrap :: Int -> Words -> LinesSource

Wraps a sequence of words into a sequence of lines, where each line is no more than a given maximum number of characters long.

If the maximum number of characters per line is less than 1, returns a Lines that is empty.

An individual word will be split across multiple lines only if that word is too long to fit into a single line. No hyphenation is done; the word is simply broken across two lines.

newtype Target Source

Constructors

Target 

Fields

unTarget :: Int
 

Instances

newtype Shortest Source

Constructors

Shortest 

Fields

unShortest :: Int
 

Instances

shorten :: Shortest -> Target -> Words -> WordsSource

Takes a list of words and shortens it so that it fits in the space allotted. You specify the minimum length for each word, x. It will shorten the farthest left word first, until it is only x characters long; then it will shorten the next word until it is only x characters long, etc. This proceeds until all words are just x characters long. Then words are shortened to one character. Then the leftmost words are deleted as necessary.

Assumes that the words will be printed with a separator, which matters when lengths are calculated.