| 115 | | (after', ok') <- doReplace (genericDrop (matchTo match) str) (ok + 1) |
| 116 | | return (concat [genericTake (matchFrom match) str, str', after'], ok') |
| | 115 | -- XXX - on zero-width match, advance the cursor and, if can't, |
| | 116 | -- don't even bother with the recursive call. |
| | 117 | case (matchTo match, matchFrom match) of |
| | 118 | (0, 0) -> if null str then return (str' ++ str, ok) else do |
| | 119 | (after', ok') <- doReplace (tail str) (ok + 1) |
| | 120 | return (concat [str' ++ (head str:after')], ok') |
| | 121 | (to, from) -> do |
| | 122 | (after', ok') <- doReplace (genericDrop to str) (ok + 1) |
| | 123 | return (concat [genericTake from str, str', after'], ok') |