| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
RERE.Type
Description
Regular-expression with fixed points.
Synopsis
- data RE a
- ch_ :: Char -> RE a
- (\/) :: Ord a => RE a -> RE a -> RE a
- star_ :: RE a -> RE a
- let_ :: Ord a => Name -> RE a -> RE (Var a) -> RE a
- fix_ :: Ord a => Name -> RE (Var a) -> RE a
- (>>>=) :: Ord b => RE a -> (a -> RE b) -> RE b
- string_ :: Ord a => String -> RE a
- nullable :: RE a -> Bool
- derivative :: Char -> RE Void -> RE Void
- match :: RE Void -> String -> Bool
- compact :: Ord a => RE a -> RE a
- size :: RE a -> Int
- derivative1 :: Char -> RE Void -> RE Void
- derivative2 :: Char -> RE Void -> RE Void
Regular expression type
Regular expression with fixed point.
Constructors
| Null | |
| Full | |
| Eps | |
| Ch CharSet | |
| App (RE a) (RE a) | |
| Alt (RE a) (RE a) | |
| Star (RE a) | |
| Var a | |
| Let Name (RE a) (RE (Var a)) | |
| Fix Name (RE (Var a)) |
Instances
| Monad RE Source # | |
| Functor RE Source # | |
| Applicative RE Source # | |
| Foldable RE Source # | |
Defined in RERE.Type Methods fold :: Monoid m => RE m -> m # foldMap :: Monoid m => (a -> m) -> RE a -> m # foldr :: (a -> b -> b) -> b -> RE a -> b # foldr' :: (a -> b -> b) -> b -> RE a -> b # foldl :: (b -> a -> b) -> b -> RE a -> b # foldl' :: (b -> a -> b) -> b -> RE a -> b # foldr1 :: (a -> a -> a) -> RE a -> a # foldl1 :: (a -> a -> a) -> RE a -> a # elem :: Eq a => a -> RE a -> Bool # maximum :: Ord a => RE a -> a # | |
| Traversable RE Source # | |
| Eq a => Eq (RE a) Source # | |
| Ord a => Ord (RE a) Source # | |
| Show a => Show (RE a) Source # | |
| Ord a => IsString (RE a) Source # | |
Defined in RERE.Type Methods fromString :: String -> RE a # | |
| Ord a => Semigroup (RE a) Source # | |
| (Absurd a, Ord a) => Arbitrary (RE a) Source # | |
Smart constructors
Operations
nullable :: RE a -> Bool Source #
Whether the regular expression accepts empty string, or whether the formal language contains empty string.
>>>nullable EpsTrue
>>>nullable (ch_ 'c')False
derivative :: Char -> RE Void -> RE Void Source #
Derivative of regular exression to respect of character.
is \(D_c(r)\).derivative c r
match :: RE Void -> String -> Bool Source #
Match string by iteratively differentiating the regular expression.
This version is slow, consider using matchR.
compact :: Ord a => RE a -> RE a Source #
Re-apply smart constructors on RE structure,
thus potentially making it smaller.
This function is slow.
Internals
derivative1 :: Char -> RE Void -> RE Void Source #
derivative1 and derivative2 are slightly different
implementations internally. We are interested in comparing
whether either one is noticeably faster (no).
derivative2 :: Char -> RE Void -> RE Void Source #
derivative1 and derivative2 are slightly different
implementations internally. We are interested in comparing
whether either one is noticeably faster (no).