diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-07 16:05:24 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-05-07 16:05:24 +0200 |
commit | 27c83d26737ee597e03cd3787319b76b804d52eb (patch) | |
tree | 4c0500d939056b3fc3139764c70fddbe52a95ef3 | |
parent | 50e46d9e9b0b025afe1b433805a6f6d5df55894e (diff) | |
download | incremental-dfsts-27c83d26737ee597e03cd3787319b76b804d52eb.tar incremental-dfsts-27c83d26737ee597e03cd3787319b76b804d52eb.tar.gz incremental-dfsts-27c83d26737ee597e03cd3787319b76b804d52eb.tar.bz2 incremental-dfsts-27c83d26737ee597e03cd3787319b76b804d52eb.tar.xz incremental-dfsts-27c83d26737ee597e03cd3787319b76b804d52eb.zip |
Better DFSTs
-rw-r--r-- | edit-lens/src/Data/String/DFST.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/edit-lens/src/Data/String/DFST.hs b/edit-lens/src/Data/String/DFST.hs index 2eeb368..54a1336 100644 --- a/edit-lens/src/Data/String/DFST.hs +++ b/edit-lens/src/Data/String/DFST.hs | |||
@@ -19,7 +19,7 @@ import Control.Monad | |||
19 | 19 | ||
20 | data DFST state = DFST | 20 | data DFST state = DFST |
21 | { stInitial :: state | 21 | { stInitial :: state |
22 | , stTransition :: Map (state, Char) (state, Maybe Char) | 22 | , stTransition :: Map (state, Char) (state, String) |
23 | -- ^ All @(s, c)@-combinations not mapped are assumed to map to @(s, Nothing)@ | 23 | -- ^ All @(s, c)@-combinations not mapped are assumed to map to @(s, Nothing)@ |
24 | , stAccept :: Set state | 24 | , stAccept :: Set state |
25 | } | 25 | } |
@@ -37,6 +37,6 @@ runDFST' :: forall state. Ord state | |||
37 | runDFST' _ st [] acc = (st, acc) | 37 | runDFST' _ st [] acc = (st, acc) |
38 | runDFST' dfst@DFST{..} st (c:cs) acc | 38 | runDFST' dfst@DFST{..} st (c:cs) acc |
39 | | Just (st', mc') <- stTransition !? (st, c) | 39 | | Just (st', mc') <- stTransition !? (st, c) |
40 | = runDFST' dfst st' cs $ acc . maybe id (:) mc' | 40 | = runDFST' dfst st' cs $ acc . (mc' ++) |
41 | | otherwise | 41 | | otherwise |
42 | = runDFST' dfst st cs acc | 42 | = runDFST' dfst st cs acc |