blob: 29fe7a85bbb081c74aa1d96caffe0293572668a1 (
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
|
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
module T8357 where
import GHC.TypeLits
data (:::) (sy :: Symbol) ty
data Key (sy :: Symbol)
data Rec (rs :: [*])
(*=) :: Key sy -> ty -> Rec '[sy ::: ty]
(*=) = undefined
(.*.) :: (Union xs ys ~ rs) => Rec xs -> Rec ys -> Rec rs
(.*.) = undefined
type family Union (xs :: [*]) (ys :: [*]) :: [*] where
Union ((sy ::: t) ': xs) ys = (sy ::: t) ': Union xs ys
Union '[] ys = ys
fFoo :: Key "foo"
fFoo = undefined
fBar :: Key "bar"
fBar = undefined
foo = fFoo *= "foo"
bar = fBar *= "bar"
both = foo .*. bar
|