summaryrefslogtreecommitdiff
path: root/testsuite/tests/arrows/should_compile/arrowcase1.hs
blob: 6d39b0be731b8ad912deb2f0281e691e7f8a75a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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