blob: 57381fabeaa7ae8505ebfb5bfd31fba8492050c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE FlexibleInstances, UndecidableInstances,
MultiParamTypeClasses, FunctionalDependencies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
-- 'x' and 'v' are ambiguous
-- #1564
module Foo where
import Text.PrettyPrint
import Prelude hiding(head,tail)
class FooBar m k l | m -> k l where
a :: m graphtype
instance FooBar [] Bool Bool where
a = error "urk"
instance FooBar Maybe Int Int where
a = error "urk"
class (Monad m)=>Gr g ep m where
x:: m Int
v:: m Int
instance (Monad m, FooBar m x z) => Gr g ep m where
x = error "urk"
v = error "urk"
-- Old GHC claims for y: y :: (Monad m, FooBar m GHC.Prim.Any GHC.Prim.Any)
-- => m Int (which is wrong)
-- The uses in foo and bar show if that happens
y () = x
foo :: [Int]
foo = y ()
bar :: Maybe Int
bar = y ()
|