tagsoup-0.13.3: Parsing and extracting information from (possibly malformed) HTML/XML documents

Safe HaskellSafe-Inferred
LanguageHaskell98

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) => StringLike a where

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

Methods

empty :: a

empty = ""

cons :: Char -> a -> a

cons = (:)

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

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

toString :: a -> String

toString = id

fromString :: String -> a

fromString = id

fromChar :: Char -> a

fromChar = return

strConcat :: [a] -> a

strConcat = concat

strNull :: a -> Bool

strNull = null

append :: a -> a -> a

append = (++)

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

Convert a String from one type to another.