headroom-0.1.0.0: License Header Manager
Copyright(c) 2019-2020 Vaclav Svejcar
LicenseBSD-3
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.Text

Description

Adds some extra functionality to the Data.Text module.

Synopsis

Documentation

detectNewLine Source #

Arguments

:: Text

input text

-> Maybe NewLine

detected newline character

Detects which newline character is used in given text (if any).

>>> detectNewLine "foo\nbar"
Just LF

showNewLine Source #

Arguments

:: NewLine

newline character to render

-> Text

rendered character

Renders appropriate newline character (e.g. n) for given NewLine representation.

>>> showNewLine LF
"\n"

lines' Source #

Arguments

:: Text

text to split

-> (NewLine, [Text])

detected newline separator and split lines

Split text into lines, return lines and detected newline separator.

>>> lines' "foo\nbar"
(LF,["foo","bar"])

unlines' :: NewLine -> [Text] -> Text Source #

Join individual text lines into single text, using given newline separator.

>>> unlines' LF ["foo", "bar"]
"foo\nbar"