\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.
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05
Moduletext-short-0.1.6Haskell2010
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.
\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.
\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.
\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.
\mathcal{O}(n) Strict version of foldl1.