File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{-# LANGUAGE FlexibleContexts #-}
2+ {-# LANGUAGE TypeFamilies #-}
23
34module Opaleye.Table (module Opaleye.Table ,
45 -- * Other
@@ -22,6 +23,10 @@ import qualified Opaleye.Internal.HaskellDB.PrimQuery as HPQ
2223
2324import qualified Opaleye.Internal.Schema as S
2425
26+ type family ColumnFromTableColumn a
27+ type instance ColumnFromTableColumn (TM. TableColumn a ) = (Column a )
28+ type instance ColumnFromTableColumn (a , b ) = (ColumnFromTableColumn a , ColumnFromTableColumn b )
29+
2530-- | Example type specialization:
2631--
2732-- @
@@ -34,7 +39,7 @@ import qualified Opaleye.Internal.Schema as S
3439-- @
3540-- queryTable :: Table w (Foo (Column a) (Column b) (Column c)) -> Query (Foo (Column a) (Column b) (Column c))
3641-- @
37- queryTable :: (D. Default TM. ColumnMaker columns columns , D. Default TM. TableProjector tableColumns columns ) =>
42+ queryTable :: (D. Default TM. ColumnMaker columns columns , D. Default TM. TableProjector tableColumns columns , ColumnFromTableColumn tableColumns ~ columns ) =>
3843 Table a tableColumns -> Q. Query columns
3944queryTable = queryTableExplicit D. def D. def
4045
You can’t perform that action at this time.
0 commit comments