From ae59f17cb3d58de7afca7f441d8bcf9a718e024c Mon Sep 17 00:00:00 2001 From: Arnaud Bailly Date: Wed, 5 Nov 2025 09:15:46 +0100 Subject: handle defitions in untyped language --- lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lambda-calcul/haskell/test/Minilang/Lambda') diff --git a/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs b/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs index e7816c6..e6f05b9 100644 --- a/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs +++ b/lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs @@ -98,14 +98,14 @@ spec = parallel $ do ) `shouldSatisfy` isRight - it "parses a definition" $ do - let defStr = "(def id (lam (x) x))" - expectedAST = Def "id" (Abs ["x"] (Sym "x")) - parse defStr `shouldBe` Right expectedAST + prop "parses a definition" $ + forAll (genDef 5) $ \ast -> + let text = pretty ast + in parse text `shouldBe` Right ast spine :: AST -> Int spine = \case - App x y rest -> 1 + spine x + length rest + App x _ rest -> 1 + spine x + length rest _ -> 0 arity :: AST -> Int -- cgit v1.3.1