Commit fb17b356 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Add test for type families, discovered by Roman

Tests this patch:

  Fri Dec 11 12:01:22 GMT 2009  simonpj@microsoft.com
    * Fix two related bugs in u_tys
    
    When we normalise a type family application we must recursively call
    uTys, *not* 'go', because the latter loop is only there to look
    through type synonyms.  This bug made the type checker generate
    ill-typed coercions, which were rejected by Core Lint.
    
    A related bug only affects the size of coercions.  If faced with
      (m a) ~ (F b c)
    where F has arity 1, we want to decompose to 
       m ~ F Int,  a ~ c
    rather than deferring.  The application decomposition was being
    tried last, so we were missing this opportunity.
parent 51a66fcc
{-# LANGUAGE TypeFamilies, Rank2Types #-}
-- This test made the type checker produce an
-- ill-kinded coercion term.
module Roman where
import Control.Monad.ST
type family Mut (v :: * -> *) :: * -> * -> *
type family State (m :: * -> *)
type instance State (ST s) = s
unsafeFreeze :: Mut v (State (ST s)) a -> ST s (v a)
unsafeFreeze = undefined
new :: (forall v s. ST s (v s a)) -> v a
new p = runST (do
mv <- p
unsafeFreeze mv)
---------------------------------------------
-- Here's a simpler version that also failed
type family FMut :: * -> * -- No args
-- Same thing happens with one arg
type family FState (m :: *)
type instance FState Char = Int
funsafeFreeze :: FMut (FState Char) -> ()
funsafeFreeze = undefined
flop :: forall mv. mv Int
flop = undefined
noo = flop `rapp` funsafeFreeze
rapp :: a -> (a->()) -> ()
rapp arg fun = fun arg
......@@ -138,3 +138,4 @@ test('T2850', normal, compile, [''])
test('T3220', if_compiler_lt('ghc', '6.11', expect_fail), compile, [''])
test('T3590', normal, compile, [''])
test('CoTest3', if_compiler_lt('ghc', '6.13', expect_fail), compile, [''])
test('Roman1', if_compiler_lt('ghc', '6.13', expect_fail), compile, [''])
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