diff options
Diffstat (limited to 'testsuite/tests/arrows/should_compile/arrowform1.hs')
-rw-r--r-- | testsuite/tests/arrows/should_compile/arrowform1.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/arrows/should_compile/arrowform1.hs b/testsuite/tests/arrows/should_compile/arrowform1.hs new file mode 100644 index 0000000000..a282d71ed7 --- /dev/null +++ b/testsuite/tests/arrows/should_compile/arrowform1.hs @@ -0,0 +1,30 @@ +{-# LANGUAGE Arrows #-} + +module ShouldCompile where + +import Control.Arrow + +handle :: ArrowPlus a => a b c -> a (b,String) c -> a b c +handle f h = proc b -> (f -< b) <+> (h -< (b,"")) + +f :: ArrowPlus a => a (Int,Int) String +f = proc (x,y) -> + (|handle + (returnA -< show y) + (\s -> returnA -< s ++ show x) + |) + +g :: ArrowPlus a => a (Int,Int) String +g = proc (x,y) -> + (|handle + (\msg -> returnA -< msg ++ show y) + (\s msg -> returnA -< s ++ show x) + |) ("hello " ++ show x) + +h :: ArrowPlus a => a (Int,Int) Int +h = proc (x,y) -> + ( + (\z -> returnA -< x + z) + <+> + (\z -> returnA -< y + z) + ) (x*y) |