data Binary = Zero | One deriving (Enum, Eq, Show) data BinState = S0 | S1 | S2 deriving (Enum, Eq, Show) singleOne :: FSM BinState Binary BinState singleOne = FSM { start = S0, trans = trans, accept = [S1], out = Moore $ id } where -- Can be read in a tabular style trans :: BinState -> Binary -> BinState trans S0 Zero = S0 trans S0 One = S1 trans S1 Zero = S1 trans S1 One = S2 trans S2 _ = S2