Skip to content

Commit

Permalink
Add a test for nested where-clauses calling outer where-clause
Browse files Browse the repository at this point in the history
  • Loading branch information
anka-213 committed Sep 18, 2024
1 parent 528a7f2 commit 13ccde1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/Where.agda
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ ex4 b = mult 42
ex4' : Bool Nat
ex4' b = mult (bool2nat b)
where
extra : Nat
extra = 14
mult : Nat Nat
mult n = bump n (bool2nat b)
where
bump : Nat Nat Nat
bump x y = go (x * y) (n - bool2nat b)
where
go : Nat Nat Nat
go z w = z + x + w + y + n + bool2nat b
go z w = z + x + w + y + n + bool2nat b + extra

-- with pattern matching and multiple clauses
ex5 : List Nat Nat
Expand Down
4 changes: 3 additions & 1 deletion test/golden/Where.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ ex4 b = mult 42
ex4' :: Bool -> Natural
ex4' b = mult (bool2nat b)
where
extra :: Natural
extra = 14
mult :: Natural -> Natural
mult n = bump n (bool2nat b)
where
bump :: Natural -> Natural -> Natural
bump x y = go (x * y) (n - bool2nat b)
where
go :: Natural -> Natural -> Natural
go z w = z + x + w + y + n + bool2nat b
go z w = z + x + w + y + n + bool2nat b + extra

ex5 :: [Natural] -> Natural
ex5 [] = zro
Expand Down

0 comments on commit 13ccde1

Please sign in to comment.