summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--edit-lens/src/Data/String/DFST.hs7
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
28runDFST dfst@DFST{..} str = let (finalState, str') = runDFST' dfst stInitial str id 28runDFST 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
31runDFST' :: forall state. Ord state => DFST state -> state -> String -> (String -> String) -> (state, (String -> String)) 31runDFST' :: 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
32runDFST' _ st [] acc = (st, acc) 37runDFST' _ st [] acc = (st, acc)
33runDFST' dfst@DFST{..} st (c:cs) acc 38runDFST' dfst@DFST{..} st (c:cs) acc
34 | Just (st', mc') <- stTransition !? (st, c) 39 | Just (st', mc') <- stTransition !? (st, c)