tagsoup-0.14.8: Parsing and extracting information from (possibly malformed) HTML/XML documents
Safe HaskellSafe
LanguageHaskell2010

Text.StringLike

Description

WARNING: This module is not intended for use outside the TagSoup library.

This module provides an abstraction for String's as used inside TagSoup. It allows TagSoup to work with String (list of Char), ByteString.Char8, ByteString.Lazy.Char8, Data.Text and Data.Text.Lazy.

Synopsis

Documentation

class (Typeable a, Eq a, IsString a) => StringLike a where Source #

A class to generalise TagSoup parsing over many types of string-like types. Examples are given for the String type.

Methods

empty :: a Source #

empty = ""

cons :: Char -> a -> a Source #

cons = (:)

uncons :: a -> Maybe (Char, a) Source #

uncons []     = Nothing
uncons (x:xs) = Just (x, xs)

toString :: a -> String Source #

toString = id

fromChar :: Char -> a Source #

fromChar = return

strConcat :: [a] -> a Source #

strConcat = concat

strNull :: a -> Bool Source #

strNull = null

append :: a -> a -> a Source #

append = (++)

strMap :: (Char -> Char) -> a -> a Source #

strMap = map

Instances

Instances details
StringLike String Source # 
Instance details

Defined in Text.StringLike

Methods

empty :: String Source #

cons :: Char -> String -> String Source #

uncons :: String -> Maybe (Char, String) Source #

toString :: String -> String Source #

fromChar :: Char -> String Source #

strConcat :: [String] -> String Source #

strNull :: String -> Bool Source #

append :: String -> String -> String Source #

strMap :: (Char -> Char) -> String -> String Source #

StringLike ByteString Source # 
Instance details

Defined in Text.StringLike

Methods

empty :: ByteString Source #

cons :: Char -> ByteString -> ByteString Source #

uncons :: ByteString -> Maybe (Char, ByteString) Source #

toString :: ByteString -> String Source #

fromChar :: Char -> ByteString Source #

strConcat :: [ByteString] -> ByteString Source #

strNull :: ByteString -> Bool Source #

append :: ByteString -> ByteString -> ByteString Source #

strMap :: (Char -> Char) -> ByteString -> ByteString Source #

StringLike ByteString Source # 
Instance details

Defined in Text.StringLike

Methods

empty :: ByteString Source #

cons :: Char -> ByteString -> ByteString Source #

uncons :: ByteString -> Maybe (Char, ByteString) Source #

toString :: ByteString -> String Source #

fromChar :: Char -> ByteString Source #

strConcat :: [ByteString] -> ByteString Source #

strNull :: ByteString -> Bool Source #

append :: ByteString -> ByteString -> ByteString Source #

strMap :: (Char -> Char) -> ByteString -> ByteString Source #

StringLike Text Source # 
Instance details

Defined in Text.StringLike

Methods

empty :: Text Source #

cons :: Char -> Text -> Text Source #

uncons :: Text -> Maybe (Char, Text) Source #

toString :: Text -> String Source #

fromChar :: Char -> Text Source #

strConcat :: [Text] -> Text Source #

strNull :: Text -> Bool Source #

append :: Text -> Text -> Text Source #

strMap :: (Char -> Char) -> Text -> Text Source #

StringLike Text Source # 
Instance details

Defined in Text.StringLike

Methods

empty :: Text Source #

cons :: Char -> Text -> Text Source #

uncons :: Text -> Maybe (Char, Text) Source #

toString :: Text -> String Source #

fromChar :: Char -> Text Source #

strConcat :: [Text] -> Text Source #

strNull :: Text -> Bool Source #

append :: Text -> Text -> Text Source #

strMap :: (Char -> Char) -> Text -> Text Source #

fromString :: IsString a => String -> a #

castString :: (StringLike a, StringLike b) => a -> b Source #

Convert a String from one type to another.