redis-glob-0.1.0.7: Specify valid redis globs
Copyright(c) 2022 Tim Emiola
LicenseBSD3
MaintainerTim Emiola <adetokunbo@emio.la>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Redis.Glob.Internal

Description

Provides types that model redis glob patterns and combinators that can be used to validate and interpret them.

Assumes that glob do not match the non-printable ASCII characters.

Synopsis

modelling Globs

data Part Source #

Represents part of a valid redis glob pattern.

Instances

Instances details
Show Part Source # 
Instance details

Defined in Redis.Glob.Internal

Methods

showsPrec :: Int -> Part -> ShowS #

show :: Part -> String #

showList :: [Part] -> ShowS #

Eq Part Source # 
Instance details

Defined in Redis.Glob.Internal

Methods

(==) :: Part -> Part -> Bool #

(/=) :: Part -> Part -> Bool #

data InSquare Source #

Represents part of a valid redis glob pattern.

Constructors

Single Word8 
InRange Word8 Word8 

Instances

Instances details
Show InSquare Source # 
Instance details

Defined in Redis.Glob.Internal

Eq InSquare Source # 
Instance details

Defined in Redis.Glob.Internal

parse / print valid Globs

parseParts :: ByteString -> Maybe [Part] Source #

Parse several Part from a glob pattern

parsePart :: ByteString -> Maybe Part Source #

Parse a single Part from a glob pattern

fromParts :: [Part] -> ByteString Source #

Convert several Parts to the form they can be parsed from.

fromPart :: Part -> ByteString Source #

Convert a Part to the form it would be parsed from

useful combinators

reduceMany :: [Part] -> [Part] Source #

Normalise parsed Parts

All but a terminating Many are replaced with GenerousMany; Consecutive Manys are replaced by a single GenerousMany

matchParts :: ByteString -> [Part] -> Bool Source #

Confirm that a target ByteString matches the pattern provided as [Part].