:: Eq a => [a] -> [a] -> [a] -> [a] -package:graphviz -package:ascii-progress -package:MissingH
Replace a subsequence everywhere it occurs.
replace "el" "_" "Hello Bella" == "H_lo B_la"
replace "el" "e" "Hello" == "Helo"
replace "" "x" "Hello" == "xHxexlxlxox"
replace "" "x" "" == "x"
\xs ys -> replace xs xs ys == ys
\(NonEmpty xs) ys -> replace xs xs ys == (ys::String)
\(NonEmpty xs) (NonEmpty ys) -> equating (take 1000) (replace xs ys (cycle xs)) (cycle (ys::String))
Generalized version of
bracket_.
Note any monadic side effects in
m of
both the
"acquire" and "release" computations will be discarded. To keep the
monadic side effects of the "acquire" computation, use
bracket
with constant functions instead.
Note that when your
acquire and
release computations
are of type
IO it will be more efficient to write:
liftBaseOp_ (bracket_ acquire release)
between open close p parses
open, followed by
p and
close. Returns the value returned by
p.
braces = between (symbol "{") (symbol "}")
between open close p parses
open, followed by
p and
close. Returns the value returned by
p.
braces = between (symbol "{") (symbol "}")
Version of
bracket without any value being passed to the second
and third actions.
Same as
bracket, but does not pass the acquired resource to
cleanup and use functions.
For more information, see
base's
bracket_.
A variant of
bracketOnError where the return value from the
first computation is not required.
A variant of
bracketOnError where the return value from the
first computation is not required.
A variant of
bracketOnError where the return value from the
first computation is not required.
Parse a bracketed item, discarding the brackets. If everything matches
except the closing bracket, the whole parse fails soft, which
can give less-than-satisfying error messages. If you want better error
messages, try calling with e.g. bracket open (commit close)
item
A variant of
bracket where the return value from the first
computation is not required.
Generalized version of
bracket_. Note, any monadic side effects
in
m of
both the "acquire" and "release" computations
will be discarded. To keep the monadic side effects of the "acquire"
computation, use
bracket with constant functions instead.
if' lifted to
Monad. Unlike
liftM3 if',
this is short-circuiting in the monad, such that only the predicate
action and one of the remaining argument actions are executed.