| Copyright | © Herbert Valerio Riedel 2018 |
|---|---|
| License | BSD3 |
| Maintainer | hvr@gnu.org |
| Stability | stable |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
Data.Text.Short.Partial
Description
Partial functions vocabulary
This module provides common partial functions for operating on ShortText.
The use of these functions is discouraged as they tend to be error-prone.
Since: 0.1.2
Synopsis
- head :: ShortText -> Char
- tail :: ShortText -> ShortText
- init :: ShortText -> ShortText
- last :: ShortText -> Char
- index :: ShortText -> Int -> Char
- foldl1 :: (Char -> Char -> Char) -> ShortText -> Char
- foldl1' :: (Char -> Char -> Char) -> ShortText -> Char
- foldr1 :: (Char -> Char -> Char) -> ShortText -> Char
Documentation
head :: ShortText -> Char Source #
\(\mathcal{O}(1)\) Returns first character of a non-empty ShortText
>>>head "abcd"'a'
Note: Will throw an error exception for empty ShortTexts.
Consider using the total functions uncons or indexMaybe
instead.
Since: 0.1.2
last :: ShortText -> Char Source #
\(\mathcal{O}(1)\) Return last character from non-empty ShortText.
>>>last "abcd"'d'
Note: Will throw an error exception for empty ShortTexts.
Consider using the total functions unsnoc or indexEndMaybe
instead.
Since: 0.1.2
index :: ShortText -> Int -> Char Source #
\(\mathcal{O}(n)\) Retrieve \(i\)-th character (code-point)
>>>index "abcd" 1'b'
Note: Will throw an error exception if index is out of
bounds. Consider using the total functions indexMaybe or
indexEndMaybe instead.
Since: 0.1.2
foldl1' :: (Char -> Char -> Char) -> ShortText -> Char Source #
\(\mathcal{O}(n)\) Strict version of foldl1.
Since: 0.1.2