Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Compilation in 'match'

  • Loading branch information...
commit 9c5b39b1b499de2fdd14ca3b002845c8ef44b8f7 1 parent 30d6f99
@feuerbach authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 Text/Regex/Applicative/Interface.hs
View
6 Text/Regex/Applicative/Interface.hs
@@ -82,7 +82,7 @@ few a = reverse <$> Rep NonGreedy (flip (:)) [] a
-- | @s =~ a = match a s@
(=~) :: [s] -> RE s a -> Maybe a
-s =~ a = match a s
+(=~) = flip match
infix 2 =~
-- | Attempt to match a string of symbols against the regular expression.
@@ -96,10 +96,10 @@ infix 2 =~
-- >Nothing
--
match :: RE s a -> [s] -> Maybe a
-match re str =
+match re = let obj = compile re in \str ->
listToMaybe $
results $
- foldl (flip step) (compile re) str
+ foldl (flip step) obj str
-- | Find a string prefix which is matched by the regular expression.
--
Please sign in to comment.
Something went wrong with that request. Please try again.