haskell-formatter-2.0.2: Haskell source code formatter

Safe HaskellSafe
LanguageHaskell2010

Language.Haskell.Formatter.Internal.Newline

Description

 
Synopsis

Documentation

newlines :: [String] Source #

Unicode newline strings ordered by descending length. This corresponds to the set of newlines from http://www.unicode.org/standard/reports/tr13/tr13-5.html.

joinSeparatedLines :: [String] -> String Source #

Concatenates strings with default newlines "\n" between.

Unlike unlines, this does not append a newline to the last string.

>>> joinSeparatedLines ["apple", "pine"]
"apple\npine" 

splitSeparatedLines :: String -> [String] Source #

Breaks a string up into its lines at newlines. The resulting strings do not contain newlines.

Unlike lines, this interprets a newline as a separator, not a terminator. Thus, if the input string ends with a newline, the output list ends with the empty string.

>>> splitSeparatedLines "0\n1\r2\r\n3\n\r4"
["0","1","2","3","","4"]
last (splitSeparatedLines $ s ++ "\LF") == ""