{-# LANGUAGE RecordWildCards #-}{-# LANGUAGE FlexibleInstances #-}{-# LANGUAGE UndecidableInstances #-}
@@ -224,7 +224,10 @@
captureSuffix ::Extract a =>Capture a -> a
captureSuffix Capture{..} = after (captureOffset+captureLength) captureSource
-- | for matching just the first RE against the source text
-instanceRegexContext regex source (AllTextSubmatches (ArrayInt) (source,(Int,Int))) =>
+instance
+ ( RegexContext regex source (AllTextSubmatches (ArrayInt) (source,(Int,Int)))
+ , RegexLike regex source
+ ) =>RegexContext regex source (Match source) where
match r s = cvt s $ getAllTextSubmatches $ match r s
matchM r s =do
@@ -232,7 +235,10 @@
return $ cvt s $ getAllTextSubmatches y
-- | for matching all REs against the source text
-instanceRegexContext regex source [MatchText source] =>
+instance
+ ( RegexContext regex source [MatchText source]
+ , RegexLike regex source
+ ) =>RegexContext regex source (Matches source) where
match r s =Matches s $ map (cvt s) $ match r s
matchM r s =do
@@ -257,5 +263,6 @@
, captureOffset = off
, captureLength = len
}