Commit 53cc9af9 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Test Trac #8030

parent 3c6448c1
{-# LANGUAGE PolyKinds, FlexibleContexts, TypeFamilies #-}
module T8030 where
-- The types of op1 and op2 are both ambiguous
-- and should be reported as such
class C (a :: k) where
type Pr a :: *
op1 :: Pr a
op2 :: Pr a -> Pr a -> Pr a
T8030.hs:9:3:
Couldn't match expected type ‘Pr a’ with actual type ‘Pr a0’
NB: ‘Pr’ is a type function, and may not be injective
The type variable ‘a0’ is ambiguous
In the ambiguity check for the type signature for ‘op1’:
op1 :: forall (k :: BOX) (a :: k). C a => Pr a
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
When checking the class method:
op1 :: forall (k :: BOX) (a :: k). C a => Pr a
In the class declaration for ‘C’
T8030.hs:10:3:
Couldn't match type ‘Pr a0’ with ‘Pr a’
NB: ‘Pr’ is a type function, and may not be injective
The type variable ‘a0’ is ambiguous
Expected type: Pr a -> Pr a -> Pr a
Actual type: Pr a0 -> Pr a0 -> Pr a0
In the ambiguity check for the type signature for ‘op2’:
op2 :: forall (k :: BOX) (a :: k). C a => Pr a -> Pr a -> Pr a
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
When checking the class method:
op2 :: forall (k :: BOX) (a :: k). C a => Pr a -> Pr a -> Pr a
In the class declaration for ‘C’
......@@ -355,3 +355,4 @@ test('T4921', normal, compile_fail, [''])
test('T9605', normal, compile_fail, [''])
test('T9999', normal, compile_fail, [''])
test('T10194', normal, compile_fail, [''])
test('T8030', normal, compile_fail, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment