regex-do-2.5: PCRE wrapper

Safe HaskellNone
LanguageHaskell2010

Text.Regex.Do.Pcre.Ascii.MatchHint

Description

this module uses TypeFamilies

this module is similar to Text.Regex.Do.Pcre.Ascii.Match. The differences are:

Text.Regex.Do.Pcre.Ascii.Match is more flexible: accepts Pattern Regex, accepts Pattern and Body of different types

Text.Regex.Do.Pcre.Ascii.Match needs to infer result type

in this module the result type is determined by the hint

Synopsis

Documentation

class (Hint hint, Match a a (F hint a)) => MatchHint hint a where Source

picks Match instance where Pattern and Body are of the same type

Hint and inferrable Pattern or Body type determine the instance

handy when working with OverloadedStrings, in other cases when compiler needs a hint

Minimal complete definition

Nothing

Associated Types

type F hint a Source

Methods

match :: hint (Pattern a) -> Body a -> F hint a Source

(=~) Source

Arguments

:: hint a

hint & pattern

-> a

body

-> F hint a

type defined by the instance, determined by the hint

Instances

MatchHint PosLen_ String Source 
MatchHint PosLen_ ByteString Source 
MatchHint PosLen' String Source
>>> PosLen' ("и"::String) =~ "бывает и хуже"

[(13,2)]

MatchHint PosLen' ByteString Source 
MatchHint All String Source 
MatchHint All ByteString Source 
MatchHint Once String Source
>>> Once ("^all"::String) =~ "all the time"

["all"]

MatchHint Once ByteString Source 
MatchHint Test String Source 
MatchHint Test ByteString Source
>>> Test ("в"::ByteString) =~ "тихо в лесу"

True