module Text.Regex.Less.Quackers (QLR(..)) where
import qualified Text.Regex.PCRE.Light as R
import qualified Data.ByteString.Char8 as B
import Text.Regex.Less.REOpts
class QLR a where
compile :: a -> R.Regex
runopts :: a -> [R.PCREExecOption]
instance QLR String where
compile a = R.compile (B.pack a) []
runopts _ = []
instance QLR (String,[RECtOpt]) where
compile (a,b) = R.compile (B.pack a) (reCtOpts b)
runopts (_,_) = []
instance QLR (String,[RERtOpt]) where
compile (a,_) = R.compile (B.pack a) []
runopts (_,b) = reRtOpts b
instance QLR (String,([RECtOpt],[RERtOpt])) where
compile (a,(b,_)) = R.compile (B.pack a) (reCtOpts b)
runopts (_,(_,c)) = reRtOpts c
instance QLR (String,([RERtOpt],[RECtOpt])) where
compile (a,(_,b)) = R.compile (B.pack a) (reCtOpts b)
runopts (_,(c,_)) = reRtOpts c
instance QLR ((String,[RECtOpt]),[RERtOpt]) where
compile ((a,b),_) = R.compile (B.pack a) (reCtOpts b)
runopts ((_,_),c) = reRtOpts c
instance QLR ((String,[RERtOpt]),[RECtOpt]) where
compile ((a,_),b) = R.compile (B.pack a) (reCtOpts b)
runopts ((_,c),_) = reRtOpts c