summaryrefslogtreecommitdiff
path: root/testsuite/tests/quantified-constraints/T17267b.hs
blob: 5f0ffdf6e1c9db996a3b4361d7087e43c86af4f5 (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
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

module T17267b where

-- Now rejected
uc :: a -> b
uc = oops where
  oops :: (a ~ b => a ~ b) => a -> b
  oops x = x

{-
Consider the ambiguity check for oops.

[G] (a ~ b => a ~ b)
[W] (a ~ b => a ~ b)
==>

[G] (a ~ b => a ~ b)
[G] (a ~# b)     was [G] (a ~ b) [G] a ~# b

kick out the QC and (old) (a~b)
[G] (b ~ b => b ~ b)    Quantified constraint
[G] (a ~# b)     was [G] (b ~ b) [G] a ~# b

[W] (a~b)   DictCt

Wanted is rewritten
   (b~b)    DictCt
-}