File: proc-forms2.hs

package info (click to toggle)
haskell-ormolu 0.7.2.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,528 kB
  • sloc: haskell: 16,077; makefile: 7
file content (41 lines) | stat: -rw-r--r-- 864 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
{-# LANGUAGE Arrows #-}

bar0 f g h x =
  proc (y, z) ->
    (|   test (h f.(h g)  -<  (y x).y z)((h g)  .  h f-<y z  .  (y x))   |)

bar1 f g x y = proc _ -> (f -< x)&&&(g -< y)

bar2 f g h x =
  proc (y, z) ->
    (h f.(h g)  -<  (y x).y z) ||| ((h g)  .  h f-<y z  .  (y x))

bar3 f g h x =
  proc (y, z) ->
    ((h f.h g)
      -<  (y x).y z)
  |||
    ((h g  .  h f)
      -<y z  .  (y x))

bar4 = proc x -> case x of
    Just f -> f -< ()
    Nothing -> x -< ()
 <+> do
         g -< x

expr' = proc x -> do
                returnA -< x
        <+> do
                symbol Plus -< ()
                y <- term -< ()
                expr' -< x + y
        <+> do
                symbol Minus -< ()
                y <- term -< ()
                expr' -< x - y

bar f = proc (a, b) -> do
    (f a -< b)
      >-> (\y -> f b >- a)
      >-> (\y -> f b >- a)