diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-18 17:30:25 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-18 17:30:25 +0000 |
commit | 2120d4e2a8142e114950a472072356b427037be8 (patch) | |
tree | bf93fa451796ae7c5e07510ecf5a5b1b33481408 /testsuite/tests/polykinds | |
parent | 611105b70f97f17eaf590d7173d7b5ca05d67691 (diff) | |
download | haskell-2120d4e2a8142e114950a472072356b427037be8.tar.gz |
Test Trac #7594
Diffstat (limited to 'testsuite/tests/polykinds')
-rw-r--r-- | testsuite/tests/polykinds/T7594.hs | 27 | ||||
-rw-r--r-- | testsuite/tests/polykinds/T7594.stderr | 19 | ||||
-rw-r--r-- | testsuite/tests/polykinds/all.T | 1 |
3 files changed, 47 insertions, 0 deletions
diff --git a/testsuite/tests/polykinds/T7594.hs b/testsuite/tests/polykinds/T7594.hs new file mode 100644 index 0000000000..89e749ce36 --- /dev/null +++ b/testsuite/tests/polykinds/T7594.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE KindSignatures #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE Rank2Types #-} +module T7594 where + +import GHC.Prim (Constraint) + +class (c1 t, c2 t) => (:&:) (c1 :: * -> Constraint) (c2 :: * -> Constraint) (t :: *) +instance (c1 t, c2 t) => (:&:) c1 c2 t + +data ColD c where + ColD :: (c a) => a -> ColD c + +app :: (forall a. (c a) => a -> b) -> ColD c -> b +app f (ColD x) = f x + +q :: ColD (Show :&: Real) +q = ColD (1.2 :: Double) + +bar = app print q + + diff --git a/testsuite/tests/polykinds/T7594.stderr b/testsuite/tests/polykinds/T7594.stderr new file mode 100644 index 0000000000..4be0b0a18f --- /dev/null +++ b/testsuite/tests/polykinds/T7594.stderr @@ -0,0 +1,19 @@ +h0 +h1 +h2 + +T7594.hs:25:11: + Couldn't match type `b' with `IO ()' + `b' is untouchable + inside the constraints ((:&:) Show Real a) + bound by a type expected by the context: + (:&:) Show Real a => a -> b + at T7594.hs:25:7-17 + `b' is a rigid type variable bound by + the inferred type of bar :: b at T7594.hs:25:1 + Expected type: a -> b + Actual type: a -> IO () + Relevant bindings include bar :: b (bound at T7594.hs:25:1) + In the first argument of `app', namely `print' + In the expression: app print q + In an equation for `bar': bar = app print q diff --git a/testsuite/tests/polykinds/all.T b/testsuite/tests/polykinds/all.T index 99f8424fa6..d84048f1c8 100644 --- a/testsuite/tests/polykinds/all.T +++ b/testsuite/tests/polykinds/all.T @@ -82,3 +82,4 @@ test('T7438', normal, run_command, ['$MAKE -s --no-print-directory T7438']) test('T7404', normal, compile_fail,['']) test('T7502', normal, compile,['']) test('T7488', normal, compile,['']) +test('T7594', normal, compile_fail,['']) |