testsuite: Assert that testsuite ways are known
[ghc.git] / testsuite / tests / typecheck / should_compile / T14185.hs
1 {-# LANGUAGE MagicHash, UnboxedTuples, MultiParamTypeClasses, TypeFamilies,
2 FunctionalDependencies, KindSignatures, PolyKinds, DataKinds,
3 UndecidableInstances #-}
4 module T14185 where
5
6 import GHC.Types
7 import GHC.Prim
8
9
10 class Unbox (t :: *) (r :: TYPE k) | t -> r, r -> t where
11 unbox :: t -> r
12 box :: r -> t
13
14 instance Unbox Int Int# where
15 unbox (I# i) = i
16 box i = I# i
17
18 instance Unbox Char Char# where
19 unbox (C# c) = c
20 box c = C# c
21
22 instance (Unbox a a', Unbox b b') => Unbox (a,b) (# a', b' #) where
23 unbox (a,b) = (# unbox a, unbox b #)
24 box (# a, b #) = (box a, box b)
25
26 testInt :: Int
27 testInt = box (unbox 1)
28
29 testTup :: (Int, Char)
30 testTup = box (unbox (1, 'a'))