diff options
Diffstat (limited to 'lambda-calcul/haskell/test')
| -rw-r--r-- | lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs b/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs index 5d3e8ab..edd39df 100644 --- a/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs +++ b/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs @@ -58,6 +58,14 @@ spec = parallel $ do in nestedApp term === ar & counterexample ("Desugared term: " <> show term) + prop "parses a let-binding as a function application" $ \(Identifier ident) -> + forAll (genAst 3) $ \binding -> + forAll (genAst 2) $ \body -> + let fun = Abs [ident] body + app = App fun binding [] + in parse ("(let (" <> ident <> " " <> pretty binding <> ") " <> pretty body <> ")") + `shouldBe` Right app + spine :: AST -> Int spine = \case App x y rest -> 1 + spine x + length rest |
