summaryrefslogtreecommitdiff
path: root/testsuite/tests/arrows/should_compile/arrowcase1.hs
blob: bc58315f507b94886dca44c5da6cdda2e2437def (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