diff options
Diffstat (limited to 'testsuite/tests/ghc-api/exactprint/LetIn1.hs')
-rw-r--r-- | testsuite/tests/ghc-api/exactprint/LetIn1.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-api/exactprint/LetIn1.hs b/testsuite/tests/ghc-api/exactprint/LetIn1.hs new file mode 100644 index 0000000000..f1109b8f03 --- /dev/null +++ b/testsuite/tests/ghc-api/exactprint/LetIn1.hs @@ -0,0 +1,19 @@ +module LetIn1 where + +--A definition can be demoted to the local 'where' binding of a friend declaration, +--if it is only used by this friend declaration. + +--Demoting a definition narrows down the scope of the definition. +--In this example, demote the local 'pow' to 'sq' +--This example also aims to test the demoting a local declaration in 'let'. + +sumSquares x y = let sq 0=0 + sq z=z^pow + pow=2 + in sq x + sq y + + +anotherFun 0 y = sq y + where sq x = x^2 + + |