summaryrefslogtreecommitdiff
path: root/testsuite/tests/qualifieddo/should_compile/qdocompile001.hs
blob: a9b749c1700f4a21bfe4a448cff82a8f669e22c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE QualifiedDo #-}

import Prelude as P

-- Test that the context of the do shows well in the renamer
-- output.
--
-- The nested do in the renamer output must be qualified the
-- same as the outer P.do written in the source program.
--
-- > ==================== Renamer ====================
-- > Main.main
-- >   = print
-- >       $ P.do (x <- [1, 2] |
-- >               y <- P.do y@1 <- [1, 2] -- qualified!
-- >                         [1, 2]
-- >                         y)
-- >               return y
--
main =
  print $ P.do
    x <- [1, 2]
    y@1 <- [1, 2]
    [1, 2]
    P.return y