on 2cdc394 help sign in
rel8/src/Rel8/Table/ADT.hs
46 lines 1.0 kB history raw
1{-# language DataKinds #-}
2{-# language StandaloneKindSignatures #-}
3{-# language TypeFamilies #-}
4{-# language UndecidableInstances #-}
6module Rel8.Table.ADT
7 ( ADT( ADT )
8 )
9where
11-- base
12import Prelude ()
14-- rel8
15import Rel8.Generic.Rel8able
16 ( Rel8able, Algebra
17 , GRep, GColumns, GContext, gfromColumns, gtoColumns
18 , GColumnsADT, gfromColumnsADT, gtoColumnsADT
19 , greify, gunreify
20 )
21import qualified Rel8.Kind.Algebra as K
22import Rel8.Schema.Context ( Col )
23import qualified Rel8.Schema.Kind as K
24import Rel8.Schema.Reify ( hreify, hunreify )
27type ADT :: K.Rel8able -> K.Rel8able
28newtype ADT t context = ADT (GColumnsADT t (Col context))
31instance Rel8able t => Rel8able (ADT t) where
32 type Algebra (ADT t) = 'K.Product
34 type GRep (ADT t) context = GRep t context
36 type GColumns (ADT t) = GColumnsADT t
37 type GContext (ADT t) context = context
39 gfromColumns = ADT
40 gtoColumns (ADT a) = a
42 gfromColumnsADT = ADT
43 gtoColumnsADT (ADT a) = a
45 greify (ADT a) = ADT (hreify a)
46 gunreify (ADT a) = ADT (hunreify a)