diff options
Diffstat (limited to 'edit-lens/src/Data/String/DFST.hs')
-rw-r--r-- | edit-lens/src/Data/String/DFST.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/edit-lens/src/Data/String/DFST.hs b/edit-lens/src/Data/String/DFST.hs index 702a0d8..2eeb368 100644 --- a/edit-lens/src/Data/String/DFST.hs +++ b/edit-lens/src/Data/String/DFST.hs | |||
@@ -28,7 +28,12 @@ runDFST :: forall state. Ord state => DFST state -> String -> Maybe String | |||
28 | runDFST dfst@DFST{..} str = let (finalState, str') = runDFST' dfst stInitial str id | 28 | runDFST dfst@DFST{..} str = let (finalState, str') = runDFST' dfst stInitial str id |
29 | in str' "" <$ guard (finalState `Set.member` stAccept) | 29 | in str' "" <$ guard (finalState `Set.member` stAccept) |
30 | 30 | ||
31 | runDFST' :: forall state. Ord state => DFST state -> state -> String -> (String -> String) -> (state, (String -> String)) | 31 | runDFST' :: forall state. Ord state |
32 | => DFST state | ||
33 | -> state -- ^ Current state | ||
34 | -> String -- ^ Remaining input | ||
35 | -> (String -> String) -- ^ Output as difference list | ||
36 | -> (state, (String -> String)) -- ^ Next state, altered output | ||
32 | runDFST' _ st [] acc = (st, acc) | 37 | runDFST' _ st [] acc = (st, acc) |
33 | runDFST' dfst@DFST{..} st (c:cs) acc | 38 | runDFST' dfst@DFST{..} st (c:cs) acc |
34 | | Just (st', mc') <- stTransition !? (st, c) | 39 | | Just (st', mc') <- stTransition !? (st, c) |