never executed always true always false
    1 module HelVM.HelMA.Automata.BrainFuck.Common.SimpleInstruction where
    2 
    3 import qualified Text.Read
    4 import qualified Text.Show
    5 
    6 charToSimpleInstruction :: Char -> Maybe SimpleInstruction
    7 charToSimpleInstruction = readMaybe . one
    8 
    9 simpleInstructions :: [SimpleInstruction]
   10 simpleInstructions = [MoveR , MoveL , Inc , Dec , Output , Input]
   11 
   12 data SimpleInstruction =
   13     MoveR
   14   | MoveL
   15   | Inc
   16   | Dec
   17   | Output
   18   | Input
   19   deriving stock (Bounded , Enum , Eq)
   20 
   21 instance Show SimpleInstruction where
   22   show MoveR  = ">"
   23   show MoveL  = "<"
   24   show Inc    = "+"
   25   show Dec    = "-"
   26   show Output = "."
   27   show Input  = ","
   28 
   29 instance Read SimpleInstruction where
   30   readsPrec _ ">" = [( MoveR  , "")]
   31   readsPrec _ "<" = [( MoveL  , "")]
   32   readsPrec _ "+" = [( Inc    , "")]
   33   readsPrec _ "-" = [( Dec    , "")]
   34   readsPrec _ "." = [( Output , "")]
   35   readsPrec _ "," = [( Input  , "")]
   36   readsPrec _  _  = []