diff options
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/T10403.hs | 19 | ||||
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/T10403.stderr | 17 | ||||
-rw-r--r-- | testsuite/tests/partial-sigs/should_compile/all.T | 1 |
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.hs b/testsuite/tests/partial-sigs/should_compile/T10403.hs new file mode 100644 index 0000000000..a33646da5d --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T10403.hs @@ -0,0 +1,19 @@ +{-# LANGUAGE PartialTypeSignatures #-} +module T10403 where + +data I a = I a +instance Functor I where + fmap f (I a) = I (f a) + +newtype B t a = B a +instance Functor (B t) where + fmap f (B a) = B (f a) + +newtype H f = H (f ()) + +app :: H (B t) +app = h (H . I) (B ()) + +h :: _ => _ +--h :: Functor m => (a -> b) -> m a -> H m +h f b = (H . fmap (const ())) (fmap f b) diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr new file mode 100644 index 0000000000..6b0660dbad --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -0,0 +1,17 @@ + +T10403.hs:17:6: warning: + Found hole ‘_’ with inferred constraints: Functor f + In the type signature for ‘h’: _ => _ + +T10403.hs:17:11: warning: + Found hole ‘_’ with type: (a -> b) -> f a -> H f + Where: ‘f’ is a rigid type variable bound by + the inferred type of h :: Functor f => (a -> b) -> f a -> H f + at T10403.hs:19:1 + ‘b’ is a rigid type variable bound by + the inferred type of h :: Functor f => (a -> b) -> f a -> H f + at T10403.hs:19:1 + ‘a’ is a rigid type variable bound by + the inferred type of h :: Functor f => (a -> b) -> f a -> H f + at T10403.hs:19:1 + In the type signature for ‘h’: _ => _ diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index e83e070dcd..91294a580c 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -46,3 +46,4 @@ test('SomethingShowable', normal, compile, ['-ddump-types -fno-warn-partial-type test('Uncurry', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('UncurryNamed', normal, compile, ['-ddump-types -fno-warn-partial-type-signatures']) test('WarningWildcardInstantiations', normal, compile, ['-ddump-types']) +test('T10403', normal, compile, ['']) |