@[implicit_reducible]
Equations
- Data.DataString.instIsStringString = { fromString := id }
Split a string into lines (on '\n').
$$\text{lines}(\text{"a\\nb\\nc"}) = [\text{"a"}, \text{"b"}, \text{"c"}]$$
Equations
- Data.DataString.lines s = s.splitOn "\n"
Instances For
Split a string into words (on whitespace).
$$\text{words}(\text{"hello world"}) = [\text{"hello"}, \text{"world"}]$$
Equations
Instances For
Equations
Instances For
Join lines with '\n'.
$$\text{unlines}([\text{"a"}, \text{"b"}]) = \text{"a\\nb\\n"}$$
Equations
- Data.DataString.unlines ls = "\n".intercalate ls ++ if ls.isEmpty = true then "" else "\n"
Instances For
Join words with ' '.
$$\text{unwords}([\text{"hello"}, \text{"world"}]) = \text{"hello world"}$$
Equations
- Data.DataString.unwords ws = " ".intercalate ws