Embrace -XTypeInType, add -XStarIsType
[ghc.git] / testsuite / tests / ghci / scripts / T8357.hs
1 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2 {-# LANGUAGE TypeFamilies #-}
3 {-# LANGUAGE DataKinds #-}
4 {-# LANGUAGE KindSignatures #-}
5 {-# LANGUAGE TypeOperators #-}
6 module T8357 where
7
8 import Data.Kind (Type)
9 import GHC.TypeLits
10
11 data (:::) (sy :: Symbol) ty
12 data Key (sy :: Symbol)
13 data Rec (rs :: [Type])
14
15 (*=) :: Key sy -> ty -> Rec '[sy ::: ty]
16 (*=) = undefined
17
18 (.*.) :: (Union xs ys ~ rs) => Rec xs -> Rec ys -> Rec rs
19 (.*.) = undefined
20
21 type family Union (xs :: [Type]) (ys :: [Type]) :: [Type] where
22 Union ((sy ::: t) ': xs) ys = (sy ::: t) ': Union xs ys
23 Union '[] ys = ys
24
25
26 fFoo :: Key "foo"
27 fFoo = undefined
28
29 fBar :: Key "bar"
30 fBar = undefined
31
32 foo = fFoo *= "foo"
33 bar = fBar *= "bar"
34 both = foo .*. bar