word-wrap-0.4.1: A library for word-wrapping

Safe Haskell | Safe
Language | Haskell2010

Text.Wrap

Synopsis

- data WrapSettings = WrapSettings {
  - preserveIndentation :: Bool
  - breakLongWords :: Bool
  }
- defaultWrapSettings :: WrapSettings
- wrapTextToLines :: WrapSettings -> Int -> Text -> [Text]
- wrapText :: WrapSettings -> Int -> Text -> Text

# Documentation

data WrapSettings Source #

Settings to control how wrapping is performed.

Constructors

WrapSettings |

Fields

- preserveIndentation :: Bool

  Whether to indent new lines created by wrapping when their original line was indented.

- breakLongWords :: Bool

  Whether to break in the middle of the first word on a line when that word exceeds the wrapping width.

Instances

Eq WrapSettings Source # |
Instance details Defined in Text.Wrap Methods (==) :: WrapSettings -> WrapSettings -> Bool Source # (/=) :: WrapSettings -> WrapSettings -> Bool Source #
Read WrapSettings Source # |
Instance details Defined in Text.Wrap Methods readsPrec :: Int -> ReadS WrapSettings Source # readList :: ReadS [WrapSettings] Source # readPrec :: ReadPrec WrapSettings Source # readListPrec :: ReadPrec [WrapSettings] Source #
Show WrapSettings Source # |
Instance details Defined in Text.Wrap Methods showsPrec :: Int -> WrapSettings -> ShowS Source # show :: WrapSettings -> String Source # showList :: [WrapSettings] -> ShowS Source #

defaultWrapSettings :: WrapSettings Source #

wrapTextToLines :: WrapSettings -> Int -> Text -> [Text] Source #

Wrap text at the specified width. Newlines and whitespace in the input text are preserved. Returns the lines of text in wrapped form. New lines introduced due to wrapping will have leading whitespace stripped.

wrapText :: WrapSettings -> Int -> Text -> Text Source #

Like `wrapTextToLines`, but returns the wrapped text reconstructed with newlines inserted at wrap points.