diff options
Diffstat (limited to 'testsuite/tests/arrows/should_compile/arrowcase1.hs')
-rw-r--r-- | testsuite/tests/arrows/should_compile/arrowcase1.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/arrows/should_compile/arrowcase1.hs b/testsuite/tests/arrows/should_compile/arrowcase1.hs new file mode 100644 index 0000000000..6d39b0be73 --- /dev/null +++ b/testsuite/tests/arrows/should_compile/arrowcase1.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE Arrows #-} + +module ShouldCompile where + +import Control.Arrow + +h :: ArrowChoice a => Int -> a (Int,Int) Int +h x = proc (y,z) -> case compare x y of + LT -> returnA -< x + EQ -> returnA -< y+z + GT -> returnA -< z+x + +g :: ArrowChoice a => Int -> a (Int,Int) Int +g x = proc (y,z) -> (case compare x y of + LT -> \ a -> returnA -< x+a + EQ -> \ b -> returnA -< y+z+b + GT -> \ c -> returnA -< z+x + ) 1 |