blob: 82a34afdc6e48a038fabc817e1e28bb0351d7ed9 (
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
|
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# 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
|