diff options
Diffstat (limited to 'interactive-edit-lens')
-rw-r--r-- | interactive-edit-lens/src/Main.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/interactive-edit-lens/src/Main.hs b/interactive-edit-lens/src/Main.hs index c816515..21db685 100644 --- a/interactive-edit-lens/src/Main.hs +++ b/interactive-edit-lens/src/Main.hs | |||
@@ -92,6 +92,12 @@ instance Universe LineBreakState where | |||
92 | instance Finite LineBreakState | 92 | instance Finite LineBreakState |
93 | instance NFData LineBreakState | 93 | instance NFData LineBreakState |
94 | 94 | ||
95 | data SwitchState = SwitchA | SwitchB | ||
96 | deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic) | ||
97 | instance Universe SwitchState | ||
98 | instance Finite SwitchState | ||
99 | instance NFData SwitchState | ||
100 | |||
95 | dfstMap :: String -> Maybe SomeDFST | 101 | dfstMap :: String -> Maybe SomeDFST |
96 | dfstMap "double" = Just . SomeDFST $ DFST | 102 | dfstMap "double" = Just . SomeDFST $ DFST |
97 | { stInitial = () | 103 | { stInitial = () |
@@ -228,6 +234,16 @@ dfstMap "linebreak" = Just . SomeDFST $ DFST | |||
228 | ] | 234 | ] |
229 | , stAccept = Set.fromList universeF | 235 | , stAccept = Set.fromList universeF |
230 | } | 236 | } |
237 | dfstMap "switch" = Just . SomeDFST $ DFST | ||
238 | { stInitial = SwitchA | ||
239 | , stTransition = Map.fromList | ||
240 | [ ((SwitchA, 's'), (SwitchB, Seq.empty)) | ||
241 | , ((SwitchB, 's'), (SwitchA, Seq.empty)) | ||
242 | , ((SwitchA, 'p'), (SwitchA, Seq.singleton 'a')) | ||
243 | , ((SwitchB, 'p'), (SwitchB, Seq.singleton 'b')) | ||
244 | ] | ||
245 | , stAccept = Set.fromList [SwitchA, SwitchB] | ||
246 | } | ||
231 | dfstMap _ = Nothing | 247 | dfstMap _ = Nothing |
232 | 248 | ||
233 | main :: IO () | 249 | main :: IO () |