summaryrefslogtreecommitdiff
path: root/testsuite/tests/indexed-types/should_compile/Roman1.hs
blob: ef053c4902b2ac605120646d58745149da04da21 (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
42
43
{-# LANGUAGE Haskell2010 #-}
{-# LANGUAGE TypeFamilies, RankNTypes #-}

-- This test made the type checker produce an
-- ill-kinded coercion term.

module Roman where

import Control.Monad.ST
import Data.Kind (Type)

type family Mut (v :: Type -> Type) :: Type -> Type -> Type
type family State (m :: Type -> Type)
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 :: Type -> Type      -- No args
                                      -- Same thing happens with one arg

type family   FState (m :: Type)
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