From ee93e3434ecb050f344b45d075e93429e8ebe22d Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Mon, 27 Oct 2025 16:48:13 +0100 Subject: Parse let expressions --- lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs') 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 -- cgit v1.2.3