Commit 80d2a085 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Test Trac #8357

parent d3710922
{-# 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
\ No newline at end of file
:l T8357.hs
:t foo
:t bar
:t both
foo :: Rec '["foo" ::: [Char]]
bar :: Rec '["bar" ::: [Char]]
both :: Rec '["foo" ::: [Char], "bar" ::: [Char]]
......@@ -155,3 +155,4 @@ test('T8116', normal, ghci_script, ['T8116.script'])
test('T8113', normal, ghci_script, ['T8113.script'])
test('T8172', normal, ghci_script, ['T8172.script'])
test('T8215', normal, ghci_script, ['T8215.script'])
test('T8357', normal, ghci_script, ['T8357.script'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment