regex-do-3.0.1: PCRE wrapper

Safe HaskellSafe
LanguageHaskell2010

Text.Regex.Do.Type.MatchHint

Documentation

newtype Test a Source #

Constructors

Test a

test: does body match pattern?

Instances

Hint Test Source # 

Methods

unhint :: Test a -> a Source #

hint :: a -> Test a Source #

newtype Once a Source #

Constructors

Once a

replace once

Instances

Functor Once Source # 

Methods

fmap :: (a -> b) -> Once a -> Once b #

(<$) :: a -> Once b -> Once a #

Applicative Once Source # 

Methods

pure :: a -> Once a #

(<*>) :: Once (a -> b) -> Once a -> Once b #

(*>) :: Once a -> Once b -> Once b #

(<*) :: Once a -> Once b -> Once a #

Hint Once Source # 

Methods

unhint :: Once a -> a Source #

hint :: a -> Once a Source #

(RegexLike Regex b, Replace Maybe repl b) => Replace Once Regex repl b b Source #

succeeds unless GroupReplacer fails due to mismatched pattern etc

repl: String | ByteString | GroupReplacer repl

Methods

replace :: Once Regex -> repl -> b -> b Source #

Replace Maybe repl ByteString => Replace Once Regex repl ByteString ByteString Source #

succeeds unless GroupReplacer fails due to mismatched pattern etc

repl: ByteString | GroupReplacer ByteString

Methods

replace :: Once Regex -> repl -> ByteString -> ByteString Source #

Replace Once Regex String String String Source #

always succeeds

(RegexLike Regex b, Regex b) => Replace Once b b b (E b) Source #

b: String | ByteString

Methods

replace :: Once b -> b -> b -> E b Source #

Replace Once String String String (E String) Source # 
Replace Once ByteString ByteString ByteString (E ByteString) Source # 
(RegexLike Regex b, Regex b) => Replace Once b (GroupReplacer b) b (E b) Source #

b: String | ByteString

Methods

replace :: Once b -> GroupReplacer b -> b -> E b Source #

Replace Once ByteString (GroupReplacer ByteString) ByteString (E ByteString) Source # 

newtype All a Source #

Constructors

All a

replace all

Instances

Functor All Source # 

Methods

fmap :: (a -> b) -> All a -> All b #

(<$) :: a -> All b -> All a #

Applicative All Source # 

Methods

pure :: a -> All a #

(<*>) :: All (a -> b) -> All a -> All b #

(*>) :: All a -> All b -> All b #

(<*) :: All a -> All b -> All a #

Hint All Source # 

Methods

unhint :: All a -> a Source #

hint :: a -> All a Source #

(RegexLike Regex b, Replace [] repl b) => Replace All Regex repl b b Source #

succeeds unless GroupReplacer fails due to mismatched pattern etc

repl: String | ByteString | GroupReplacer repl

Methods

replace :: All Regex -> repl -> b -> b Source #

Replace [] repl ByteString => Replace All Regex repl ByteString ByteString Source #

succeeds unless GroupReplacer fails due to mismatched pattern etc

repl: ByteString | GroupReplacer ByteString

Methods

replace :: All Regex -> repl -> ByteString -> ByteString Source #

Replace All Regex String String String Source #

always succeeds

(RegexLike Regex b, Regex b) => Replace All b b b (E b) Source #

b: String | ByteString

Methods

replace :: All b -> b -> b -> E b Source #

Replace All String String String (E String) Source # 
Replace All ByteString ByteString ByteString (E ByteString) Source # 
(RegexLike Regex b, Regex b) => Replace All b (GroupReplacer b) b (E b) Source #

b: String | ByteString

Methods

replace :: All b -> GroupReplacer b -> b -> E b Source #

Replace All ByteString (GroupReplacer ByteString) ByteString (E ByteString) Source #
replacer::GroupReplacer ByteString
replacer = defaultReplacer 1 tweak1
      where tweak1 bs1 = toByteString' $
                        if bs1 == toByteString "左" then
                              "ー右ー"
                               else "?"


    runFn1 `shouldBe` toByteString "100メートルー右ー折後、左"
        where runFn1 = let rx1 = toByteString "(?<=ル)(左)"
                           body1 = toByteString "100メートル左折後、左"
                       in replace (All rx1) replacer body1    

newtype PosLen' a Source #

Constructors

PosLen' a

once

Instances

Hint PosLen' Source # 

Methods

unhint :: PosLen' a -> a Source #

hint :: a -> PosLen' a Source #

newtype PosLen_ a Source #

Constructors

PosLen_ a

all

Instances

Hint PosLen_ Source # 

Methods

unhint :: PosLen_ a -> a Source #

hint :: a -> PosLen_ a Source #

class Hint hint where Source #

Minimal complete definition

unhint, hint

Methods

unhint :: hint a -> a Source #

hint :: a -> hint a Source #

Instances

Hint PosLen_ Source # 

Methods

unhint :: PosLen_ a -> a Source #

hint :: a -> PosLen_ a Source #

Hint PosLen' Source # 

Methods

unhint :: PosLen' a -> a Source #

hint :: a -> PosLen' a Source #

Hint All Source # 

Methods

unhint :: All a -> a Source #

hint :: a -> All a Source #

Hint Once Source # 

Methods

unhint :: Once a -> a Source #

hint :: a -> Once a Source #

Hint Test Source # 

Methods

unhint :: Test a -> a Source #

hint :: a -> Test a Source #