never executed always true always false
    1 module HelVM.HelMA.Automata.LazyK.Parser (
    2   parse,
    3 ) where
    4 
    5 import           HelVM.HelMA.Automata.LazyK.Lambda
    6 import           HelVM.HelMA.Automata.LazyK.Lexer
    7 
    8 import           HelVM.HelMA.Automaton.API.IOTypes
    9 import           HelVM.HelMA.Automaton.ReadPExtra
   10 
   11 import           HelVM.HelIO.Control.Safe
   12 
   13 import           Text.ParserCombinators.ReadP      hiding (many)
   14 
   15 parse :: MonadSafe m => Source -> m Lambda
   16 parse = parseCode . filterComments
   17 
   18 parseCode :: MonadSafe m => Source -> m Lambda
   19 parseCode = runParser appParser
   20 
   21 appParser :: ReadP Lambda
   22 appParser = foldlLambda <$> manyNonEmpty lambdaParser
   23 
   24 lambdaParser :: ReadP Lambda
   25 lambdaParser =
   26        S <$ oneOf "sS"
   27   <|>  K <$ oneOf "kK"
   28   <|>  I <$ oneOf "iI"
   29   <|>  App <$ char '`' <*> lambdaParser <*> lambdaParser
   30   <|>  char '(' *> appParser <* char ')'