Commit 2120d4e2 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Test Trac #7594

parent 611105b7
{-# 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
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
......@@ -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,[''])
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