summaryrefslogtreecommitdiff
path: root/testsuite/tests/th/ClosedFam2TH.hs
blob: 2a8b3b4ab6feb7adc8aeae917fc3d59a0863331f (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
{-# LANGUAGE TemplateHaskell, TypeFamilies, PolyKinds #-}

module ClosedFam2 where

import Language.Haskell.TH

$( return [ ClosedTypeFamilyD
              (TypeFamilyHead
                (mkName "Equals")
                [ KindedTV (mkName "a") (VarT (mkName "k"))
                , KindedTV (mkName "b") (VarT (mkName "k")) ]
                ( TyVarSig (KindedTV (mkName "r") (VarT (mkName "k"))))
                Nothing)
              [ TySynEqn Nothing
                         [ (VarT (mkName "a"))
                         , (VarT (mkName "a")) ]
                         (ConT (mkName "Int"))
              , TySynEqn Nothing
                         [ (VarT (mkName "a"))
                         , (VarT (mkName "b")) ]
                         (ConT (mkName "Bool")) ] ])

a :: Equals b b
a = (5 :: Int)

b :: Equals Int Bool
b = False