summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/test/Minilang
diff options
context:
space:
mode:
Diffstat (limited to 'lambda-calcul/haskell/test/Minilang')
-rw-r--r--lambda-calcul/haskell/test/Minilang/Lambda/ParserSpec.hs8
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