From 537ac8a2ecb64a141ec8ffc1ab053e84154c4f09 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 4 Jun 2019 11:11:57 +0200 Subject: Cleanup --- interactive-edit-lens/src/Main.hs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'interactive-edit-lens') 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 instance Finite LineBreakState instance NFData LineBreakState +data SwitchState = SwitchA | SwitchB + deriving (Eq, Ord, Enum, Bounded, Show, Read, Generic) +instance Universe SwitchState +instance Finite SwitchState +instance NFData SwitchState + dfstMap :: String -> Maybe SomeDFST dfstMap "double" = Just . SomeDFST $ DFST { stInitial = () @@ -228,6 +234,16 @@ dfstMap "linebreak" = Just . SomeDFST $ DFST ] , stAccept = Set.fromList universeF } +dfstMap "switch" = Just . SomeDFST $ DFST + { stInitial = SwitchA + , stTransition = Map.fromList + [ ((SwitchA, 's'), (SwitchB, Seq.empty)) + , ((SwitchB, 's'), (SwitchA, Seq.empty)) + , ((SwitchA, 'p'), (SwitchA, Seq.singleton 'a')) + , ((SwitchB, 'p'), (SwitchB, Seq.singleton 'b')) + ] + , stAccept = Set.fromList [SwitchA, SwitchB] + } dfstMap _ = Nothing main :: IO () -- cgit v1.2.3