summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/Roman1.hs
blob: 491fee04c5c74466da3620e52235ac5d223ceaf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{-# 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