summaryrefslogtreecommitdiff
path: root/edit-lens/src/Data/String
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-05-07 10:33:41 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-05-07 10:33:41 +0200
commitb55258d2b5609aea500fb0b011c87e9e1585cbb0 (patch)
treec19a13790cf7cb302378852c7273041a6f1f5720 /edit-lens/src/Data/String
parentdcadfe75a6b169df94d815eaa85f8eedea189ea4 (diff)
downloadincremental-dfsts-b55258d2b5609aea500fb0b011c87e9e1585cbb0.tar
incremental-dfsts-b55258d2b5609aea500fb0b011c87e9e1585cbb0.tar.gz
incremental-dfsts-b55258d2b5609aea500fb0b011c87e9e1585cbb0.tar.bz2
incremental-dfsts-b55258d2b5609aea500fb0b011c87e9e1585cbb0.tar.xz
incremental-dfsts-b55258d2b5609aea500fb0b011c87e9e1585cbb0.zip
Improve doc of DFST
Diffstat (limited to 'edit-lens/src/Data/String')
-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)