regex 1.0.2.0 → 1.1.0.0
raw patch · 17 files changed
+127/−56 lines, 17 filesdep −regex-tdfa-textdep ~basedep ~base-compatdep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependencies removed: regex-tdfa-text
Dependency ranges changed: base, base-compat, bytestring, hashable, regex-base, regex-pcre-builtin, regex-tdfa, text, time-locale-compat, unordered-containers
API changes (from Hackage documentation)
+ Text.RE.ZeInternals.Types.Poss: Eek :: String -> Poss a
+ Text.RE.ZeInternals.Types.Poss: Yup :: a -> Poss a
+ Text.RE.ZeInternals.Types.Poss: data Poss a
+ Text.RE.ZeInternals.Types.Poss: instance Control.Monad.Fail.MonadFail Text.RE.ZeInternals.Types.Poss.Poss
+ Text.RE.ZeInternals.Types.Poss: instance GHC.Base.Applicative Text.RE.ZeInternals.Types.Poss.Poss
+ Text.RE.ZeInternals.Types.Poss: instance GHC.Base.Functor Text.RE.ZeInternals.Types.Poss.Poss
+ Text.RE.ZeInternals.Types.Poss: instance GHC.Base.Monad Text.RE.ZeInternals.Types.Poss.Poss
+ Text.RE.ZeInternals.Types.Poss: instance GHC.Classes.Eq a => GHC.Classes.Eq (Text.RE.ZeInternals.Types.Poss.Poss a)
+ Text.RE.ZeInternals.Types.Poss: instance GHC.Classes.Ord a => GHC.Classes.Ord (Text.RE.ZeInternals.Types.Poss.Poss a)
+ Text.RE.ZeInternals.Types.Poss: instance GHC.Show.Show a => GHC.Show.Show (Text.RE.ZeInternals.Types.Poss.Poss a)
+ Text.RE.ZeInternals.Types.Poss: poss :: (String -> b) -> (a -> b) -> Poss a -> b
+ Text.RE.ZeInternals.Types.Poss: poss2either :: Poss a -> Either String a
- Text.RE.TDFA: (=~~) :: (Monad m, RegexContext Regex s a, RegexMaker Regex CompOption ExecOption s) => s -> RE -> m a
+ Text.RE.TDFA: (=~~) :: (Monad m, MonadFail m, RegexContext Regex s a, RegexMaker Regex CompOption ExecOption s) => s -> RE -> m a
- Text.RE.TDFA: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA: compileRegexWithOptions :: (IsOption o, Functor m, Monad m) => o -> String -> m RE
+ Text.RE.TDFA: compileRegexWithOptions :: (IsOption o, Functor m, Monad m, MonadFail m) => o -> String -> m RE
- Text.RE.TDFA: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA: compileSearchReplaceWithOptions :: (Monad m, Functor m, IsRegex RE s) => REOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA: compileSearchReplaceWithOptions :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => REOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.TDFA: escapeWithOptions :: (IsOption o, Functor m, Monad m) => o -> (String -> String) -> String -> m RE
+ Text.RE.TDFA: escapeWithOptions :: (IsOption o, Functor m, Monad m, MonadFail m) => o -> (String -> String) -> String -> m RE
- Text.RE.TDFA.ByteString: (=~~) :: (Monad m, Functor m, Typeable a, RegexContext Regex ByteString a) => ByteString -> RE -> m a
+ Text.RE.TDFA.ByteString: (=~~) :: (Monad m, MonadFail m, Functor m, Typeable a, RegexContext Regex ByteString a) => ByteString -> RE -> m a
- Text.RE.TDFA.ByteString: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA.ByteString: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA.ByteString: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA.ByteString: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA.ByteString: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.ByteString: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.ByteString: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.ByteString: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.ByteString: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA.ByteString: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA.ByteString: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA.ByteString: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.TDFA.ByteString.Lazy: (=~~) :: (Monad m, Functor m, Typeable a, RegexContext Regex ByteString a) => ByteString -> RE -> m a
+ Text.RE.TDFA.ByteString.Lazy: (=~~) :: (Monad m, MonadFail m, Functor m, Typeable a, RegexContext Regex ByteString a) => ByteString -> RE -> m a
- Text.RE.TDFA.ByteString.Lazy: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA.ByteString.Lazy: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA.ByteString.Lazy: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA.ByteString.Lazy: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA.ByteString.Lazy: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.ByteString.Lazy: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.ByteString.Lazy: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.ByteString.Lazy: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.ByteString.Lazy: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA.ByteString.Lazy: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA.ByteString.Lazy: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA.ByteString.Lazy: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.TDFA.Sequence: (=~~) :: (Monad m, Functor m, Typeable a, RegexContext Regex (Seq Char) a) => Seq Char -> RE -> m a
+ Text.RE.TDFA.Sequence: (=~~) :: (Monad m, MonadFail m, Functor m, Typeable a, RegexContext Regex (Seq Char) a) => Seq Char -> RE -> m a
- Text.RE.TDFA.Sequence: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA.Sequence: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA.Sequence: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA.Sequence: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA.Sequence: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.Sequence: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.Sequence: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.Sequence: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.Sequence: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA.Sequence: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA.Sequence: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA.Sequence: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.TDFA.String: (=~~) :: (Monad m, Functor m, Typeable a, RegexContext Regex String a) => String -> RE -> m a
+ Text.RE.TDFA.String: (=~~) :: (Monad m, MonadFail m, Functor m, Typeable a, RegexContext Regex String a) => String -> RE -> m a
- Text.RE.TDFA.String: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA.String: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA.String: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA.String: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA.String: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.String: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.String: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.String: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.String: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA.String: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA.String: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA.String: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.TDFA.Text: (=~~) :: (Monad m, Functor m, Typeable a, RegexContext Regex Text a) => Text -> RE -> m a
+ Text.RE.TDFA.Text: (=~~) :: (Monad m, MonadFail m, Functor m, Typeable a, RegexContext Regex Text a) => Text -> RE -> m a
- Text.RE.TDFA.Text: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA.Text: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA.Text: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA.Text: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA.Text: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.Text: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.Text: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.Text: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.Text: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA.Text: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA.Text: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA.Text: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.TDFA.Text.Lazy: (=~~) :: (Monad m, Functor m, Typeable a, RegexContext Regex Text a) => Text -> RE -> m a
+ Text.RE.TDFA.Text.Lazy: (=~~) :: (Monad m, MonadFail m, Functor m, Typeable a, RegexContext Regex Text a) => Text -> RE -> m a
- Text.RE.TDFA.Text.Lazy: compileRegex :: (Functor m, Monad m) => String -> m RE
+ Text.RE.TDFA.Text.Lazy: compileRegex :: (Functor m, Monad m, MonadFail m) => String -> m RE
- Text.RE.TDFA.Text.Lazy: compileRegexWith :: (Functor m, Monad m) => SimpleREOptions -> String -> m RE
+ Text.RE.TDFA.Text.Lazy: compileRegexWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> String -> m RE
- Text.RE.TDFA.Text.Lazy: compileSearchReplace :: (Monad m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.Text.Lazy: compileSearchReplace :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.Text.Lazy: compileSearchReplaceWith :: (Monad m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
+ Text.RE.TDFA.Text.Lazy: compileSearchReplaceWith :: (Monad m, MonadFail m, Functor m, IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)
- Text.RE.TDFA.Text.Lazy: escape :: (Functor m, Monad m) => (String -> String) -> String -> m RE
+ Text.RE.TDFA.Text.Lazy: escape :: (Functor m, Monad m, MonadFail m) => (String -> String) -> String -> m RE
- Text.RE.TDFA.Text.Lazy: escapeWith :: (Functor m, Monad m) => SimpleREOptions -> (String -> String) -> String -> m RE
+ Text.RE.TDFA.Text.Lazy: escapeWith :: (Functor m, Monad m, MonadFail m) => SimpleREOptions -> (String -> String) -> String -> m RE
- Text.RE.Tools: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Edit: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools.Edit: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools.Edit: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools.Edit: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools.Edit: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools.Edit: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools.Edit: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools.Edit: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools.Edit: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Edit: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Edit: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Edit: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Find: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools.Find: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools.Find: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools.Find: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools.Find: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools.Find: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools.Find: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools.Find: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools.Find: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Find: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Find: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Find: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Grep: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools.Grep: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools.Grep: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools.Grep: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools.Grep: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools.Grep: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools.Grep: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools.Grep: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools.Grep: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Grep: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Grep: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Grep: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.Tools.IsRegex: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools.IsRegex: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools.IsRegex: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools.IsRegex: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools.IsRegex: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools.IsRegex: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools.IsRegex: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools.IsRegex: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools.IsRegex: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.IsRegex: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools.IsRegex: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.IsRegex: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Lex: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools.Lex: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools.Lex: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools.Lex: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools.Lex: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools.Lex: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools.Lex: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools.Lex: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools.Lex: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Lex: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Lex: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Lex: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Sed: makeEscaped :: (IsRegex re s, Functor m, Monad m) => (s -> s) -> s -> m re
+ Text.RE.Tools.Sed: makeEscaped :: (IsRegex re s, Functor m, Monad m, MonadFail m) => (s -> s) -> s -> m re
- Text.RE.Tools.Sed: makeEscapedWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> (s -> s) -> s -> m re
+ Text.RE.Tools.Sed: makeEscapedWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> (s -> s) -> s -> m re
- Text.RE.Tools.Sed: makeRegex :: (IsRegex re s, Functor m, Monad m) => s -> m re
+ Text.RE.Tools.Sed: makeRegex :: (IsRegex re s, Functor m, Monad m, MonadFail m) => s -> m re
- Text.RE.Tools.Sed: makeRegexWith :: (IsRegex re s, Functor m, Monad m) => SimpleREOptions -> s -> m re
+ Text.RE.Tools.Sed: makeRegexWith :: (IsRegex re s, Functor m, Monad m, MonadFail m) => SimpleREOptions -> s -> m re
- Text.RE.Tools.Sed: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Sed: makeSearchReplace :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => s -> s -> m (SearchReplace re s)
- Text.RE.Tools.Sed: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
+ Text.RE.Tools.Sed: makeSearchReplaceWith :: (IsRegex re s, Functor m, Monad m, MonadFail m, IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)
- Text.RE.ZeInternals: compileSearchAndReplace_ :: (Monad m, Functor m) => (String -> s) -> (String -> Either String re) -> String -> String -> m (SearchReplace re s)
+ Text.RE.ZeInternals: compileSearchAndReplace_ :: (Monad m, MonadFail m, Functor m) => (String -> s) -> (String -> Either String re) -> String -> String -> m (SearchReplace re s)
- Text.RE.ZeInternals: compileSearchReplace_ :: (Monad m, Functor m) => (String -> s) -> (String -> Either String re) -> String -> m (SearchReplace re s)
+ Text.RE.ZeInternals: compileSearchReplace_ :: (Monad m, MonadFail m, Functor m) => (String -> s) -> (String -> Either String re) -> String -> m (SearchReplace re s)
Files
- README.md +1/−0
- Text/RE/TDFA.hs +4/−2
- Text/RE/TDFA/ByteString.hs +3/−1
- Text/RE/TDFA/ByteString/Lazy.hs +3/−1
- Text/RE/TDFA/Sequence.hs +3/−1
- Text/RE/TDFA/String.hs +4/−2
- Text/RE/TDFA/Text.hs +3/−1
- Text/RE/TDFA/Text/Lazy.hs +3/−1
- Text/RE/ZeInternals/NamedCaptures.lhs +2/−1
- Text/RE/ZeInternals/SearchReplace.hs +10/−7
- Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs +3/−2
- Text/RE/ZeInternals/TDFA.hs +21/−18
- Text/RE/ZeInternals/Types/IsRegex.lhs +8/−6
- Text/RE/ZeInternals/Types/Poss.hs +41/−0
- Text/RE/ZeInternals/Types/SearchReplace.lhs +1/−0
- changelog +4/−0
- regex.cabal +13/−13
README.md view
@@ -42,6 +42,7 @@ - [X] 2018-12-14 v1.0.1.4 [Fix for GHC 8.4.4, GHC-8.6.2](https://github.com/iconnect/regex/milestone/23) - [X] 2018-12-18 v1.0.1.5 [TDFA quasi quoters not dealing with newlines](https://github.com/iconnect/regex/milestone/24) - [X] 2018-12-19 v1.0.2.0 [Tidy build issues](https://github.com/iconnect/regex/milestone/25)+- [X] 2020-01-27 v1.1.0.0 [Adapt for MonadFail/base-4.13/GHC-8.8](https://github.com/iconnect/regex/milestone/26) See the [Roadmap page](http://roadmap.regex.uk) for details.
Text/RE/TDFA.hs view
@@ -4,7 +4,8 @@ #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-} #endif-{-# OPTIONS_GHC -fno-warn-dodgy-exports #-}+{-# OPTIONS_GHC -fno-warn-dodgy-exports #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} module Text.RE.TDFA (@@ -113,6 +114,7 @@ , module Text.RE.TDFA.Text.Lazy ) where +import Control.Monad.Fail import Text.RE.REOptions import Text.RE.Replace import Text.RE.TDFA.ByteString()@@ -175,7 +177,7 @@ (=~) bs rex = B.match (reRegex rex) bs -- | the regex-base monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , B.RegexContext TDFA.Regex s a , B.RegexMaker TDFA.Regex TDFA.CompOption TDFA.ExecOption s )
Text/RE/TDFA/ByteString.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.TDFA.ByteString@@ -84,6 +85,7 @@ , module Text.RE.Tools.IsRegex ) where +import Control.Monad.Fail import qualified Data.ByteString as B import Data.Typeable import Prelude.Compat@@ -146,7 +148,7 @@ (=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs -- | the `regex-base` monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , Functor m , Typeable a , RegexContext TDFA.Regex B.ByteString a
Text/RE/TDFA/ByteString/Lazy.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.TDFA.ByteString.Lazy@@ -84,6 +85,7 @@ , module Text.RE.Tools.IsRegex ) where +import Control.Monad.Fail import qualified Data.ByteString.Lazy.Char8 as LBS import Data.Typeable import Prelude.Compat@@ -146,7 +148,7 @@ (=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs -- | the `regex-base` monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , Functor m , Typeable a , RegexContext TDFA.Regex LBS.ByteString a
Text/RE/TDFA/Sequence.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.TDFA.Sequence@@ -84,6 +85,7 @@ , module Text.RE.Tools.IsRegex ) where +import Control.Monad.Fail import qualified Data.Sequence as S import Data.Typeable import Prelude.Compat@@ -146,7 +148,7 @@ (=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs -- | the `regex-base` monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , Functor m , Typeable a , RegexContext TDFA.Regex (S.Seq Char) a
Text/RE/TDFA/String.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.TDFA.String@@ -84,7 +85,7 @@ , module Text.RE.Tools.IsRegex ) where -+import Control.Monad.Fail import Data.Typeable import Prelude.Compat import Text.RE.REOptions@@ -96,6 +97,7 @@ import Text.RE.ZeInternals.TDFA import Text.Regex.Base import qualified Text.Regex.TDFA as TDFA+ -- NB regex-base instance imports maybe be needed for for some API modules -- | find all the matches in the argument text; e.g., to count the number@@ -146,7 +148,7 @@ (=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs -- | the `regex-base` monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , Functor m , Typeable a , RegexContext TDFA.Regex String a
Text/RE/TDFA/Text.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.TDFA.Text@@ -84,6 +85,7 @@ , module Text.RE.Tools.IsRegex ) where +import Control.Monad.Fail import qualified Data.Text as T import Data.Typeable import Prelude.Compat@@ -146,7 +148,7 @@ (=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs -- | the `regex-base` monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , Functor m , Typeable a , RegexContext TDFA.Regex T.Text a
Text/RE/TDFA/Text/Lazy.hs view
@@ -7,6 +7,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.TDFA.Text.Lazy@@ -84,6 +85,7 @@ , module Text.RE.Tools.IsRegex ) where +import Control.Monad.Fail import qualified Data.Text.Lazy as TL import Data.Typeable import Prelude.Compat@@ -146,7 +148,7 @@ (=~) bs rex = addCaptureNames (reCaptureNames rex) $ match (reRegex rex) bs -- | the `regex-base` monadic, polymorphic match operator-(=~~) :: ( Monad m+(=~~) :: ( Monad m, MonadFail m , Functor m , Typeable a , RegexContext TDFA.Regex TL.Text a
Text/RE/ZeInternals/NamedCaptures.lhs view
@@ -33,6 +33,7 @@ import Text.RE.ZeInternals.Tools.Lex import Text.RE.ZeInternals.Types.CaptureID import Text.RE.ZeInternals.Types.Match+import Text.RE.ZeInternals.Types.Poss import Text.Regex.TDFA @@ -135,7 +136,7 @@ s2c [c] = c s2c _ = oops "s2c" - mk s f = (either error id $ makeRegexM s,Just . f)+ mk s f = (poss error id $ makeRegexM s,Just . f) oops m = error $ "NamedCaptures.scan: " ++ m \end{code}
Text/RE/ZeInternals/SearchReplace.hs view
@@ -8,7 +8,8 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} #endif-{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} module Text.RE.ZeInternals.SearchReplace ( unsafeCompileSearchReplace_@@ -16,13 +17,15 @@ , compileSearchAndReplace_ ) where +import Control.Monad.Fail import qualified Data.HashMap.Strict as HMS-import Prelude.Compat+import Prelude.Compat hiding (fail) import Text.RE.ZeInternals.NamedCaptures import Text.RE.ZeInternals.Replace import Text.RE.ZeInternals.Types.Capture import Text.RE.ZeInternals.Types.CaptureID import Text.RE.ZeInternals.Types.Matches+import Text.RE.ZeInternals.Types.Poss import Text.RE.ZeInternals.Types.SearchReplace import qualified Text.Regex.TDFA as TDFA @@ -33,27 +36,27 @@ -> (String->Either String re) -> String -> SearchReplace re s-unsafeCompileSearchReplace_ pk cf = either err id . compileSearchReplace_ pk cf+unsafeCompileSearchReplace_ pk cf = poss err id . compileSearchReplace_ pk cf where err msg = error $ "unsafeCompileSearchReplace_: " ++ msg -- | compile a SearchReplace template generating errors if the RE or -- the template are not well formed -- all capture references being checked-compileSearchReplace_ :: (Monad m,Functor m)+compileSearchReplace_ :: (Monad m,MonadFail m,Functor m) => (String->s) -> (String->Either String re) -> String -> m (SearchReplace re s)-compileSearchReplace_ pack compile_re sr_tpl = either fail return $ do+compileSearchReplace_ pack compile_re sr_tpl = poss fail return $ do case mainCaptures $ sr_tpl $=~ "///" of [cap] -> compileSearchAndReplace_ pack compile_re (capturePrefix cap) (captureSuffix cap)- _ -> Left $ "bad search-replace template syntax: " ++ sr_tpl+ _ -> Eek $ "bad search-replace template syntax: " ++ sr_tpl -- | compile 'SearcgReplace' from two strings containing the RE -- and the replacement template-compileSearchAndReplace_ :: (Monad m,Functor m)+compileSearchAndReplace_ :: (Monad m,MonadFail m,Functor m) => (String->s) -> (String->Either String re) -> String
Text/RE/ZeInternals/SearchReplace/TDFAEdPrime.hs view
@@ -21,6 +21,7 @@ import Text.RE.Tools.IsRegex import Text.RE.ZeInternals import Text.RE.ZeInternals.TDFA+import Text.RE.ZeInternals.Types.Poss -- | construct a quasi quoter from a casting function and @Just sro@@@ -41,7 +42,7 @@ parse sro mk ts = either error (\_->mk ts) ei where ei :: Either String (SearchReplace RE String)- ei = compileSearchReplace_ id (compileRegexWith sro) ts+ ei = poss2either $ compileSearchReplace_ id (poss2either . compileRegexWith sro) ts unsafe_compile_sr_simple :: IsRegex RE s => SimpleREOptions@@ -55,4 +56,4 @@ -> String -> SearchReplace RE s unsafe_compile_sr os =- unsafeCompileSearchReplace_ packR $ compileRegexWithOptionsForQQ os+ unsafeCompileSearchReplace_ packR $ poss2either . compileRegexWithOptionsForQQ os
Text/RE/ZeInternals/TDFA.hs view
@@ -12,7 +12,8 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} #endif-{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} module Text.RE.ZeInternals.TDFA ( -- * About@@ -67,15 +68,17 @@ , cp ) where +import Control.Monad.Fail import Data.Functor.Identity import Language.Haskell.TH import Language.Haskell.TH.Quote-import Prelude.Compat+import Prelude.Compat hiding (fail) import Text.RE.REOptions import Text.RE.Replace import Text.RE.TestBench import Text.RE.Tools import Text.RE.ZeInternals+import Text.RE.ZeInternals.Types.Poss import Text.Regex.TDFA @@ -181,17 +184,17 @@ -- | compile a 'String' into a 'RE' with the default options, -- generating an error if the RE is not well formed-compileRegex :: (Functor m,Monad m) => String -> m RE+compileRegex :: (Functor m,Monad m,MonadFail m) => String -> m RE compileRegex = compileRegexWith minBound -- | compile a 'String' into a 'RE' using the given @SimpleREOptions@, -- generating an error if the RE is not well formed-compileRegexWith :: (Functor m,Monad m) => SimpleREOptions -> String -> m RE+compileRegexWith :: (Functor m,Monad m,MonadFail m) => SimpleREOptions -> String -> m RE compileRegexWith = compileRegexWithOptions -- | compile a 'String' into a 'RE' using the given @SimpleREOptions@, -- generating an error if the RE is not well formed-compileRegexWithOptions :: (IsOption o, Functor m, Monad m)+compileRegexWithOptions :: (IsOption o, Functor m, Monad m, MonadFail m) => o -> String -> m RE@@ -199,7 +202,7 @@ -- | compile a 'String' into a 'RE' for q quasi quoter, using the given -- @SimpleREOptions@, generating an error if the RE is not well formed-compileRegexWithOptionsForQQ :: (IsOption o, Functor m, Monad m)+compileRegexWithOptionsForQQ :: (IsOption o, Functor m, Monad m,MonadFail m) => o -> String -> m RE@@ -212,7 +215,7 @@ -- | compile a SearchReplace template generating errors if the RE or -- the template are not well formed, all capture references being checked-compileSearchReplace :: (Monad m,Functor m,IsRegex RE s)+compileSearchReplace :: (Monad m,MonadFail m,Functor m,IsRegex RE s) => String -> String -> m (SearchReplace RE s)@@ -221,22 +224,22 @@ -- | compile a SearchReplace template, with simple options, generating -- errors if the RE or the template are not well formed, all capture -- references being checked-compileSearchReplaceWith :: (Monad m,Functor m,IsRegex RE s)+compileSearchReplaceWith :: (Monad m,MonadFail m,Functor m,IsRegex RE s) => SimpleREOptions -> String -> String -> m (SearchReplace RE s)-compileSearchReplaceWith sro = compileSearchAndReplace_ packR $ compileRegexWith sro+compileSearchReplaceWith sro = compileSearchAndReplace_ packR $ poss2either . compileRegexWith sro -- | compile a SearchReplace template, with general options, generating -- errors if the RE or the template are not well formed, all capture -- references being checked-compileSearchReplaceWithOptions :: (Monad m,Functor m,IsRegex RE s)+compileSearchReplaceWithOptions :: (Monad m,MonadFail m,Functor m,IsRegex RE s) => REOptions -> String -> String -> m (SearchReplace RE s)-compileSearchReplaceWithOptions os = compileSearchAndReplace_ packR $ compileRegexWithOptions os+compileSearchReplaceWithOptions os = compileSearchAndReplace_ packR $ poss2either . compileRegexWithOptions os ------------------------------------------------------------------------@@ -249,14 +252,14 @@ -- -- @maybe undefined id . escape ((\"^\"++) . (++\"$\"))@ ---escape :: (Functor m,Monad m)+escape :: (Functor m,Monad m,MonadFail m) => (String->String) -> String -> m RE escape = escapeWith minBound -- | a variant of 'escape' where the 'SimpleREOptions' are specified-escapeWith :: (Functor m,Monad m)+escapeWith :: (Functor m,Monad m,MonadFail m) => SimpleREOptions -> (String->String) -> String@@ -265,7 +268,7 @@ -- | a variant of 'escapeWith' that allows an 'IsOption' RE option -- to be specified-escapeWithOptions :: ( IsOption o, Functor m, Monad m)+escapeWithOptions :: ( IsOption o, Functor m, Monad m,MonadFail m) => o -> (String->String) -> String@@ -382,7 +385,7 @@ } where parse :: SimpleREOptions -> (String->Q Exp) -> String -> Q Exp- parse sro mk rs = either error (\_->mk rs) $ compileRegex_ RPM_qq os rs+ parse sro mk rs = poss error (\_->mk rs) $ compileRegex_ RPM_qq os rs where os = unpackSimpleREOptions sro @@ -403,11 +406,11 @@ unsafeCompileRegex = unsafeCompileRegex_ RPM_qq . makeREOptions unsafeCompileRegex_ :: RegexParseMode -> REOptions -> String -> RE-unsafeCompileRegex_ rpm os = either oops id . compileRegex_ rpm os+unsafeCompileRegex_ rpm os = poss oops id . compileRegex_ rpm os where oops = error . ("unsafeCompileRegex: " ++) -compileRegex_ :: (Functor m,Monad m)+compileRegex_ :: (Functor m,MonadFail m,Monad m) => RegexParseMode -> REOptions -> String@@ -422,7 +425,7 @@ , _re_regex = rx } -compileRegex' :: (Functor m,Monad m)+compileRegex' :: (Functor m,MonadFail m,Monad m) => RegexParseMode -> REOptions -> String
Text/RE/ZeInternals/Types/IsRegex.lhs view
@@ -5,6 +5,7 @@ {-# LANGUAGE CPP #-} #if __GLASGOW_HASKELL__ >= 800 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} #endif module Text.RE.ZeInternals.Types.IsRegex@@ -14,6 +15,7 @@ , searchReplaceFirst ) where +import Control.Monad.Fail import Text.RE.REOptions import Text.RE.Replace import Text.RE.ZeInternals.EscapeREString@@ -29,17 +31,17 @@ -- | finding all matches matchMany :: re -> s -> Matches s -- | compiling an RE, failing if the RE is not well formed- makeRegex :: (Functor m,Monad m) => s -> m re+ makeRegex :: (Functor m,Monad m, MonadFail m) => s -> m re -- | comiling an RE, specifying the 'SimpleREOptions'- makeRegexWith :: (Functor m,Monad m) => SimpleREOptions -> s -> m re+ makeRegexWith :: (Functor m,Monad m, MonadFail m) => SimpleREOptions -> s -> m re -- | compiling a 'SearchReplace' template from the RE text and the template Text, failing if they are not well formed- makeSearchReplace :: (Functor m,Monad m,IsRegex re s) => s -> s -> m (SearchReplace re s)+ makeSearchReplace :: (Functor m,Monad m, MonadFail m,IsRegex re s) => s -> s -> m (SearchReplace re s) -- | compiling a 'SearchReplace' template specifing the 'SimpleREOptions' for the RE- makeSearchReplaceWith :: (Functor m,Monad m,IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s)+ makeSearchReplaceWith :: (Functor m,Monad m, MonadFail m,IsRegex re s) => SimpleREOptions -> s -> s -> m (SearchReplace re s) -- | incorporate an escaped string into a compiled RE with the default options- makeEscaped :: (Functor m,Monad m) => (s->s) -> s -> m re+ makeEscaped :: (Functor m,Monad m, MonadFail m) => (s->s) -> s -> m re -- | incorporate an escaped string into a compiled RE with the specified 'SimpleREOptions'- makeEscapedWith :: (Functor m,Monad m) => SimpleREOptions -> (s->s) -> s -> m re+ makeEscapedWith :: (Functor m,Monad m, MonadFail m) => SimpleREOptions -> (s->s) -> s -> m re -- | extract the text of the RE from the RE regexSource :: re -> s
+ Text/RE/ZeInternals/Types/Poss.hs view
@@ -0,0 +1,41 @@+{-# OPTIONS_GHC -fno-warn-unused-imports #-}++module Text.RE.ZeInternals.Types.Poss where++import Control.Monad.Fail+++data Poss a+ = Eek String+ | Yup a+ deriving (Eq,Ord,Show)++instance Functor Poss where+ fmap f p = case p of+ Eek m -> Eek m+ Yup x -> Yup $ f x++instance Applicative Poss where+ pure = Yup+ (<*>) p1 p2 = case p1 of+ Eek m -> Eek m+ Yup f -> case p2 of+ Eek n -> Eek n+ Yup x -> Yup $ f x++instance Monad Poss where+ return = pure+ (>>=) p f = case p of+ Eek m -> Eek m+ Yup x -> f x++instance MonadFail Poss where+ fail = Eek++poss :: (String->b) -> (a->b) -> Poss a -> b+poss f _ (Eek s) = f s+poss _ g (Yup x) = g x++poss2either :: Poss a -> Either String a+poss2either (Eek m) = Left m+poss2either (Yup x) = Right x
Text/RE/ZeInternals/Types/SearchReplace.lhs view
@@ -2,6 +2,7 @@ module Text.RE.ZeInternals.Types.SearchReplace ( SearchReplace(..) ) where+ \end{code} \begin{code}
changelog view
@@ -1,5 +1,9 @@ -*-change-log-*- +1.1.0.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2018-12-19+ * drop support for GHC 8.0 and below+ * adapt for base 4.13 (MonadFail)+ 1.0.2.0 Chris Dornan <chris.dornan@irisconnect.co.uk> 2018-12-19 * cabal-install build with 8.0 and 8.2 failing (#163) * Switch to GHC-8.6.3/nightly-2018-12-19 (#164)
regex.cabal view
@@ -1,12 +1,12 @@ Name: regex-Version: 1.0.2.0+Version: 1.1.0.0 Synopsis: Toolkit for regex-base Description: A regular expression toolkit for regex-base with compile-time checking of RE syntax, data types for matches and captures, a text replacement toolkit, portable options, high-level AWK-like tools for building text processing apps, regular expression- macros with parsers and test bench, omprehensive+ macros with parsers and test bench, comprehensive documentation, tutorials and copious examples. Homepage: http://regex.uk Author: Chris Dornan@@ -32,7 +32,7 @@ Source-Repository this Type: git Location: https://github.com/iconnect/regex.git- Tag: 1.0.2.0+ Tag: 1.1.0.0 @@ -60,6 +60,7 @@ Text.RE.Tools.Lex Text.RE.Tools.Sed Text.RE.ZeInternals+ Text.RE.ZeInternals.Types.Poss Other-Modules: Text.RE.ZeInternals.AddCaptureNames@@ -125,20 +126,19 @@ Build-depends: array >= 0.4 , base >= 4 && < 5- , base-compat >= 0.6- , bytestring == 0.10.*+ , base-compat >= 0.6 && < 1+ , bytestring >= 0.10 , containers >= 0.4- , hashable == 1.2.*- , regex-base == 0.93.*- , regex-pcre-builtin == 0.94.*- , regex-tdfa == 1.2.*- , regex-tdfa-text == 1.0.*+ , hashable >= 1.2+ , regex-base >= 0.93+ , regex-pcre-builtin >= 0.94+ , regex-tdfa >= 1.2 , template-haskell >= 2.7- , text == 1.2.*+ , text >= 1.2 , time >= 1.4.2- , time-locale-compat == 0.1.*+ , time-locale-compat >= 0.1 , transformers >= 0.2.2- , unordered-containers == 0.2.*+ , unordered-containers >= 0.2 , utf8-string >= 1