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