-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tables.hs
25 lines (18 loc) · 862 Bytes
/
Tables.hs
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
{-# LANGUAGE GADTs, DataKinds, KindSignatures, TypeOperators, TypeFamilies,
MultiParamTypeClasses, FlexibleInstances, PolyKinds,
FlexibleContexts, UndecidableInstances, ConstraintKinds,
ScopedTypeVariables, TypeInType, TypeOperators, StandaloneDeriving,
AllowAmbiguousTypes, TypeApplications #-}
module Tables where
import Common
import Label
import GHC.TypeLits
import Data.Type.Set
type Tables = [Symbol]
type DisjointTables ts1 ts2 = OkOrError (IsDisjoint ts1 ts2) ('Text "The tables are not disjoint.")
class RecoverTables t where
recover_tables :: Proxy t -> [String]
instance RecoverTables '[] where
recover_tables Proxy = []
instance (RecoverTables xs, KnownSymbol x) => RecoverTables (x ': xs) where
recover_tables Proxy = symbolVal (Proxy :: Proxy x) : recover_tables (Proxy :: Proxy xs)