summaryrefslogtreecommitdiff
path: root/testsuite/tests/arrows/should_fail/arrowfail001.hs
blob: e106c214aa3fa9230394b81c7b6002daf7f1b05d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

{-# LANGUAGE Arrows, ExistentialQuantification #-}

-- Crashed GHC 6.4 with a lint error
-- because of the existential

-- Esa Pulkkinen <esa.pulkkinen@kotiposti.net>
-- Thomas Jäger <ThJaeger@gmail.com>

module ShouldFail where

class Foo a where foo :: a -> ()
data Bar = forall a. Foo a => Bar a

get :: Bar -> ()
get = proc x -> case x of Bar a -> foo -< a

-- This should be rejected because the left side of -< (here foo)
-- should be treated as being outside the scope of the proc: it can't
-- refer to the local variables x and a (this is enforced), nor the
-- existentially quantified type variable introduced by unwrapping x.