blob: a58c5bdebfa7e27b73d4fe5ba3dff5155c675dae (
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
|
{-# LANGUAGE Arrows, GeneralizedNewtypeDeriving #-}
module T5267 where
import Prelude
import Control.Arrow
import Control.Category
newtype A a b c = A { unA :: a b c }
deriving (Category, Arrow)
ite :: ArrowChoice a
=> a env Bool -> A a env d -> A a env d -> A a env d
ite iA tA eA = A $ proc env ->
do i <- iA -< env
if i then unA tA -< env else unA eA -< env
ite_perm tA eA i = ite i tA eA
-- In 6.12, this worked:
ite' cA tA eA = proc x ->
do c <- cA -< x
(| (ite_perm tA eA) (returnA -< c) |)
-- but this didn't:
ite'' cA tA eA = proc x ->
do c <- cA -< x
(| ite_perm' (returnA -< c) |)
where ite_perm' i = ite i tA eA
|