-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Manipulate and convert strings of characters uniformly and consistently -- -- Reduce complexity of Haskell by providing a -- -- -- -- with the most important text manipulation functions for string and -- text where the semantic is the same (tested with quickcheck). -- Tentatively some infix string manipulations are offered as well. -- -- Please see the README on GitHub at -- https://github.com/andrewufrank/uniform-strings/readme @package uniform-strings @version 0.1.2 -- | a module to convert between character string encodings module Uniform.Strings.Conversion -- | A space-efficient representation of a Word8 vector, supporting -- many efficient operations. -- -- A ByteString contains 8-bit bytes, or by using the operations -- from Data.ByteString.Char8 it can be interpreted as containing -- 8-bit characters. data ByteString type LazyByteString = ByteString s2b :: String -> ByteString b2s :: ByteString -> Maybe String b2t :: ByteString -> Maybe Text t2b :: Text -> ByteString t2u :: Text -> Text -- | convert string to url (uses code from Network.HTTP, which converts -- space into %20) s2u :: String -> String -- | String to Text (invertable) s2t :: String -> Text -- | String to Text (invertable) t2s :: Text -> String t2tl :: Text -> Text tl2t :: Text -> Text -- | A space efficient, packed, unboxed Unicode text type. data Text newtype BSUTF BSUTF :: ByteString -> BSUTF newtype URL URL :: String -> URL b2bu :: ByteString -> Maybe BSUTF bu2b :: BSUTF -> ByteString bu2s :: BSUTF -> String -- | ByteString to Text -- inverse (not an arbitrary input) bu2t :: BSUTF -> Text -- | Text to Bytestring (invertable) t2bu :: Text -> BSUTF -- | String to Bytestring (invertable) s2bu :: String -> BSUTF u2b :: ByteString -> Maybe ByteString u2t :: Text -> Maybe Text -- | convert url to string (uses code from Network.HTTP, which converts -- space into %20) u2s :: String -> Maybe String b2u :: ByteString -> Maybe ByteString b2bl :: ByteString -> ByteString bl2b :: ByteString -> ByteString -- | conversion from LazyByteString to text (only if guarantee that only -- utf8 values) bl2t :: LazyByteString -> Text t2bl :: Text -> LazyByteString bb2t :: ByteString -> Text bb2s :: ByteString -> String s2latin :: String -> ByteString t2latin :: Text -> ByteString latin2t :: ByteString -> Text latin2s :: ByteString -> String -- | bytestring with latin1 encoded characters newtype BSlat BSlat :: ByteString -> BSlat -- | string encoded as ByteString with latin encoding, if possible s2lat :: String -> Maybe BSlat -- | bytestring with latin encoding to string lat2s :: BSlat -> String -- | Text encoded as ByteString with latin encoding, if possible t2lat :: Text -> Maybe BSlat -- | Text encoded as ByteString with latin encoding, if possible lat2t :: BSlat -> Text -- | string converted to represenatable as latin and then encoded lossy! s3lat :: String -> BSlat -- | Text converted to represenatable as latin and then encoded lossy! t3lat :: Text -> BSlat s3latin :: String -> ByteString t3latin :: Text -> ByteString -- | convert string to url (uses code from Network.HTTP, which converts -- space into %20) s2url :: String -> URL -- | convert url to string (uses code from Network.HTTP, which converts -- space into %20) url2s :: URL -> String unURL :: URL -> String -- | converts text to bytestring, if meaningful t22latin :: Text -> Maybe ByteString -- | convert a string to contain only characters in latin1 convertLatin :: String -> String -- | the result is a string of all the characters not in the latin1 -- encoding possibly apply conv2latinChar first findNonLatinChars :: String -> String -- | the result is a string of all the characters not in the latin1 -- encoding findNonLatinCharsT :: Text -> Text filterLatin :: String -> String fromJustNote :: Partial => String -> Maybe a -> a instance GHC.Base.Monoid Uniform.Strings.Conversion.BSUTF instance GHC.Base.Semigroup Uniform.Strings.Conversion.BSUTF instance Uniform.Zero.Zeros Uniform.Strings.Conversion.BSUTF instance GHC.Generics.Generic Uniform.Strings.Conversion.BSUTF instance GHC.Classes.Ord Uniform.Strings.Conversion.BSUTF instance GHC.Classes.Eq Uniform.Strings.Conversion.BSUTF instance GHC.Read.Read Uniform.Strings.Conversion.BSUTF instance GHC.Show.Show Uniform.Strings.Conversion.BSUTF instance GHC.Classes.Eq Uniform.Strings.Conversion.URL instance GHC.Show.Show Uniform.Strings.Conversion.URL instance GHC.Classes.Eq Uniform.Strings.Conversion.BSlat instance GHC.Show.Show Uniform.Strings.Conversion.BSlat instance Uniform.Zero.Zeros Uniform.Strings.Conversion.URL instance Uniform.Zero.Zeros Uniform.Strings.Conversion.LazyByteString instance Uniform.Zero.Zeros Data.ByteString.Internal.ByteString -- | a module with a class for strings, such that the normal functions are -- all polymorphic for string and text (and total) the string (i.e. -- [Char]) functions are the semantic definitions, the other -- implementation are tested against these. except intercalate, which -- returns Maybe (the corresponding restrictions for the unlines and -- unwords functions are not enforced) -- -- performance can be improved by using the "native" functions could be -- expanded module Uniform.Strings.Utilities -- | a minimal algebraic type with nothing than an identity useful to -- identify a specific value in a type class Zeros z zero :: Zeros z => z isZero :: Zeros z => z -> Bool notZero :: Zeros z => z -> Bool type family LF l class (Monoid l, Zeros LF l) => ListForms l where { type family LF l; } prependOne :: ListForms l => LF l -> l -> l appendOne :: ListForms l => l -> LF l -> l mkOne :: ListForms l => LF l -> l appendTwo :: ListForms l => l -> l -> l class (Zeros a, ListForms a, Eq a) => CharChains a toString :: CharChains a => a -> String -- | conversion toText :: (CharChains a, Show a) => a -> Text unwords' :: CharChains a => [a] -> a words' :: CharChains a => a -> [a] unlines' :: CharChains a => [a] -> a lines' :: CharChains a => a -> [a] append' :: CharChains a => a -> a -> a append :: CharChains a => a -> a -> a null' :: CharChains a => a -> Bool mknull :: CharChains a => a -- | convert the string to lowercase, idempotent is not inverse of toUpper toLower' :: CharChains a => a -> a -- | is not idempotent and gives different results for string and text (sz -- and similar ligatures) toUpper' :: CharChains a => a -> a isPrefixOf' :: CharChains a => a -> a -> Bool isInfixOf' :: CharChains a => a -> a -> Bool isPostfixOf' :: CharChains a => a -> a -> Bool -- | takes the prefix away, if present (and return rest). nothing if no -- prefix stripPrefix' :: CharChains a => a -> a -> Maybe a stripSuffix' :: CharChains a => a -> a -> Maybe a concat' :: CharChains a => [a] -> a -- | removes all spaces front and back, idempotent trim' :: CharChains a => a -> a reverseString :: CharChains a => a -> a reverse' :: CharChains a => a -> a -- | remove last char removeLast :: CharChains a => a -> a -- | remove a character from a string removeChar :: CharChains a => Char -> a -> a filterChar :: CharChains a => (Char -> Bool) -> a -> a lengthChar :: CharChains a => a -> Int nubChar :: CharChains a => a -> a drop' :: CharChains a => Int -> a -> a -- | add a splitAt or dropN function take' :: CharChains a => Int -> a -> a -- | splitOn' and intercalate' are inverses (see Data.SplitList) returns -- Nothing if second is empty and intercalate "x" "" gives Just "" return -- Nothing if first is empty or contained in second to achievee inverse -- with splitOn intercalate' :: CharChains a => a -> [a] -> Maybe a -- | splits the first by all occurences of the second the second is removed -- from results returns Nothing if second is empty splitOn' :: CharChains a => a -> a -> Maybe [a] -- | formats a string accoding to a pattern - restricted to a single string -- (perhaps) requires type of argument fixed! printf' :: (CharChains a, PrintfArg r) => String -> r -> a replace' :: CharChains a => a -> a -> a -> a readMaybe' :: (CharChains a, Read b) => a -> Maybe b prop_filterChar :: CharChains a => a -> Bool class CharChains2 x a show' :: CharChains2 x a => x -> a class NiceStrings a shownice :: NiceStrings a => a -> Text showNice :: NiceStrings a => a -> Text showlong :: NiceStrings a => a -> Text unlinesT :: [Text] -> Text -- | to fix types for overloaded strings unwordsT :: [Text] -> Text wordsT :: Text -> [Text] concatT :: [Text] -> Text showT :: Show a => a -> Text -- | read a Text into a specific format readNoteT :: Read a => Text -> Text -> a -- | read a Text into a specific format readNoteTs :: (Show a, Read a) => [Text] -> Text -> a sortCaseInsensitive :: (Ord a, CharChains a) => [a] -> [a] cmpCaseInsensitive :: (Ord a, CharChains a) => a -> a -> Ordering maybe2string :: IsString s => Maybe s -> s -- | show a collection of lines showList' :: Show a => [a] -> Text putIOwords :: MonadIO m => [Text] -> m () -- | print the texts when the bool is true (flag debug) debugPrint :: MonadIO m => Bool -> [Text] -> m () -- | O(n) Convert a string to title case, using simple case -- conversion. Subject to fusion. -- -- The first letter of the input is converted to title case, as is every -- subsequent letter that immediately follows a non-letter. Every letter -- that immediately follows another letter is converted to lower case. -- -- The result string may be longer than the input string. For example, -- the Latin small ligature fl (U+FB02) is converted to the sequence Latin -- capital letter F (U+0046) followed by Latin small letter l (U+006C). -- -- Note: this function does not take language or culture specific -- rules into account. For instance, in English, different style guides -- disagree on whether the book name "The Hill of the Red Fox" is -- correctly title cased—but this function will capitalize every -- word. toTitle :: Text -> Text -- | convert the first character to lowercase - for Properties in RDF toLowerStart :: Text -> Text -- | convert the first character to Uppercase - for PosTags in Spanish toUpperStart :: Text -> Text prop_filterChar :: CharChains a => a -> Bool -- | Returns True for any Unicode space character, and the control -- characters \t, \n, \r, \f, -- \v. isSpace :: Char -> Bool -- | Selects lower-case alphabetic Unicode characters (letters). isLower :: Char -> Bool class Show a => PrettyStrings a showPretty :: PrettyStrings a => a -> Text -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs: -- --
--   dropWhile (< 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]
--   dropWhile (< 9) [1,2,3] == []
--   dropWhile (< 0) [1,2,3] == [1,2,3]
--   
dropWhile :: (a -> Bool) -> [a] -> [a] -- | takeWhile, applied to a predicate p and a list -- xs, returns the longest prefix (possibly empty) of -- xs of elements that satisfy p: -- --
--   takeWhile (< 3) [1,2,3,4,1,2,3,4] == [1,2]
--   takeWhile (< 9) [1,2,3] == [1,2,3]
--   takeWhile (< 0) [1,2,3] == []
--   
takeWhile :: (a -> Bool) -> [a] -> [a] -- | span, applied to a predicate p and a list xs, -- returns a tuple where first element is longest prefix (possibly empty) -- of xs of elements that satisfy p and second element -- is the remainder of the list: -- --
--   span (< 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
--   span (< 9) [1,2,3] == ([1,2,3],[])
--   span (< 0) [1,2,3] == ([],[1,2,3])
--   
-- -- span p xs is equivalent to (takeWhile p xs, -- dropWhile p xs) span :: (a -> Bool) -> [a] -> ([a], [a]) -- | break, applied to a predicate p and a list -- xs, returns a tuple where first element is longest prefix -- (possibly empty) of xs of elements that do not satisfy -- p and second element is the remainder of the list: -- --
--   break (> 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
--   break (< 9) [1,2,3] == ([],[1,2,3])
--   break (> 9) [1,2,3] == ([1,2,3],[])
--   
-- -- break p is equivalent to span (not . -- p). break :: (a -> Bool) -> [a] -> ([a], [a]) formatInt :: Int -> Int -> Text instance GHC.Show.Show a => Uniform.Strings.Utilities.PrettyStrings a instance Uniform.Strings.Utilities.NiceStrings Data.Text.Internal.Text instance Uniform.Strings.Utilities.NiceStrings GHC.Types.Int instance Uniform.Strings.Utilities.NiceStrings GHC.Types.Double instance (Uniform.Strings.Utilities.NiceStrings a, Uniform.Strings.Utilities.NiceStrings b) => Uniform.Strings.Utilities.NiceStrings (a, b) instance Uniform.Strings.Utilities.NiceStrings a => Uniform.Strings.Utilities.NiceStrings [a] instance Uniform.Strings.Utilities.NiceStrings a => Uniform.Strings.Utilities.NiceStrings (GHC.Maybe.Maybe a) instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Int GHC.Base.String instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Bool GHC.Base.String instance Uniform.Strings.Utilities.CharChains2 () GHC.Base.String instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Int Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Bool Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 () Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Float GHC.Base.String instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Float Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Double GHC.Base.String instance Uniform.Strings.Utilities.CharChains2 GHC.Types.Double Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 Data.Text.Internal.Text Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 GHC.Base.String Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains2 Data.Text.Internal.Text GHC.Base.String instance Uniform.Strings.Utilities.CharChains2 GHC.Base.String GHC.Base.String instance (GHC.Show.Show a, GHC.Show.Show b) => Uniform.Strings.Utilities.CharChains2 (a, b) GHC.Base.String instance (GHC.Show.Show a, GHC.Show.Show b) => Uniform.Strings.Utilities.CharChains2 (a, b) Data.Text.Internal.Text instance GHC.Show.Show a => Uniform.Strings.Utilities.CharChains2 [a] GHC.Base.String instance GHC.Show.Show a => Uniform.Strings.Utilities.CharChains2 [a] Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains GHC.Base.String instance Uniform.Strings.Utilities.CharChains Data.Text.Internal.Text instance Uniform.Strings.Utilities.CharChains Uniform.Strings.Conversion.LazyByteString instance Uniform.Strings.Utilities.CharChains Uniform.Strings.Conversion.BSUTF instance Uniform.Zero.Zeros Data.Text.Internal.Text instance Uniform.ListForm.ListForms Data.Text.Internal.Text instance Uniform.ListForm.ListForms GHC.Base.String instance Uniform.ListForm.ListForms Uniform.Strings.Conversion.LazyByteString instance Uniform.ListForm.ListForms Uniform.Strings.Conversion.BSUTF module Uniform.Strings.Infix -- | append text with colon in between (<:>) :: Text -> Text -> Text (<+>) :: Text -> Text -> Text -- | append text with dash in between (<->) :: Text -> Text -> Text -- | append text with slash in between () :: Text -> Text -> Text -- | append text with dot in between (<.>) :: Text -> Text -> Text (<#>) :: Text -> Text -> Text -- | append text with blank in between, (a character does not work as name) -- possible conflict with parsec (<|>) :: Text -> Text -> Text -- | insert text in .. wrapInSpitz :: Text -> Text -- | insert text in .. wrapInDoubleQuotes :: Text -> Text -- | insert text in .. wrapInBraces :: Text -> Text addXatEnd :: (IsString s, CharChains s) => s -> s -> s -- | a top module exporting the operations in the package module Uniform.Strings -- | append text with colon in between (<:>) :: Text -> Text -> Text (<+>) :: Text -> Text -> Text -- | append text with dash in between (<->) :: Text -> Text -> Text (<#>) :: Text -> Text -> Text -- | append text with blank in between, (a character does not work as name) -- possible conflict with parsec (<|>) :: Text -> Text -> Text -- | insert text in .. wrapInSpitz :: Text -> Text -- | insert text in .. wrapInDoubleQuotes :: Text -> Text -- | insert text in .. wrapInBraces :: Text -> Text addXatEnd :: (IsString s, CharChains s) => s -> s -> s -- | Class for string-like datastructures; used by the overloaded string -- extension (-XOverloadedStrings in GHC). class IsString a fromString :: IsString a => String -> a -- | unlines is an inverse operation to lines. It joins -- lines, after appending a terminating newline to each. -- --
--   >>> unlines ["Hello", "World", "!"]
--   "Hello\nWorld\n!\n"
--   
unlines :: [String] -> String -- | lines breaks a string up into a list of strings at newline -- characters. The resulting strings do not contain newlines. -- -- Note that after splitting the string at newline characters, the last -- part of the string is considered a line even if it doesn't end with a -- newline. For example, -- --
--   >>> lines ""
--   []
--   
-- --
--   >>> lines "\n"
--   [""]
--   
-- --
--   >>> lines "one"
--   ["one"]
--   
-- --
--   >>> lines "one\n"
--   ["one"]
--   
-- --
--   >>> lines "one\n\n"
--   ["one",""]
--   
-- --
--   >>> lines "one\ntwo"
--   ["one","two"]
--   
-- --
--   >>> lines "one\ntwo\n"
--   ["one","two"]
--   
-- -- Thus lines s contains at least as many elements as -- newlines in s. lines :: String -> [String] -- | A String is a list of characters. String constants in Haskell -- are values of type String. -- -- See Data.List for operations on lists. type String = [Char] -- | unwords is an inverse operation to words. It joins words -- with separating spaces. -- --
--   >>> unwords ["Lorem", "ipsum", "dolor"]
--   "Lorem ipsum dolor"
--   
unwords :: [String] -> String -- | words breaks a string up into a list of words, which were -- delimited by white space. -- --
--   >>> words "Lorem ipsum\ndolor"
--   ["Lorem","ipsum","dolor"]
--   
words :: String -> [String] putIOwords :: MonadIO m => [Text] -> m () class NiceStrings a shownice :: NiceStrings a => a -> Text showNice :: NiceStrings a => a -> Text showlong :: NiceStrings a => a -> Text -- | Class for string-like datastructures; used by the overloaded string -- extension (-XOverloadedStrings in GHC). class IsString a fromString :: IsString a => String -> a type family LF l class (Monoid l, Zeros LF l) => ListForms l where { type family LF l; } prependOne :: ListForms l => LF l -> l -> l appendOne :: ListForms l => l -> LF l -> l mkOne :: ListForms l => LF l -> l appendTwo :: ListForms l => l -> l -> l -- | Pretty print something that may be converted to a list as a list. Each -- entry is on a separate line, which means that we don't do clever -- pretty printing, and so this works well for large strucutures. ppShowList :: (Foldable f, Show a) => f a -> String -- | Convert a generic value into a pretty String, if possible. ppShow :: Show a => a -> String