-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | String class library -- -- String class library. @package string-class @version 0.1.7.1 module Data.String.Class -- | String super class class (StringCells s, StringRWIO s) => Stringy s -- | Minimal complete definition: StringCellChar; StringCellAltChar; -- toStringCells; fromStringCells; toMainChar; toAltChar; cons; snoc; -- either all of head, tail, last, and init, or all of uncons and unsnoc; -- take, take64 or genericTake; drop, drop64, or genericDrop; and length, -- length64, or genericLength class (Eq s, Monoid s, IsString s, Typeable s, StringCell (StringCellChar s), StringCell (StringCellAltChar s), ConvGenString s, ConvString s, ConvStrictByteString s, ConvLazyByteString s, ConvText s, ConvLazyText s) => StringCells s where { type StringCellChar s; type StringCellAltChar s; } toStringCells :: (StringCells s, StringCells s2) => s -> s2 fromStringCells :: (StringCells s, StringCells s2) => s2 -> s cons :: StringCells s => StringCellChar s -> s -> s uncons :: StringCells s => s -> (StringCellChar s, s) snoc :: StringCells s => s -> StringCellChar s -> s unsnoc :: StringCells s => s -> (s, StringCellChar s) altCons :: StringCells s => StringCellAltChar s -> s -> s altUncons :: StringCells s => s -> (StringCellAltChar s, s) altSnoc :: StringCells s => s -> StringCellAltChar s -> s altUnsnoc :: StringCells s => s -> (s, StringCellAltChar s) toMainChar :: (StringCells s, StringCell c) => c -> Tagged s (StringCellChar s) toAltChar :: (StringCells s, StringCell c) => c -> Tagged s (StringCellAltChar s) -- | Append two strings append :: StringCells s => s -> s -> s concat :: StringCells s => [s] -> s empty :: StringCells s => s null :: StringCells s => s -> Bool head :: StringCells s => s -> StringCellChar s tail :: StringCells s => s -> s last :: StringCells s => s -> StringCellChar s init :: StringCells s => s -> s altHead :: StringCells s => s -> StringCellAltChar s altLast :: StringCells s => s -> StringCellAltChar s -- | Construction of a string; implementations should behave safely with -- incorrect lengths -- -- The default implementation of unfoldr is independent from that -- of altUnfoldr, as well as unfoldrN as and -- altUnfoldrN. unfoldr :: StringCells s => (a -> Maybe (StringCellChar s, a)) -> a -> s altUnfoldr :: StringCells s => (a -> Maybe (StringCellAltChar s, a)) -> a -> s unfoldrN :: StringCells s => Int -> (a -> Maybe (StringCellChar s, a)) -> a -> s altUnfoldrN :: StringCells s => Int -> (a -> Maybe (StringCellAltChar s, a)) -> a -> s unfoldrN64 :: StringCells s => Int64 -> (a -> Maybe (StringCellChar s, a)) -> a -> s altUnfoldrN64 :: StringCells s => Int64 -> (a -> Maybe (StringCellAltChar s, a)) -> a -> s -- | Get the character at the given position -- -- Just like drop, drop64, and the variants of those -- functions, the default definitions of these three variants are -- independent of each other, and are defined in terms of head and -- tail, which can be inefficient. index :: StringCells s => s -> Int -> StringCellChar s index64 :: StringCells s => s -> Int64 -> StringCellChar s -- | Index a string at any location -- -- Just like the other generic functions of this module, this -- function can be significantly slower than index, since the -- function must be able to support arbitrarily large indices. Consider -- using index or index64, even if you need to coerce the -- index to an Int. genericIndex :: (StringCells s, Integral i) => s -> i -> StringCellChar s take :: StringCells s => Int -> s -> s take64 :: StringCells s => Int64 -> s -> s genericTake :: (StringCells s, Integral i) => i -> s -> s drop :: StringCells s => Int -> s -> s drop64 :: StringCells s => Int64 -> s -> s genericDrop :: (StringCells s, Integral i) => i -> s -> s length :: StringCells s => s -> Int length64 :: StringCells s => s -> Int64 genericLength :: (StringCells s, Integral i) => s -> i safeUncons :: StringCells s => s -> Maybe (StringCellChar s, s) safeUnsnoc :: StringCells s => s -> Maybe (s, StringCellChar s) safeAltUncons :: StringCells s => s -> Maybe (StringCellAltChar s, s) safeAltUnsnoc :: StringCells s => s -> Maybe (s, StringCellAltChar s) safeHead :: StringCells s => s -> Maybe (StringCellChar s) safeTail :: StringCells s => s -> Maybe s safeLast :: StringCells s => s -> Maybe (StringCellChar s) safeInit :: StringCells s => s -> Maybe s safeAltHead :: StringCells s => s -> Maybe (StringCellAltChar s) safeAltLast :: StringCells s => s -> Maybe (StringCellAltChar s) safeIndex :: StringCells s => s -> Int -> Maybe (StringCellChar s) safeIndex64 :: StringCells s => s -> Int64 -> Maybe (StringCellChar s) safeGenericIndex :: (StringCells s, Integral i) => s -> i -> Maybe (StringCellChar s) safeTake :: StringCells s => Int -> s -> Maybe s safeTake64 :: StringCells s => Int64 -> s -> Maybe s safeGenericTake :: (StringCells s, Integral i) => i -> s -> Maybe s safeDrop :: StringCells s => Int -> s -> Maybe s safeDrop64 :: StringCells s => Int64 -> s -> Maybe s safeGenericDrop :: (StringCells s, Integral i) => i -> s -> Maybe s safeUncons2 :: StringCells s => s -> Maybe (StringCellChar s, StringCellChar s, s) safeUncons3 :: StringCells s => s -> Maybe (StringCellChar s, StringCellChar s, StringCellChar s, s) safeUncons4 :: StringCells s => s -> Maybe (StringCellChar s, StringCellChar s, StringCellChar s, StringCellChar s, s) cons2 :: StringCells s => StringCellChar s -> StringCellChar s -> s -> s cons3 :: StringCells s => StringCellChar s -> StringCellChar s -> StringCellChar s -> s -> s cons4 :: StringCells s => StringCellChar s -> StringCellChar s -> StringCellChar s -> StringCellChar s -> s -> s uncons2 :: StringCells s => s -> (StringCellChar s, StringCellChar s, s) uncons3 :: StringCells s => s -> (StringCellChar s, StringCellChar s, StringCellChar s, s) uncons4 :: StringCells s => s -> (StringCellChar s, StringCellChar s, StringCellChar s, StringCellChar s, s) infixr 9 `uncons` infixr 9 `append` infixr 9 `cons` infixr 9 `altCons` infixr 9 `altUncons` infixr 9 `cons2` infixr 9 `cons3` infixr 9 `cons4` infixr 9 `uncons2` infixr 9 `uncons3` infixr 9 `uncons4` class StringCell c toChar :: StringCell c => c -> Char toWord8 :: StringCell c => c -> Word8 toWord16 :: StringCell c => c -> Word16 toWord32 :: StringCell c => c -> Word32 toWord64 :: StringCell c => c -> Word64 fromChar :: StringCell c => Char -> c fromWord8 :: StringCell c => Word8 -> c fromWord16 :: StringCell c => Word16 -> c fromWord32 :: StringCell c => Word32 -> c fromWord64 :: StringCell c => Word64 -> c -- | Minimal complete definition: hGetContents, hGetLine, -- hPutStr, and hPutStrLn class StringRWIO s -- | Read n bytes *or* characters, depending on the implementation into a -- ByteString, directly from the specified Handle -- -- Whether or not this function is lazy depends on the instance; laziness -- is preferred. hGetContents :: StringRWIO s => Handle -> IO s -- | Read a single line from a handle hGetLine :: StringRWIO s => Handle -> IO s -- | Write a string to a handle hPutStr :: StringRWIO s => Handle -> s -> IO () -- | Write a string to a handle, followed by a newline -- -- N.B.: implementations might not define this atomically. If the state -- of being atomic is necessary, one possible solution is to convert a -- string to an efficient type for which hPutStrLn is atomic. hPutStrLn :: StringRWIO s => Handle -> s -> IO () -- | Take a function of type Text -> Text as its argument -- -- The entire input from the standard input device is passed to this -- function as its argument, and the resulting string is output on the -- standard output device. interact :: StringRWIO s => (s -> s) -> IO () -- | Read all user input on stdin as a single string getContents :: StringRWIO s => IO s -- | Read a single line of user input from stdin getLine :: StringRWIO s => IO s -- | Write a string to stdout putStr :: StringRWIO s => s -> IO () -- | Write a string to stdout, followed by a newline putStrLn :: StringRWIO s => s -> IO () -- | Read a file and returns the contents of the file as a string -- -- Depending on the instance, this function might expect the file to be -- non-binary. The default definition uses openFile to open the -- file. readFile :: StringRWIO s => FilePath -> IO s -- | Write a string to a file -- -- The file is truncated to zero length before writing begins. The -- default definition uses withFile to open the file. writeFile :: StringRWIO s => FilePath -> s -> IO () -- | Write a string to the end of a file -- -- The default definition uses withFile to open the file. appendFile :: StringRWIO s => FilePath -> s -> IO () class ConvGenString s toGenString :: ConvGenString s => s -> GenString fromGenString :: ConvGenString s => GenString -> s class ConvString s toString :: ConvString s => s -> String fromString :: ConvString s => String -> s class ConvStrictByteString s toStrictByteString :: ConvStrictByteString s => s -> ByteString fromStrictByteString :: ConvStrictByteString s => ByteString -> s class ConvLazyByteString s toLazyByteString :: ConvLazyByteString s => s -> ByteString fromLazyByteString :: ConvLazyByteString s => ByteString -> s class ConvText s toText :: ConvText s => s -> Text fromText :: ConvText s => Text -> s -- | Polymorphic container of a string -- -- When operations take place on multiple GenStrings, they are -- first converted to the type GenStringDefault, which are lazy -- bytestrings, whenever absolutely necessary (which includes testing for -- equality, appending strings, concatenating lists of strings, empty -- strings with empty, and unfolding), making them the most -- efficient type for this polymorphic container. data GenString GenString :: s -> GenString [gen_string] :: GenString -> s -- | This type is used by GenString when a concrete string type is -- needed type GenStringDefault = ByteString instance GHC.Base.Monoid Data.String.Class.GenString instance Data.String.Class.StringCells Data.String.Class.GenString instance (Data.String.Class.StringCells s, Data.String.Class.StringRWIO s) => Data.String.Class.Stringy s instance Data.String.Class.StringCells GHC.Base.String instance Data.String.Class.StringCells Data.ByteString.Internal.ByteString instance Data.String.Class.StringCells Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.StringCells Data.Text.Internal.Text instance Data.String.Class.StringCells Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvGenString Data.String.Class.GenString instance Data.String.Class.ConvGenString GHC.Base.String instance Data.String.Class.ConvGenString Data.ByteString.Internal.ByteString instance Data.String.Class.ConvGenString Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.ConvGenString Data.Text.Internal.Text instance Data.String.Class.ConvGenString Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvString Data.String.Class.GenString instance Data.String.Class.ConvStrictByteString Data.String.Class.GenString instance Data.String.Class.ConvLazyByteString Data.String.Class.GenString instance Data.String.Class.ConvText Data.String.Class.GenString instance Data.String.Class.ConvLazyText Data.String.Class.GenString instance Data.String.Class.StringRWIO Data.String.Class.GenString instance Data.String.Class.StringRWIO Data.ByteString.Lazy.Internal.ByteString instance GHC.Classes.Eq Data.String.Class.GenString instance Data.String.IsString Data.String.Class.GenString instance GHC.Base.Semigroup Data.String.Class.GenString instance Data.String.Class.StringRWIO GHC.Base.String instance Data.String.Class.StringRWIO Data.ByteString.Internal.ByteString instance Data.String.Class.StringRWIO Data.Text.Internal.Text instance Data.String.Class.StringRWIO Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvStrictByteString Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvLazyByteString Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvText Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvLazyText GHC.Base.String instance Data.String.Class.ConvLazyText Data.ByteString.Internal.ByteString instance Data.String.Class.ConvLazyText Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.ConvLazyText Data.Text.Internal.Text instance Data.String.Class.ConvLazyText Data.Text.Internal.Lazy.Text instance Data.String.Class.ConvStrictByteString Data.Text.Internal.Text instance Data.String.Class.ConvLazyByteString Data.Text.Internal.Text instance Data.String.Class.ConvText GHC.Base.String instance Data.String.Class.ConvText Data.ByteString.Internal.ByteString instance Data.String.Class.ConvText Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.ConvText Data.Text.Internal.Text instance Data.String.Class.ConvStrictByteString Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.ConvLazyByteString GHC.Base.String instance Data.String.Class.ConvLazyByteString Data.ByteString.Internal.ByteString instance Data.String.Class.ConvLazyByteString Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.ConvStrictByteString GHC.Base.String instance Data.String.Class.ConvStrictByteString Data.ByteString.Internal.ByteString instance Data.String.Class.ConvString GHC.Base.String instance Data.String.Class.ConvString Data.ByteString.Internal.ByteString instance Data.String.Class.ConvString Data.ByteString.Lazy.Internal.ByteString instance Data.String.Class.ConvString Data.Text.Internal.Text instance Data.String.Class.ConvString Data.Text.Internal.Lazy.Text instance Data.String.Class.StringCell GHC.Types.Char instance Data.String.Class.StringCell GHC.Word.Word8 instance Data.String.Class.StringCell GHC.Word.Word16 instance Data.String.Class.StringCell GHC.Word.Word32 instance Data.String.Class.StringCell GHC.Word.Word64