reprinter-0.3.0.0: Scrap Your Reprinter
Safe HaskellSafe-Inferred
LanguageHaskell2010

Text.Reprinter.StringLike

Synopsis

Documentation

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

Data types that can be used as a list-like structure of Chars.

Clumsy solution to allow parameterising over the input type (Text, ByteString, String), rather than converting to and from an internal concrete type. Only operations required by the reprinting algorithm are included. Where possible, operations are prefilled using presumed-existing instances (any [Char]-like should be a monoid and have a String -> a).

Methods

slCons :: Char -> a -> a Source #

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

slNull :: a -> Bool Source #

slReverse :: a -> a Source #

slToString :: a -> String Source #

like unpack

Instances

Instances details
StringLike ByteString Source # 
Instance details

Defined in Text.Reprinter.StringLike

StringLike ByteString Source # 
Instance details

Defined in Text.Reprinter.StringLike

StringLike Text Source # 
Instance details

Defined in Text.Reprinter.StringLike

StringLike Text Source # 
Instance details

Defined in Text.Reprinter.StringLike

a ~ Char => StringLike [a] Source # 
Instance details

Defined in Text.Reprinter.StringLike

Methods

slCons :: Char -> [a] -> [a] Source #

slUncons :: [a] -> Maybe (Char, [a]) Source #

slNull :: [a] -> Bool Source #

slReverse :: [a] -> [a] Source #

slToString :: [a] -> String Source #

class IsString a where #

Class for string-like datastructures; used by the overloaded string extension (-XOverloadedStrings in GHC).

Methods

fromString :: String -> a #

Instances

Instances details
IsString ByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Lazy.Internal

IsString ByteString

Beware: fromString truncates multi-byte characters to octets. e.g. "枯朶に烏のとまりけり秋の暮" becomes �6k�nh~�Q��n�

Instance details

Defined in Data.ByteString.Internal

a ~ Char => IsString [a]

(a ~ Char) context was introduced in 4.9.0.0

Since: base-2.1

Instance details

Defined in Data.String

Methods

fromString :: String -> [a] #

IsString a => IsString (Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Identity a #

IsString a => IsString (Const a b)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Methods

fromString :: String -> Const a b #