Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Matched str (pat :: Symbol)
- parseMatched :: forall str pat. (KnownSymbol pat, RegexLike Regex str) => str -> Maybe (Matched str pat)
- parseMatchedEither :: forall pat str. (Show str, KnownSymbol pat, RegexLike Regex str) => str -> Either (RegexError str) (Matched str pat)
- parseMatchedM :: forall pat str m. (KnownSymbol pat, RegexLike Regex str, MonadFail m, Show str) => str -> m (Matched str pat)
- asStr :: Matched str pat -> str
- asText :: Matched Text p -> Text
- asString :: Matched String p -> String
- asByteString :: Matched ByteString p -> ByteString
- compile :: forall pat m. KnownSymbol pat => Either String (RegexPat pat)
- parseMatchedWith :: RegexLike Regex str => RegexPat pat -> str -> Maybe (Matched str pat)
- parseMatchedEitherWith :: forall pat str m. (RegexLike Regex str, Show str, KnownSymbol pat) => RegexPat pat -> str -> Either (MatchError str) (Matched str pat)
- data RegexPat (pat :: Symbol)
Documentation
data Matched str (pat :: Symbol) Source #
A wrapper type that can only be constructed if the underlying string
type matches the regular expression in pat
.
Instances
Eq str => Eq (Matched str pat) Source # | |
Ord str => Ord (Matched str pat) Source # | |
Defined in Text.Regex.Wrapper compare :: Matched str pat -> Matched str pat -> Ordering # (<) :: Matched str pat -> Matched str pat -> Bool # (<=) :: Matched str pat -> Matched str pat -> Bool # (>) :: Matched str pat -> Matched str pat -> Bool # (>=) :: Matched str pat -> Matched str pat -> Bool # max :: Matched str pat -> Matched str pat -> Matched str pat # min :: Matched str pat -> Matched str pat -> Matched str pat # | |
(KnownSymbol pat, RegexLike Regex str, Read str) => Read (Matched str pat) Source # | |
Show str => Show (Matched str pat) Source # | |
Hashable str => Hashable (Matched str pat) Source # | |
Defined in Text.Regex.Wrapper | |
(KnownSymbol pat, Show str, FromJSON str, RegexLike Regex str) => FromJSON (Matched str pat) Source # | |
Defined in Text.Regex.Wrapper parseJSON :: Value -> Parser (Matched str pat) parseJSONList :: Value -> Parser [Matched str pat] | |
ToJSON str => ToJSON (Matched str pat) Source # | |
Defined in Text.Regex.Wrapper toJSON :: Matched str pat -> Value toEncoding :: Matched str pat -> Encoding toJSONList :: [Matched str pat] -> Value toEncodingList :: [Matched str pat] -> Encoding | |
FoldCase str => FoldCase (Matched str pat) Source # | |
Defined in Text.Regex.Wrapper |
parseMatched :: forall str pat. (KnownSymbol pat, RegexLike Regex str) => str -> Maybe (Matched str pat) Source #
Convert a str
into a
if possible.Matched
str pat
parseMatchedEither :: forall pat str. (Show str, KnownSymbol pat, RegexLike Regex str) => str -> Either (RegexError str) (Matched str pat) Source #
Same as
but provides a slightly helpful error
message on failure. This requires that your parseMatched
str
type is an instance
of
.Show
parseMatchedM :: forall pat str m. (KnownSymbol pat, RegexLike Regex str, MonadFail m, Show str) => str -> m (Matched str pat) Source #
Like
except that it calls parseMatchedEither
instead.fail
asByteString :: Matched ByteString p -> ByteString Source #
Same as
but with a fixed type.asStr
compile :: forall pat m. KnownSymbol pat => Either String (RegexPat pat) Source #
Create a
that can be used to construct Regex
values
when used with Matched
. This allows you to compile
the pattern once, and use it multiple times.parseMatchedWith
parseMatchedEitherWith :: forall pat str m. (RegexLike Regex str, Show str, KnownSymbol pat) => RegexPat pat -> str -> Either (MatchError str) (Matched str pat) Source #
Like
, but calls returns a useful error message.parseMatchedWith