-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A package that aims to provide a uniform interface to string-like types.
--
-- The package defines a typeclass that can be implemented to provide a
-- uniform interface for String-like objects.
--
-- The typeclass itself has default implementations that convert the
-- StringLike item first to a lazy Text, then performs
-- the operation, and converts results back to its StringLike
-- object. This is usually not as efficient as an operation for
-- that specific type. Therefore it is advisable to implement the other
-- functions as well. One can however decide to only implement
-- fromText and toText; or toString.
@package string-like
@version 0.1.0.0
-- | The module defines a typeclass that can be implemented to provide a
-- uniform interface for String-like objects (like String,
-- Text, etc.).
--
-- The typeclass itself has default implementations that convert the
-- StringLike item first to a lazy Text, then performs the
-- operation, and converts results back to its StringLike object.
-- This is usually not as efficient as an operation for that
-- specific type. Therefore it is advisable to implement the other
-- functions as well. One can however decide to only implement
-- fromText and toText; or toString.
--
-- The module contains instances for String, Text,
-- Text, ByteString and ByteString.
module Data.String.Like
-- | A typeclass that provides a uniform interface for string-like objects.
class IsString a => StringLike a
-- | Return an empty string-like object.
empty :: StringLike a => a
-- | Create a stringlike object by prepending a Char to an already
-- existing string-like object.
cons :: StringLike a => Char -> a -> a
-- | Create a stringlike object by appending a Char at the end of an
-- already existing string-like object.
snoc :: StringLike a => a -> Char -> a
-- | Unpack a stringlike object by obtaining the first character, and the
-- rest of the string, given the string is non-empty. Nothing
-- otherwise.
uncons :: StringLike a => a -> Maybe (Char, a)
-- | Unpack a string-like object by obtaining te last character, and the
-- string without the last character, given the string is non-empty.
-- Nothing otherwise.
unsnoc :: StringLike a => a -> Maybe (a, Char)
-- | Obtain the length of the string-like object.
length :: StringLike a => a -> Int
-- | Compare the length of the string with the given length. Returns
-- EQ if the string has the same length, LT if the string
-- is shorter, and GT if the string is longer. If the length is
-- not explicitly stored, this function can stop from the moment the
-- string-like object is exhausted, or the threshold has been reached.
compareLength :: StringLike a => a -> Int -> Ordering
-- | Convert the given string-like object to a String. If not
-- specified, it will use toText, and then unpack the Text
-- object in a String.
toString :: StringLike a => a -> String
-- | Convert a given Char to a string-like object containing the
-- single character.
fromChar :: StringLike a => Char -> a
-- | Concatenate the list of string-like objects to a string-like object.
strConcat :: StringLike a => [a] -> a
-- | Create a string-like object by mapping each character to another
-- string-like object, and concatenate these.
strConcatMap :: StringLike a => (Char -> a) -> a -> a
-- | Check if any of the Chars in the string-like object satisfy a
-- given condition.
strAny :: StringLike a => (Char -> Bool) -> a -> Bool
-- | Check if all of the Chars of the string-like object satisfy a
-- given condition.
strAll :: StringLike a => (Char -> Bool) -> a -> Bool
-- | Check if the given string is empty.
strNull :: StringLike a => a -> Bool
-- | Append two string-like objects to a new string-like object.
append :: StringLike a => a -> a -> a
-- | Map all the characters of a string-like object to a new string-like
-- object.
strMap :: StringLike a => (Char -> Char) -> a -> a
-- | Inserts the given string-like object in between the string-like
-- objects in the list. For example to make a comma-separated string.
intercalate :: StringLike a => a -> [a] -> a
-- | Inserts the given character in between the string-like objects in the
-- list. For example to make a string of words.
intersperse :: StringLike a => Char -> a -> a
-- | Transposes the rows and columns of the list of string-like objects.
transpose :: StringLike a => [a] -> [a]
-- | Calculate the reverse string of the given string.
reverse :: StringLike a => a -> a
-- | Convert the given string-like object to its lowercase equivalent.
toLower :: StringLike a => a -> a
-- | Convert the given string-like object to its uppercase equivalent.
toUpper :: StringLike a => a -> a
-- | Convert the given string-like object to its title-case equivalent.
toTitle :: StringLike a => a -> a
-- | Convert a Text object to the string-like object.
fromText :: StringLike a => Text -> a
-- | Convert the string-like object to an Text object.
toText :: StringLike 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
-- | Convert from one StringLike type to another StringLike
-- type. This is done through a lazy Text.
convertStringLike :: (StringLike a, StringLike b) => a -> b
instance Data.String.Like.StringLike [GHC.Types.Char]
instance Data.String.Like.StringLike Data.Text.Internal.Text
instance Data.String.Like.StringLike Data.Text.Internal.Lazy.Text
instance Data.String.Like.StringLike Data.ByteString.Internal.ByteString
instance Data.String.Like.StringLike Data.ByteString.Lazy.Internal.ByteString