úÎl6g!       Safe-Infered!"#$%&!"#$%&!"#$%& Safe-Infered;Type of regular expressions that recognize symbols of type s and  produce a result of type a. 'Regular expressions can be built using ', ( and  )) instances in the following natural way:  f * ra matches iff ra- matches, and its return value is the result  of applying f to the return value of ra.  + xB matches the empty string (i.e. it does not consume any symbols),  and its return value is x  rf , ra3 matches a string iff it is a concatenation of two  strings: one matched by rf and the other matched by ra. The return value  is f a, where f and a are the return values of rf and ra  respectively.  ra - rb. matches a string which is accepted by either ra or rb. 8 It is left-biased, so if both can match, the result of ra is used.  .: is a regular expression which does not match any string.  / ra: matches concatenation of zero or more strings matched by ra  and returns the list of ra'"s return values on those strings.  0 ra9 matches concatenation of one or more strings matched by ra  and returns the list of ra'"s return values on those strings. FA thread either is a result or corresponds to a symbol in the regular / expression, which is expected by that thread. (Returns thread identifier. This will be 1 for ordinary threads and  2 for results. 3456789:;<=>3456789:;<=>9876543;:<=> Safe-Infered?@??@ experimental"Roman Cheplyaka <roma@ro-che.info> Safe-Infered ,The state of the engine is represented as a " regex object" of type   s r, where s is the type of symbols and r is the  result type (as in the  type). Think of  as a collection of  Bs ordered by priority. E.g. threads generated by the left part of  -6 come before the threads generated by the right part. JList of all threads of an object. Each non-result thread has a unique id. DCreate an object from a list of threads. It is recommended that all  threads come from the same , unless you know what you' re doing. @ However, it should be safe to filter out or rearrange threads. *Check whether a thread is a result thread )Return the result of a result thread, or 2 if it's not a result  thread ?Check if the object has no threads. In that case it never will ( produce any new threads as a result of . Empty object (with no threads) CExtract the result values from all the result threads of an object "Feed a symbol into a regex object ?Feed a symbol into a non-result thread. It is an error to call   on a result thread. LAdd a thread to an object. The new thread will have lower priority than the * threads which are already in the object. LIf a (non-result) thread with the same id already exists in the object, the  object is not changed. >Compile a regular expression into a regular expression object         Safe-Infered?Match and return a single symbol which satisfies the predicate "Match and return the given symbol #Match and return any single symbol 0Match and return the given sequence of symbols. Note that there is an A% instance for regular expression, so  if you enable the OverloadedStrings# language extension, you can write  string "foo" simply as "foo".  Example: #{-# LANGUAGE OverloadedStrings #-} import Text.Regex.Applicative  /number = "one" *> pure 1 <|> "two" *> pure 2  main = print $ "two" =~ number OMatch zero or more instances of the given expression, which are combined using  the given folding function. @ argument controls whether this regular expression should match  as many as possible () or as few as possible ( ) instances  of the underlying expression. =Match zero or more instances of the given expression, but as  few of them as possible (i.e.  non-greedily). A greedy equivalent of   is /.  Examples: FText.Regex.Applicative> findFirstPrefix (few anySym <* "b") "ababab" Just ("a","abab") GText.Regex.Applicative> findFirstPrefix (many anySym <* "b") "ababab" Just ("ababa","")  s =~ a = match a sEAttempt to match a string of symbols against the regular expression. J Note that the whole string (not just some part of it) should be matched.  Examples: 8Text.Regex.Applicative> match (sym 'a' <|> sym 'b') "a"  Just 'a' 9Text.Regex.Applicative> match (sym 'a' <|> sym 'b') "ab" Nothing AFind a string prefix which is matched by the regular expression. LOf all matching prefixes, pick one using left bias (prefer the left part of  -$ to the right part) and greediness. ;This is the match which a backtracking engine (such as Perl's one) would find  first. ;If match is found, the rest of the input is also returned.  Examples: =Text.Regex.Applicative> findFirstPrefix ("a" <|> "ab") "abc" Just ("a","bc") =Text.Regex.Applicative> findFirstPrefix ("ab" <|> "a") "abc" Just ("ab","c") 3Text.Regex.Applicative> findFirstPrefix "bc" "abc" Nothing KFind the longest string prefix which is matched by the regular expression. KSubmatches are still determined using left bias and greediness, so this is ! different from POSIX semantics. ;If match is found, the rest of the input is also returned.  Examples: 5Text.Regex.Applicative Data.Char> let keyword = "if" GText.Regex.Applicative Data.Char> let identifier = many $ psym isAlpha ]Text.Regex.Applicative Data.Char> let lexeme = (Left <$> keyword) <|> (Right <$> identifier) DText.Regex.Applicative Data.Char> findLongestPrefix lexeme "if foo" Just (Left "if"," foo") CText.Regex.Applicative Data.Char> findLongestPrefix lexeme "iffoo" Just (Right "iffoo","") 'Find the shortest prefix (analogous to ) GFind the leftmost substring that is matched by the regular expression.  Otherwise behaves like #. Returns the result together with < the prefix and suffix of the string surrounding the match. GFind the leftmost substring that is matched by the regular expression.  Otherwise behaves like #. Returns the result together with < the prefix and suffix of the string surrounding the match. GFind the leftmost substring that is matched by the regular expression.  Otherwise behaves like #. Returns the result together with < the prefix and suffix of the string surrounding the match. BCDEFGHIJKLM NOPQBCDEFGHIJKLM BDCEFGHIJKLM NOPQ experimental"Roman Cheplyaka <roma@ro-che.info> Safe-Infered/(RSTUVWX,+/0-.)YZ[\]^_`abcd*e  f      !"#$%&'()*+,-./0.12.13.45.16.17.18.1*.19.1:.;<.;=>?@ABCDE FG H.IJKLMNOPQRSTUVWXYZ.1[.1\.1].1^.1_.1`.1a.1b.1c.1c.1d.1e.1f.1g.1h.1i.1j.1k.1k./lmregex-applicative-0.2Text.Regex.ApplicativeText.Regex.Applicative.Object!Text.Regex.Applicative.StateQueueText.Regex.Applicative.TypesText.Regex.Applicative.Compile Text.Regex.Applicative.InterfaceRE Greediness NonGreedyGreedyThreadThreadIdthreadIdReObjectthreads fromThreadsisResult getResultfailed emptyObjectresultsstep stepThread addThreadcompilepsymsymanySymstringreFoldlfew=~matchfindFirstPrefixfindLongestPrefixfindShortestPrefixfindFirstInfixfindLongestInfixfindShortestInfix StateQueue getElementsempty insertUniqueinsertfoldbaseGHC.BaseFunctorControl.Applicative Applicative Alternative Data.Functor<$>pure<*><|>manysome Data.MaybeJustNothingVoidRepFmapAppAltSymbolEpsAccept threadId_ _threadCont $fFunctorCont Data.StringIsStringInfixMatchingStateNoResult GotResult prefixLen prefixStrresult postfixStr prefixCounter preferOvermkInfixMatchingState gotResultfindExtremalInfix $fIsStringRE$fAlternativeRE$fApplicativeRE $fFunctorREoptionalliftA3liftA2liftA<**><**>getConstConst unwrapMonad WrapMonad WrappedMonad unwrapArrow WrapArrow WrappedArrow getZipListZipList<$