fork download
  1. data Binary = Zero | One deriving (Enum, Eq, Show)
  2. data BinState = S0 | S1 | S2 deriving (Enum, Eq, Show)
  3.  
  4. singleOne :: FSM BinState Binary BinState
  5. singleOne =
  6. FSM
  7. { start = S0,
  8. trans = trans,
  9. accept = [S1],
  10. out = Moore $ id
  11. }
  12. where
  13. -- Can be read in a tabular style
  14. trans :: BinState -> Binary -> BinState
  15. trans S0 Zero = S0
  16. trans S0 One = S1
  17. trans S1 Zero = S1
  18. trans S1 One = S2
  19. trans S2 _ = S2
  20.  
  21.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:1: error: unknown type name ‘data’
 data Binary = Zero | One deriving (Enum, Eq, Show)
 ^~~~
prog.c:1:15: error: ‘Zero’ undeclared here (not in a function)
 data Binary = Zero | One deriving (Enum, Eq, Show)
               ^~~~
prog.c:1:22: error: ‘One’ undeclared here (not in a function)
 data Binary = Zero | One deriving (Enum, Eq, Show)
                      ^~~
prog.c:1:26: error: expected ‘,’ or ‘;’ before ‘deriving’
 data Binary = Zero | One deriving (Enum, Eq, Show)
                          ^~~~~~~~
prog.c:13:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘--’ token
     -- Can be read in a tabular style
     ^~
stdout
Standard output is empty