summaryrefslogtreecommitdiff
path: root/testsuite/tests/printer/Ppr025.hs
blob: e6637a379397891471664a86f6e3d3d22508c75c (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
27
28
29
30
31
32
33
{-# LANGUAGE Arrows #-}

operator = describe "Operators on ProcessA"$
  do
    describe "feedback" $
      do
        it "acts like local variable with hold." $
          do
            let
                foo = bar $
                  do
                    return 4
                pa = proc evx ->
                  do
                    (\evy -> hold 10 -< evy)
                      `feedback` \y ->
                      do
                        returnA -< ((+y) <$> evx, (y+1) <$ evx)
            run pa [1, 2, 3] `shouldBe` [11, 13, 15]

        it "correctly handles stream end." $
          do
            let
                pa = proc x ->
                    (\asx -> returnA -< asx)
                  `feedback`
                    (\asy -> returnA -< (asy::Event Int, x))
                comp = mkProc (PgPush PgStop) >>> pa
            stateProc comp [0, 0] `shouldBe` ([], [0])

        it "correctly handles stream end.(2)" $
          do
            pendingWith "many utilities behave incorrectly at end of stream."