tc137.hs 732 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# OPTIONS -fglasgow-exts -dcore-lint #-}

{- 	 This one killed GHC 5.02

The problem is that in rather obscure cases (involving functional
dependencies) it is possible to get an AbsBinds [] [] (no tyvars, no
dicts) which nevertheless has some "dictionary bindings".  These come
out of the typechecker in non-dependency order, so we need to Rec them
just in case.   Otherwise we get a CoreLint out-of-scope error.

Reported by Armin Groesslinger

-}

module ShouldCompile
16
where
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

data X a = X a

class Y a b | a -> b where
    y :: a -> X b

instance Y [[a]] a where
    y ((x:_):_) = X x

g :: Num a => [X a] -> [X a]
g xs = h xs
    where
    h ys = ys ++ map (k (y [[0]])) xs

k :: X a -> X a -> X a
k _ _ = y ([] ++ [[]] ++ [])