{-# OPTIONS_GHC -fno-warn-unticked-promoted-constructors#-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CPP #-}

module Database.Beam.Query.Internal where

import           Database.Beam.Backend.Types
import           Database.Beam.Backend.SQL
import           Database.Beam.Schema.Tables

import qualified Data.DList as DList
import           Data.Functor.Const
import           Data.String
import qualified Data.Text as T
import           Data.Typeable
import           Data.Vector.Sized (Vector)
import qualified Data.Vector.Sized as VS
#if !MIN_VERSION_base(4, 11, 0)
import           Data.Semigroup
#endif

import           Control.Monad.Free.Church
import           Control.Monad.State
import           Control.Monad.Writer

import           GHC.TypeLits
import           GHC.Types

import           Unsafe.Coerce

type ProjectibleInBackend be a =
  ( Projectible be a
  , ProjectibleValue be a )

type TablePrefix = T.Text

data QF be (db :: (Type -> Type) -> Type) s next where
  QDistinct :: Projectible be r
            => (r -> WithExprContext (BeamSqlBackendSetQuantifierSyntax be))
            -> QM be db s r -> (r -> next) -> QF be db s next

  QAll :: Projectible be r
       => (TablePrefix -> T.Text -> BeamSqlBackendFromSyntax be)
       -> (T.Text -> r)
       -> (r -> Maybe (WithExprContext (BeamSqlBackendExpressionSyntax be)))
       -> ((T.Text, r) -> next) -> QF be db s next

  QArbitraryJoin :: Projectible be r
                 => QM be db (QNested s) r
                 -> (BeamSqlBackendFromSyntax be -> BeamSqlBackendFromSyntax be ->
                     Maybe (BeamSqlBackendExpressionSyntax be) ->
                     BeamSqlBackendFromSyntax be)
                 -> (r -> Maybe (WithExprContext (BeamSqlBackendExpressionSyntax be)))
                 -> (r -> next)
                 -> QF be db s next
  QTwoWayJoin :: ( Projectible be a
                 , Projectible be b )
              => QM be db (QNested s) a
              -> QM be db (QNested s) b
              -> (BeamSqlBackendFromSyntax be -> BeamSqlBackendFromSyntax be ->
                  Maybe (BeamSqlBackendExpressionSyntax be) ->
                  BeamSqlBackendFromSyntax be)
              -> ((a, b) -> Maybe (WithExprContext (BeamSqlBackendExpressionSyntax be)))
              -> ((a, b) -> next)
              -> QF be db s next

  QSubSelect :: Projectible be r
             => QM be db (QNested s) r -> (r -> next)
             -> QF be db s next

  QGuard :: WithExprContext (BeamSqlBackendExpressionSyntax be) -> next -> QF be db s next

  QLimit  :: Projectible be r => Integer -> QM be db (QNested s) r -> (r -> next) -> QF be db s next
  QOffset :: Projectible be r => Integer -> QM be db (QNested s) r -> (r -> next) -> QF be db s next

  QSetOp :: Projectible be r
         => (BeamSqlBackendSelectTableSyntax be -> BeamSqlBackendSelectTableSyntax be -> BeamSqlBackendSelectTableSyntax be)
         -> QM be db (QNested s) r
         -> QM be db (QNested s) r -> (r -> next)
         -> QF be db s next

  QOrderBy :: Projectible be r
           => (r -> WithExprContext [ BeamSqlBackendOrderingSyntax be ])
           -> QM be db (QNested s) r -> (r -> next) -> QF be db s next

  QWindowOver :: ( ProjectibleWithPredicate WindowFrameContext be (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)) window
                 , Projectible be r
                 , Projectible be a )
              => (r -> window) -> (r -> window -> a)
              -> QM be db (QNested s) r -> (a -> next) -> QF be db s next

  QAggregate :: ( Projectible be grouping
                , Projectible be a )
             => (a -> TablePrefix -> (Maybe (BeamSqlBackendGroupingSyntax be), grouping))
             -> QM be db (QNested s) a
             -> (grouping -> next)
             -> QF be db s next

  -- Force the building of a select statement, using the given builder
  QForceSelect :: Projectible be r
               => (r -> BeamSqlBackendSelectTableSyntax be -> [ BeamSqlBackendOrderingSyntax be ] ->
                   Maybe Integer -> Maybe Integer -> BeamSqlBackendSelectSyntax be)
               -> QM be db (QNested s) r
               -> (r -> next)
               -> QF be db s next

deriving instance Functor (QF be db s)

type QM be db s = F (QF be db s)

-- | The type of queries over the database `db` returning results of type `a`.
-- The `s` argument is a threading argument meant to restrict cross-usage of
-- `QExpr`s. 'syntax' represents the SQL syntax that this query is building.
newtype Q be (db :: (Type -> Type) -> Type) s a
  = Q { Q be db s a -> QM be db s a
runQ :: QM be db s a }
    deriving (Applicative (Q be db s)
a -> Q be db s a
Applicative (Q be db s)
-> (forall a b. Q be db s a -> (a -> Q be db s b) -> Q be db s b)
-> (forall a b. Q be db s a -> Q be db s b -> Q be db s b)
-> (forall a. a -> Q be db s a)
-> Monad (Q be db s)
Q be db s a -> (a -> Q be db s b) -> Q be db s b
Q be db s a -> Q be db s b -> Q be db s b
forall a. a -> Q be db s a
forall a b. Q be db s a -> Q be db s b -> Q be db s b
forall a b. Q be db s a -> (a -> Q be db s b) -> Q be db s b
forall be (db :: (* -> *) -> *) s. Applicative (Q be db s)
forall be (db :: (* -> *) -> *) s a. a -> Q be db s a
forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> Q be db s b -> Q be db s b
forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> (a -> Q be db s b) -> Q be db s b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: a -> Q be db s a
$creturn :: forall be (db :: (* -> *) -> *) s a. a -> Q be db s a
>> :: Q be db s a -> Q be db s b -> Q be db s b
$c>> :: forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> Q be db s b -> Q be db s b
>>= :: Q be db s a -> (a -> Q be db s b) -> Q be db s b
$c>>= :: forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> (a -> Q be db s b) -> Q be db s b
$cp1Monad :: forall be (db :: (* -> *) -> *) s. Applicative (Q be db s)
Monad, Functor (Q be db s)
a -> Q be db s a
Functor (Q be db s)
-> (forall a. a -> Q be db s a)
-> (forall a b. Q be db s (a -> b) -> Q be db s a -> Q be db s b)
-> (forall a b c.
    (a -> b -> c) -> Q be db s a -> Q be db s b -> Q be db s c)
-> (forall a b. Q be db s a -> Q be db s b -> Q be db s b)
-> (forall a b. Q be db s a -> Q be db s b -> Q be db s a)
-> Applicative (Q be db s)
Q be db s a -> Q be db s b -> Q be db s b
Q be db s a -> Q be db s b -> Q be db s a
Q be db s (a -> b) -> Q be db s a -> Q be db s b
(a -> b -> c) -> Q be db s a -> Q be db s b -> Q be db s c
forall a. a -> Q be db s a
forall a b. Q be db s a -> Q be db s b -> Q be db s a
forall a b. Q be db s a -> Q be db s b -> Q be db s b
forall a b. Q be db s (a -> b) -> Q be db s a -> Q be db s b
forall a b c.
(a -> b -> c) -> Q be db s a -> Q be db s b -> Q be db s c
forall be (db :: (* -> *) -> *) s. Functor (Q be db s)
forall be (db :: (* -> *) -> *) s a. a -> Q be db s a
forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> Q be db s b -> Q be db s a
forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> Q be db s b -> Q be db s b
forall be (db :: (* -> *) -> *) s a b.
Q be db s (a -> b) -> Q be db s a -> Q be db s b
forall be (db :: (* -> *) -> *) s a b c.
(a -> b -> c) -> Q be db s a -> Q be db s b -> Q be db s c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: Q be db s a -> Q be db s b -> Q be db s a
$c<* :: forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> Q be db s b -> Q be db s a
*> :: Q be db s a -> Q be db s b -> Q be db s b
$c*> :: forall be (db :: (* -> *) -> *) s a b.
Q be db s a -> Q be db s b -> Q be db s b
liftA2 :: (a -> b -> c) -> Q be db s a -> Q be db s b -> Q be db s c
$cliftA2 :: forall be (db :: (* -> *) -> *) s a b c.
(a -> b -> c) -> Q be db s a -> Q be db s b -> Q be db s c
<*> :: Q be db s (a -> b) -> Q be db s a -> Q be db s b
$c<*> :: forall be (db :: (* -> *) -> *) s a b.
Q be db s (a -> b) -> Q be db s a -> Q be db s b
pure :: a -> Q be db s a
$cpure :: forall be (db :: (* -> *) -> *) s a. a -> Q be db s a
$cp1Applicative :: forall be (db :: (* -> *) -> *) s. Functor (Q be db s)
Applicative, a -> Q be db s b -> Q be db s a
(a -> b) -> Q be db s a -> Q be db s b
(forall a b. (a -> b) -> Q be db s a -> Q be db s b)
-> (forall a b. a -> Q be db s b -> Q be db s a)
-> Functor (Q be db s)
forall a b. a -> Q be db s b -> Q be db s a
forall a b. (a -> b) -> Q be db s a -> Q be db s b
forall be (db :: (* -> *) -> *) s a b.
a -> Q be db s b -> Q be db s a
forall be (db :: (* -> *) -> *) s a b.
(a -> b) -> Q be db s a -> Q be db s b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> Q be db s b -> Q be db s a
$c<$ :: forall be (db :: (* -> *) -> *) s a b.
a -> Q be db s b -> Q be db s a
fmap :: (a -> b) -> Q be db s a -> Q be db s b
$cfmap :: forall be (db :: (* -> *) -> *) s a b.
(a -> b) -> Q be db s a -> Q be db s b
Functor)

data QInternal
data QNested s

data QField s ty
  = QField
  { QField s ty -> Bool
qFieldShouldQualify :: !Bool
  , QField s ty -> Text
qFieldTblName       :: !T.Text
  , QField s ty -> Text
qFieldName          :: !T.Text }
  deriving (Int -> QField s ty -> ShowS
[QField s ty] -> ShowS
QField s ty -> String
(Int -> QField s ty -> ShowS)
-> (QField s ty -> String)
-> ([QField s ty] -> ShowS)
-> Show (QField s ty)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall s ty. Int -> QField s ty -> ShowS
forall s ty. [QField s ty] -> ShowS
forall s ty. QField s ty -> String
showList :: [QField s ty] -> ShowS
$cshowList :: forall s ty. [QField s ty] -> ShowS
show :: QField s ty -> String
$cshow :: forall s ty. QField s ty -> String
showsPrec :: Int -> QField s ty -> ShowS
$cshowsPrec :: forall s ty. Int -> QField s ty -> ShowS
Show, QField s ty -> QField s ty -> Bool
(QField s ty -> QField s ty -> Bool)
-> (QField s ty -> QField s ty -> Bool) -> Eq (QField s ty)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall s ty. QField s ty -> QField s ty -> Bool
/= :: QField s ty -> QField s ty -> Bool
$c/= :: forall s ty. QField s ty -> QField s ty -> Bool
== :: QField s ty -> QField s ty -> Bool
$c== :: forall s ty. QField s ty -> QField s ty -> Bool
Eq, Eq (QField s ty)
Eq (QField s ty)
-> (QField s ty -> QField s ty -> Ordering)
-> (QField s ty -> QField s ty -> Bool)
-> (QField s ty -> QField s ty -> Bool)
-> (QField s ty -> QField s ty -> Bool)
-> (QField s ty -> QField s ty -> Bool)
-> (QField s ty -> QField s ty -> QField s ty)
-> (QField s ty -> QField s ty -> QField s ty)
-> Ord (QField s ty)
QField s ty -> QField s ty -> Bool
QField s ty -> QField s ty -> Ordering
QField s ty -> QField s ty -> QField s ty
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall s ty. Eq (QField s ty)
forall s ty. QField s ty -> QField s ty -> Bool
forall s ty. QField s ty -> QField s ty -> Ordering
forall s ty. QField s ty -> QField s ty -> QField s ty
min :: QField s ty -> QField s ty -> QField s ty
$cmin :: forall s ty. QField s ty -> QField s ty -> QField s ty
max :: QField s ty -> QField s ty -> QField s ty
$cmax :: forall s ty. QField s ty -> QField s ty -> QField s ty
>= :: QField s ty -> QField s ty -> Bool
$c>= :: forall s ty. QField s ty -> QField s ty -> Bool
> :: QField s ty -> QField s ty -> Bool
$c> :: forall s ty. QField s ty -> QField s ty -> Bool
<= :: QField s ty -> QField s ty -> Bool
$c<= :: forall s ty. QField s ty -> QField s ty -> Bool
< :: QField s ty -> QField s ty -> Bool
$c< :: forall s ty. QField s ty -> QField s ty -> Bool
compare :: QField s ty -> QField s ty -> Ordering
$ccompare :: forall s ty. QField s ty -> QField s ty -> Ordering
$cp1Ord :: forall s ty. Eq (QField s ty)
Ord)

newtype QAssignment be s
  = QAssignment { QAssignment be s
-> [(BeamSqlBackendFieldNameSyntax be,
     BeamSqlBackendExpressionSyntax be)]
unQAssignment :: [(BeamSqlBackendFieldNameSyntax be, BeamSqlBackendExpressionSyntax be)] }
  deriving (Semigroup (QAssignment be s)
QAssignment be s
Semigroup (QAssignment be s)
-> QAssignment be s
-> (QAssignment be s -> QAssignment be s -> QAssignment be s)
-> ([QAssignment be s] -> QAssignment be s)
-> Monoid (QAssignment be s)
[QAssignment be s] -> QAssignment be s
QAssignment be s -> QAssignment be s -> QAssignment be s
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall be s. Semigroup (QAssignment be s)
forall be s. QAssignment be s
forall be s. [QAssignment be s] -> QAssignment be s
forall be s.
QAssignment be s -> QAssignment be s -> QAssignment be s
mconcat :: [QAssignment be s] -> QAssignment be s
$cmconcat :: forall be s. [QAssignment be s] -> QAssignment be s
mappend :: QAssignment be s -> QAssignment be s -> QAssignment be s
$cmappend :: forall be s.
QAssignment be s -> QAssignment be s -> QAssignment be s
mempty :: QAssignment be s
$cmempty :: forall be s. QAssignment be s
$cp1Monoid :: forall be s. Semigroup (QAssignment be s)
Monoid, b -> QAssignment be s -> QAssignment be s
NonEmpty (QAssignment be s) -> QAssignment be s
QAssignment be s -> QAssignment be s -> QAssignment be s
(QAssignment be s -> QAssignment be s -> QAssignment be s)
-> (NonEmpty (QAssignment be s) -> QAssignment be s)
-> (forall b.
    Integral b =>
    b -> QAssignment be s -> QAssignment be s)
-> Semigroup (QAssignment be s)
forall b. Integral b => b -> QAssignment be s -> QAssignment be s
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall be s. NonEmpty (QAssignment be s) -> QAssignment be s
forall be s.
QAssignment be s -> QAssignment be s -> QAssignment be s
forall be s b.
Integral b =>
b -> QAssignment be s -> QAssignment be s
stimes :: b -> QAssignment be s -> QAssignment be s
$cstimes :: forall be s b.
Integral b =>
b -> QAssignment be s -> QAssignment be s
sconcat :: NonEmpty (QAssignment be s) -> QAssignment be s
$csconcat :: forall be s. NonEmpty (QAssignment be s) -> QAssignment be s
<> :: QAssignment be s -> QAssignment be s -> QAssignment be s
$c<> :: forall be s.
QAssignment be s -> QAssignment be s -> QAssignment be s
Semigroup)

newtype QFieldAssignment be tbl a
  = QFieldAssignment (forall s. tbl (QExpr be s) -> Maybe (QExpr be s a))

-- * QGenExpr type

data QAggregateContext
data QGroupingContext
data QValueContext
data QWindowingContext
data QWindowFrameContext

-- | The type of lifted beam expressions that will yield the haskell type 't'.
--
--   'context' is a type-level representation of the types of expressions this
--   can contain. For example, 'QAggregateContext' represents expressions that
--   may contain aggregates, and 'QWindowingContext' represents expressions that
--   may contain @OVER@.
--
--   'syntax' is the expression syntax being built (usually a type that
--   implements 'IsSql92ExpressionSyntax' at least, but not always).
--
--   's' is a state threading parameter that prevents 'QExpr's from incompatible
--   sources to be combined. For example, this is used to prevent monadic joins
--   from depending on the result of previous joins (so-called @LATERAL@ joins).
newtype QGenExpr context be s t = QExpr (TablePrefix -> BeamSqlBackendExpressionSyntax be)
newtype QOrd be s t = QOrd (TablePrefix -> BeamSqlBackendOrderingSyntax be)

type WithExprContext a = TablePrefix -> a

-- | 'QExpr's represent expressions not containing aggregates.
type QExpr = QGenExpr QValueContext
type QAgg = QGenExpr QAggregateContext
type QWindowExpr = QGenExpr QWindowingContext
type QGroupExpr = QGenExpr QGroupingContext
--deriving instance Show syntax => Show (QGenExpr context syntax s t)
instance BeamSqlBackend be => Eq (QGenExpr context be s t) where
  QExpr Text -> BeamSqlBackendExpressionSyntax be
a == :: QGenExpr context be s t -> QGenExpr context be s t -> Bool
== QExpr Text -> BeamSqlBackendExpressionSyntax be
b = Text -> BeamSqlBackendExpressionSyntax be
a Text
"" Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Bool
forall a. Eq a => a -> a -> Bool
== Text -> BeamSqlBackendExpressionSyntax be
b Text
""

instance Retaggable (QGenExpr ctxt expr s) (QGenExpr ctxt expr s t) where
  type Retag tag (QGenExpr ctxt expr s t) = Columnar (tag (QGenExpr ctxt expr s)) t
  retag :: (forall a.
 Columnar' (QGenExpr ctxt expr s) a
 -> Columnar' (tag (QGenExpr ctxt expr s)) a)
-> QGenExpr ctxt expr s t -> Retag tag (QGenExpr ctxt expr s t)
retag forall a.
Columnar' (QGenExpr ctxt expr s) a
-> Columnar' (tag (QGenExpr ctxt expr s)) a
f QGenExpr ctxt expr s t
e = case Columnar' (QGenExpr ctxt expr s) t
-> Columnar' (tag (QGenExpr ctxt expr s)) t
forall a.
Columnar' (QGenExpr ctxt expr s) a
-> Columnar' (tag (QGenExpr ctxt expr s)) a
f (Columnar (QGenExpr ctxt expr s) t
-> Columnar' (QGenExpr ctxt expr s) t
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' Columnar (QGenExpr ctxt expr s) t
QGenExpr ctxt expr s t
e) of
                Columnar' Columnar (tag (QGenExpr ctxt expr s)) t
a -> Retag tag (QGenExpr ctxt expr s t)
Columnar (tag (QGenExpr ctxt expr s)) t
a

newtype QWindow be s = QWindow (WithExprContext (BeamSqlBackendWindowFrameSyntax be))
newtype QFrameBounds be = QFrameBounds (Maybe (BeamSqlBackendWindowFrameBoundsSyntax be))
newtype QFrameBound be = QFrameBound (BeamSqlBackendWindowFrameBoundSyntax be)

qBinOpE :: BeamSqlBackend be
        => (BeamSqlBackendExpressionSyntax be ->
            BeamSqlBackendExpressionSyntax be ->
            BeamSqlBackendExpressionSyntax be)
        -> QGenExpr context be s a -> QGenExpr context be s b
        -> QGenExpr context be s c
qBinOpE :: (BeamSqlBackendExpressionSyntax be
 -> BeamSqlBackendExpressionSyntax be
 -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
-> QGenExpr context be s b
-> QGenExpr context be s c
qBinOpE BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax be
mkOpE (QExpr Text -> BeamSqlBackendExpressionSyntax be
a) (QExpr Text -> BeamSqlBackendExpressionSyntax be
b) = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s c
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax be
mkOpE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
a (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
b)

unsafeRetype :: QGenExpr ctxt be s a -> QGenExpr ctxt be s a'
unsafeRetype :: QGenExpr ctxt be s a -> QGenExpr ctxt be s a'
unsafeRetype (QExpr Text -> BeamSqlBackendExpressionSyntax be
v) = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr ctxt be s a'
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax be
v

instance ( BeamSqlBackend backend, BeamSqlBackendCanSerialize backend [Char] ) =>
    IsString (QGenExpr context backend s T.Text) where
    fromString :: String -> QGenExpr context backend s Text
fromString = (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax backend)))
-> QGenExpr context backend s Text
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text
  -> Sql92UpdateExpressionSyntax
       (Sql92UpdateSyntax (BeamSqlBackendSyntax backend)))
 -> QGenExpr context backend s Text)
-> (String
    -> Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax backend)))
-> String
-> QGenExpr context backend s Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax backend))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax backend))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax backend))
 -> Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax backend)))
-> (String
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax backend)))
-> String
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax backend))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sql92ExpressionValueSyntax
  (Sql92SelectTableExpressionSyntax
     (Sql92SelectSelectTableSyntax
        (Sql92SelectSyntax (BeamSqlBackendSyntax backend))))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax backend))
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionValueSyntax expr -> expr
valueE (Sql92ExpressionValueSyntax
   (Sql92SelectTableExpressionSyntax
      (Sql92SelectSelectTableSyntax
         (Sql92SelectSyntax (BeamSqlBackendSyntax backend))))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax backend)))
-> (String
    -> Sql92ExpressionValueSyntax
         (Sql92SelectTableExpressionSyntax
            (Sql92SelectSelectTableSyntax
               (Sql92SelectSyntax (BeamSqlBackendSyntax backend)))))
-> String
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax backend))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String
-> Sql92ExpressionValueSyntax
     (Sql92SelectTableExpressionSyntax
        (Sql92SelectSelectTableSyntax
           (Sql92SelectSyntax (BeamSqlBackendSyntax backend))))
forall expr ty. HasSqlValueSyntax expr ty => ty -> expr
sqlValueSyntax
instance ( Num a, BeamSqlBackend be, BeamSqlBackendCanSerialize be a ) =>
    Num (QGenExpr context be s a) where
    fromInteger :: Integer -> QGenExpr context be s a
fromInteger Integer
x = let res :: QGenExpr context be s a
                        res :: QGenExpr context be s a
res = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Sql92ExpressionValueSyntax
  (Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionValueSyntax expr -> expr
valueE (a -> Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be)
forall expr ty. HasSqlValueSyntax expr ty => ty -> expr
sqlValueSyntax (Integer -> a
forall a b. (Integral a, Num b) => a -> b
fromIntegral Integer
x :: a))))
                    in QGenExpr context be s a
res
    QExpr Text -> BeamSqlBackendExpressionSyntax be
a + :: QGenExpr context be s a
-> QGenExpr context be s a -> QGenExpr context be s a
+ QExpr Text -> BeamSqlBackendExpressionSyntax be
b = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr. IsSql92ExpressionSyntax expr => expr -> expr -> expr
addE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
a (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
b)
    QExpr Text -> BeamSqlBackendExpressionSyntax be
a - :: QGenExpr context be s a
-> QGenExpr context be s a -> QGenExpr context be s a
- QExpr Text -> BeamSqlBackendExpressionSyntax be
b = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr. IsSql92ExpressionSyntax expr => expr -> expr -> expr
subE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
a (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
b)
    QExpr Text -> BeamSqlBackendExpressionSyntax be
a * :: QGenExpr context be s a
-> QGenExpr context be s a -> QGenExpr context be s a
* QExpr Text -> BeamSqlBackendExpressionSyntax be
b = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr. IsSql92ExpressionSyntax expr => expr -> expr -> expr
mulE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
a (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
b)
    negate :: QGenExpr context be s a -> QGenExpr context be s a
negate (QExpr Text -> BeamSqlBackendExpressionSyntax be
a) = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr. IsSql92ExpressionSyntax expr => expr -> expr
negateE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
a)
    abs :: QGenExpr context be s a -> QGenExpr context be s a
abs (QExpr Text -> BeamSqlBackendExpressionSyntax be
x) = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr. IsSql92ExpressionSyntax expr => expr -> expr
absE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
x)
    signum :: QGenExpr context be s a -> QGenExpr context be s a
signum QGenExpr context be s a
_ = String -> QGenExpr context be s a
forall a. HasCallStack => String -> a
error String
"signum: not defined for QExpr. Use CASE...WHEN"

instance ( Fractional a, BeamSqlBackend be, BeamSqlBackendCanSerialize be a ) =>
  Fractional (QGenExpr context be s a) where

  QExpr Text -> BeamSqlBackendExpressionSyntax be
a / :: QGenExpr context be s a
-> QGenExpr context be s a -> QGenExpr context be s a
/ QExpr Text -> BeamSqlBackendExpressionSyntax be
b = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr. IsSql92ExpressionSyntax expr => expr -> expr -> expr
divE (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
a (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Text -> BeamSqlBackendExpressionSyntax be
b)
  recip :: QGenExpr context be s a -> QGenExpr context be s a
recip = (QGenExpr context be s a
1.0 QGenExpr context be s a
-> QGenExpr context be s a -> QGenExpr context be s a
forall a. Fractional a => a -> a -> a
/)

  fromRational :: Rational -> QGenExpr context be s a
fromRational = (Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text
  -> Sql92UpdateExpressionSyntax
       (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
 -> QGenExpr context be s a)
-> (Rational
    -> Text
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Rational
-> QGenExpr context be s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> Text
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Rational
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Rational
-> Text
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be)
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionValueSyntax expr -> expr
valueE (Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be)
 -> Sql92UpdateExpressionSyntax
      (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> (Rational
    -> Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be))
-> Rational
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be)
forall expr ty. HasSqlValueSyntax expr ty => ty -> expr
sqlValueSyntax (a
 -> Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be))
-> (Rational -> a)
-> Rational
-> Sql92ExpressionValueSyntax (BeamSqlBackendExpressionSyntax be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> a
forall a. a -> a
id :: a -> a) (a -> a) -> (Rational -> a) -> Rational -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> a
forall a. Fractional a => Rational -> a
fromRational

-- * Sql Projections
--

-- | Typeclass for all haskell data types that can be used to create a projection in a SQL select
-- statement. This includes all tables as well as all tuple classes. Projections are only defined on
-- tuples up to size 5. If you need more, follow the implementations here.

class Typeable context => AggregateContext context
instance (IsAggregateContext a, Typeable a) => AggregateContext a

type family ContextName a :: Symbol
type instance ContextName QValueContext = "a value"
type instance ContextName QWindowingContext = "a window expression"
type instance ContextName QWindowFrameContext = "a window frame"
type instance ContextName QAggregateContext = "an aggregate"
type instance ContextName QGroupingContext = "an aggregate grouping"

type family IsAggregateContext a :: Constraint where
    IsAggregateContext QAggregateContext = ()
    IsAggregateContext QGroupingContext = ()
    IsAggregateContext a = TypeError ('Text "Non-aggregate expression where aggregate expected." :$$:
                                      ('Text "Got " :<>: 'Text (ContextName a) :<>: 'Text ". Expected an aggregate or a grouping") :$$:
                                      AggregateContextSuggestion a)

type family AggregateContextSuggestion a :: ErrorMessage where
    AggregateContextSuggestion QValueContext = 'Text "Perhaps you forgot to wrap a value expression with 'group_'"
    AggregateContextSuggestion QWindowingContext = 'Text "Perhaps you meant to use 'window_' instead of 'aggregate_'"
    AggregateContextSuggestion b = 'Text ""

class Typeable context => ValueContext context
instance (IsValueContext a, Typeable a, a ~ QValueContext) => ValueContext a

class Typeable context => WindowFrameContext context
instance (Typeable context, IsWindowFrameContext context, context ~ QWindowFrameContext) =>
  WindowFrameContext context

type family IsWindowFrameContext a :: Constraint where
  IsWindowFrameContext QWindowFrameContext = ()
  IsWindowFrameContext a = TypeError ('Text "Expected window frame." :$$:
                                      ('Text "Got " :<>: 'Text (ContextName a) :<>: 'Text ". Expected a window frame"))

class AnyType a
instance AnyType a

type family IsValueContext a :: Constraint where
    IsValueContext QValueContext = ()
    IsValueContext a = TypeError ('Text "Non-scalar context in projection" :$$:
                                  ('Text "Got " :<>: 'Text (ContextName a) :<>: 'Text ". Expected a value") :$$:
                                  ValueContextSuggestion a)

type family ValueContextSuggestion a :: ErrorMessage where
    ValueContextSuggestion QWindowingContext = 'Text "Use 'window_' to projecct aggregate expressions to the value level"
    ValueContextSuggestion QAggregateContext = ('Text "Aggregate functions and groupings cannot be contained in value expressions." :$$:
                                                'Text "Use 'aggregate_' to compute aggregations at the value level.")
    ValueContextSuggestion QGroupingContext = ValueContextSuggestion QAggregateContext
    ValueContextSuggestion _ = 'Text ""

type Projectible be = ProjectibleWithPredicate AnyType be (WithExprContext (BeamSqlBackendExpressionSyntax' be))
type ProjectibleValue be = ProjectibleWithPredicate ValueContext be (WithExprContext (BeamSqlBackendExpressionSyntax' be))

class ThreadRewritable (s :: Type) (a :: Type) | a -> s where
  type WithRewrittenThread s (s' :: Type) a :: Type

  rewriteThread :: Proxy s' -> a -> WithRewrittenThread s s' a
instance Beamable tbl => ThreadRewritable s (tbl (QGenExpr ctxt syntax s)) where
  type WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) = tbl (QGenExpr ctxt syntax s')
  rewriteThread :: Proxy s'
-> tbl (QGenExpr ctxt syntax s)
-> WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s))
rewriteThread Proxy s'
_ = (forall a.
 Columnar' (QGenExpr ctxt syntax s) a
 -> Columnar' (QGenExpr ctxt syntax s') a)
-> tbl (QGenExpr ctxt syntax s) -> tbl (QGenExpr ctxt syntax s')
forall (table :: (* -> *) -> *) (f :: * -> *) (g :: * -> *).
Beamable table =>
(forall a. Columnar' f a -> Columnar' g a) -> table f -> table g
changeBeamRep (\(Columnar' (QExpr a)) -> Columnar (QGenExpr ctxt syntax s') a
-> Columnar' (QGenExpr ctxt syntax s') a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' ((Text -> BeamSqlBackendExpressionSyntax syntax)
-> QGenExpr ctxt syntax s' a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a))
instance Beamable tbl => ThreadRewritable s (tbl (Nullable (QGenExpr ctxt syntax s))) where
  type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) = tbl (Nullable (QGenExpr ctxt syntax s'))
  rewriteThread :: Proxy s'
-> tbl (Nullable (QGenExpr ctxt syntax s))
-> WithRewrittenThread
     s s' (tbl (Nullable (QGenExpr ctxt syntax s)))
rewriteThread Proxy s'
_ = (forall a.
 Columnar' (Nullable (QGenExpr ctxt syntax s)) a
 -> Columnar' (Nullable (QGenExpr ctxt syntax s')) a)
-> tbl (Nullable (QGenExpr ctxt syntax s))
-> tbl (Nullable (QGenExpr ctxt syntax s'))
forall (table :: (* -> *) -> *) (f :: * -> *) (g :: * -> *).
Beamable table =>
(forall a. Columnar' f a -> Columnar' g a) -> table f -> table g
changeBeamRep (\(Columnar' (QExpr a)) -> Columnar (Nullable (QGenExpr ctxt syntax s')) a
-> Columnar' (Nullable (QGenExpr ctxt syntax s')) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' ((Text -> BeamSqlBackendExpressionSyntax syntax)
-> QGenExpr ctxt syntax s' (Maybe a)
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a))
instance ThreadRewritable s (QGenExpr ctxt syntax s a) where
  type WithRewrittenThread s s' (QGenExpr ctxt syntax s a) = QGenExpr ctxt syntax s' a
  rewriteThread :: Proxy s'
-> QGenExpr ctxt syntax s a
-> WithRewrittenThread s s' (QGenExpr ctxt syntax s a)
rewriteThread Proxy s'
_ (QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a) = (Text -> BeamSqlBackendExpressionSyntax syntax)
-> QGenExpr ctxt syntax s' a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a
instance ThreadRewritable s a => ThreadRewritable s [a] where
  type WithRewrittenThread s s' [a] = [WithRewrittenThread s s' a]
  rewriteThread :: Proxy s' -> [a] -> WithRewrittenThread s s' [a]
rewriteThread Proxy s'
s' [a]
qs = (a -> WithRewrittenThread s s' a)
-> [a] -> [WithRewrittenThread s s' a]
forall a b. (a -> b) -> [a] -> [b]
map (Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s') [a]
qs
instance (ThreadRewritable s a, KnownNat n) => ThreadRewritable s (Vector n a) where
  type WithRewrittenThread s s' (Vector n a) = Vector n (WithRewrittenThread s s' a)
  rewriteThread :: Proxy s' -> Vector n a -> WithRewrittenThread s s' (Vector n a)
rewriteThread Proxy s'
s' Vector n a
qs = (a -> WithRewrittenThread s s' a)
-> Vector n a -> Vector Vector n (WithRewrittenThread s s' a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s') Vector n a
qs
instance ( ThreadRewritable s a, ThreadRewritable s b ) =>
  ThreadRewritable s (a, b) where
  type WithRewrittenThread s s' (a, b) = (WithRewrittenThread s s' a, WithRewrittenThread s s' b)
  rewriteThread :: Proxy s' -> (a, b) -> WithRewrittenThread s s' (a, b)
rewriteThread Proxy s'
s' (a
a, b
b) = (Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b)
instance ( ThreadRewritable s a, ThreadRewritable s b, ThreadRewritable s c ) =>
  ThreadRewritable s (a, b, c) where
  type WithRewrittenThread s s' (a, b, c) =
    (WithRewrittenThread s s' a, WithRewrittenThread s s' b, WithRewrittenThread s s' c)
  rewriteThread :: Proxy s' -> (a, b, c) -> WithRewrittenThread s s' (a, b, c)
rewriteThread Proxy s'
s' (a
a, b
b, c
c) = (Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b, Proxy s' -> c -> WithRewrittenThread s s' c
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' c
c)
instance ( ThreadRewritable s a, ThreadRewritable s b, ThreadRewritable s c, ThreadRewritable s d ) =>
  ThreadRewritable s (a, b, c, d) where
  type WithRewrittenThread s s' (a, b, c, d) =
    (WithRewrittenThread s s' a, WithRewrittenThread s s' b, WithRewrittenThread s s' c, WithRewrittenThread s s' d)
  rewriteThread :: Proxy s' -> (a, b, c, d) -> WithRewrittenThread s s' (a, b, c, d)
rewriteThread Proxy s'
s' (a
a, b
b, c
c, d
d) =
    (Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b, Proxy s' -> c -> WithRewrittenThread s s' c
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' c
c, Proxy s' -> d -> WithRewrittenThread s s' d
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' d
d)
instance ( ThreadRewritable s a, ThreadRewritable s b, ThreadRewritable s c, ThreadRewritable s d
         , ThreadRewritable s e ) =>
  ThreadRewritable s (a, b, c, d, e) where
  type WithRewrittenThread s s' (a, b, c, d, e) =
    ( WithRewrittenThread s s' a, WithRewrittenThread s s' b, WithRewrittenThread s s' c, WithRewrittenThread s s' d
    , WithRewrittenThread s s' e )
  rewriteThread :: Proxy s'
-> (a, b, c, d, e) -> WithRewrittenThread s s' (a, b, c, d, e)
rewriteThread Proxy s'
s' (a
a, b
b, c
c, d
d, e
e) =
    ( Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b, Proxy s' -> c -> WithRewrittenThread s s' c
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' c
c, Proxy s' -> d -> WithRewrittenThread s s' d
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' d
d
    , Proxy s' -> e -> WithRewrittenThread s s' e
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' e
e)
instance ( ThreadRewritable s a, ThreadRewritable s b, ThreadRewritable s c, ThreadRewritable s d
         , ThreadRewritable s e, ThreadRewritable s f ) =>
  ThreadRewritable s (a, b, c, d, e, f) where
  type WithRewrittenThread s s' (a, b, c, d, e, f) =
    ( WithRewrittenThread s s' a, WithRewrittenThread s s' b, WithRewrittenThread s s' c, WithRewrittenThread s s' d
    , WithRewrittenThread s s' e, WithRewrittenThread s s' f )
  rewriteThread :: Proxy s'
-> (a, b, c, d, e, f)
-> WithRewrittenThread s s' (a, b, c, d, e, f)
rewriteThread Proxy s'
s' (a
a, b
b, c
c, d
d, e
e, f
f) =
    ( Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b, Proxy s' -> c -> WithRewrittenThread s s' c
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' c
c, Proxy s' -> d -> WithRewrittenThread s s' d
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' d
d
    , Proxy s' -> e -> WithRewrittenThread s s' e
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' e
e, Proxy s' -> f -> WithRewrittenThread s s' f
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' f
f)
instance ( ThreadRewritable s a, ThreadRewritable s b, ThreadRewritable s c, ThreadRewritable s d
         , ThreadRewritable s e, ThreadRewritable s f, ThreadRewritable s g ) =>
  ThreadRewritable s (a, b, c, d, e, f, g) where
  type WithRewrittenThread s s' (a, b, c, d, e, f, g) =
    ( WithRewrittenThread s s' a, WithRewrittenThread s s' b, WithRewrittenThread s s' c, WithRewrittenThread s s' d
    , WithRewrittenThread s s' e, WithRewrittenThread s s' f, WithRewrittenThread s s' g)
  rewriteThread :: Proxy s'
-> (a, b, c, d, e, f, g)
-> WithRewrittenThread s s' (a, b, c, d, e, f, g)
rewriteThread Proxy s'
s' (a
a, b
b, c
c, d
d, e
e, f
f, g
g) =
    ( Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b, Proxy s' -> c -> WithRewrittenThread s s' c
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' c
c, Proxy s' -> d -> WithRewrittenThread s s' d
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' d
d
    , Proxy s' -> e -> WithRewrittenThread s s' e
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' e
e, Proxy s' -> f -> WithRewrittenThread s s' f
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' f
f, Proxy s' -> g -> WithRewrittenThread s s' g
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' g
g )
instance ( ThreadRewritable s a, ThreadRewritable s b, ThreadRewritable s c, ThreadRewritable s d
         , ThreadRewritable s e, ThreadRewritable s f, ThreadRewritable s g, ThreadRewritable s h ) =>
  ThreadRewritable s (a, b, c, d, e, f, g, h) where
  type WithRewrittenThread s s' (a, b, c, d, e, f, g, h) =
    ( WithRewrittenThread s s' a, WithRewrittenThread s s' b, WithRewrittenThread s s' c, WithRewrittenThread s s' d
    , WithRewrittenThread s s' e, WithRewrittenThread s s' f, WithRewrittenThread s s' g, WithRewrittenThread s s' h)
  rewriteThread :: Proxy s'
-> (a, b, c, d, e, f, g, h)
-> WithRewrittenThread s s' (a, b, c, d, e, f, g, h)
rewriteThread Proxy s'
s' (a
a, b
b, c
c, d
d, e
e, f
f, g
g, h
h) =
    ( Proxy s' -> a -> WithRewrittenThread s s' a
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' a
a, Proxy s' -> b -> WithRewrittenThread s s' b
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' b
b, Proxy s' -> c -> WithRewrittenThread s s' c
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' c
c, Proxy s' -> d -> WithRewrittenThread s s' d
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' d
d
    , Proxy s' -> e -> WithRewrittenThread s s' e
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' e
e, Proxy s' -> f -> WithRewrittenThread s s' f
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' f
f, Proxy s' -> g -> WithRewrittenThread s s' g
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' g
g, Proxy s' -> h -> WithRewrittenThread s s' h
forall s a s'.
ThreadRewritable s a =>
Proxy s' -> a -> WithRewrittenThread s s' a
rewriteThread Proxy s'
s' h
h )

class ContextRewritable a where
  type WithRewrittenContext a ctxt :: Type

  rewriteContext :: Proxy ctxt -> a -> WithRewrittenContext a ctxt
instance Beamable tbl => ContextRewritable (tbl (QGenExpr old syntax s)) where
  type WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt = tbl (QGenExpr ctxt syntax s)

  rewriteContext :: Proxy ctxt
-> tbl (QGenExpr old syntax s)
-> WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt
rewriteContext Proxy ctxt
_ = (forall a.
 Columnar' (QGenExpr old syntax s) a
 -> Columnar' (QGenExpr ctxt syntax s) a)
-> tbl (QGenExpr old syntax s) -> tbl (QGenExpr ctxt syntax s)
forall (table :: (* -> *) -> *) (f :: * -> *) (g :: * -> *).
Beamable table =>
(forall a. Columnar' f a -> Columnar' g a) -> table f -> table g
changeBeamRep (\(Columnar' (QExpr a)) -> Columnar (QGenExpr ctxt syntax s) a
-> Columnar' (QGenExpr ctxt syntax s) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' ((Text -> BeamSqlBackendExpressionSyntax syntax)
-> QGenExpr ctxt syntax s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a))
instance Beamable tbl => ContextRewritable (tbl (Nullable (QGenExpr old syntax s))) where
  type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt = tbl (Nullable (QGenExpr ctxt syntax s))

  rewriteContext :: Proxy ctxt
-> tbl (Nullable (QGenExpr old syntax s))
-> WithRewrittenContext
     (tbl (Nullable (QGenExpr old syntax s))) ctxt
rewriteContext Proxy ctxt
_ = (forall a.
 Columnar' (Nullable (QGenExpr old syntax s)) a
 -> Columnar' (Nullable (QGenExpr ctxt syntax s)) a)
-> tbl (Nullable (QGenExpr old syntax s))
-> tbl (Nullable (QGenExpr ctxt syntax s))
forall (table :: (* -> *) -> *) (f :: * -> *) (g :: * -> *).
Beamable table =>
(forall a. Columnar' f a -> Columnar' g a) -> table f -> table g
changeBeamRep (\(Columnar' (QExpr a)) -> Columnar (Nullable (QGenExpr ctxt syntax s)) a
-> Columnar' (Nullable (QGenExpr ctxt syntax s)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' ((Text -> BeamSqlBackendExpressionSyntax syntax)
-> QGenExpr ctxt syntax s (Maybe a)
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a))
instance ContextRewritable (QGenExpr old syntax s a) where
  type WithRewrittenContext (QGenExpr old syntax s a) ctxt = QGenExpr ctxt syntax s a
  rewriteContext :: Proxy ctxt
-> QGenExpr old syntax s a
-> WithRewrittenContext (QGenExpr old syntax s a) ctxt
rewriteContext Proxy ctxt
_ (QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a) = (Text -> BeamSqlBackendExpressionSyntax syntax)
-> QGenExpr ctxt syntax s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr Text -> BeamSqlBackendExpressionSyntax syntax
a
instance ContextRewritable a => ContextRewritable [a] where
  type WithRewrittenContext [a] ctxt = [ WithRewrittenContext a ctxt ]
  rewriteContext :: Proxy ctxt -> [a] -> WithRewrittenContext [a] ctxt
rewriteContext Proxy ctxt
p [a]
as = (a -> WithRewrittenContext a ctxt)
-> [a] -> [WithRewrittenContext a ctxt]
forall a b. (a -> b) -> [a] -> [b]
map (Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p) [a]
as
instance (ContextRewritable a, KnownNat n) => ContextRewritable (Vector n a) where
  type WithRewrittenContext (Vector n a) ctxt = Vector n (WithRewrittenContext a ctxt)
  rewriteContext :: Proxy ctxt -> Vector n a -> WithRewrittenContext (Vector n a) ctxt
rewriteContext Proxy ctxt
p Vector n a
as = (a -> WithRewrittenContext a ctxt)
-> Vector n a -> Vector Vector n (WithRewrittenContext a ctxt)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p) Vector n a
as
instance (ContextRewritable a, ContextRewritable b) => ContextRewritable (a, b) where
  type WithRewrittenContext (a, b) ctxt = (WithRewrittenContext a ctxt, WithRewrittenContext b ctxt)
  rewriteContext :: Proxy ctxt -> (a, b) -> WithRewrittenContext (a, b) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b) = (Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b)
instance (ContextRewritable a, ContextRewritable b, ContextRewritable c) => ContextRewritable (a, b, c) where
  type WithRewrittenContext (a, b, c) ctxt = (WithRewrittenContext a ctxt, WithRewrittenContext b ctxt, WithRewrittenContext c ctxt)
  rewriteContext :: Proxy ctxt -> (a, b, c) -> WithRewrittenContext (a, b, c) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b, c
c) = (Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b, Proxy ctxt -> c -> WithRewrittenContext c ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p c
c)
instance ( ContextRewritable a, ContextRewritable b, ContextRewritable c
         , ContextRewritable d ) => ContextRewritable (a, b, c, d) where
  type WithRewrittenContext (a, b, c, d) ctxt =
      ( WithRewrittenContext a ctxt, WithRewrittenContext b ctxt, WithRewrittenContext c ctxt
      , WithRewrittenContext d ctxt )
  rewriteContext :: Proxy ctxt
-> (a, b, c, d) -> WithRewrittenContext (a, b, c, d) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b, c
c, d
d) = ( Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b, Proxy ctxt -> c -> WithRewrittenContext c ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p c
c
                                  , Proxy ctxt -> d -> WithRewrittenContext d ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p d
d )
instance ( ContextRewritable a, ContextRewritable b, ContextRewritable c
         , ContextRewritable d, ContextRewritable e ) =>
    ContextRewritable (a, b, c, d, e) where
  type WithRewrittenContext (a, b, c, d, e) ctxt =
      ( WithRewrittenContext a ctxt, WithRewrittenContext b ctxt, WithRewrittenContext c ctxt
      , WithRewrittenContext d ctxt, WithRewrittenContext e ctxt )
  rewriteContext :: Proxy ctxt
-> (a, b, c, d, e) -> WithRewrittenContext (a, b, c, d, e) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b, c
c, d
d, e
e) = ( Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b, Proxy ctxt -> c -> WithRewrittenContext c ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p c
c
                                     , Proxy ctxt -> d -> WithRewrittenContext d ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p d
d, Proxy ctxt -> e -> WithRewrittenContext e ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p e
e )
instance ( ContextRewritable a, ContextRewritable b, ContextRewritable c
         , ContextRewritable d, ContextRewritable e, ContextRewritable f ) =>
    ContextRewritable (a, b, c, d, e, f) where
  type WithRewrittenContext (a, b, c, d, e, f) ctxt =
      ( WithRewrittenContext a ctxt, WithRewrittenContext b ctxt, WithRewrittenContext c ctxt
      , WithRewrittenContext d ctxt, WithRewrittenContext e ctxt, WithRewrittenContext f ctxt )
  rewriteContext :: Proxy ctxt
-> (a, b, c, d, e, f)
-> WithRewrittenContext (a, b, c, d, e, f) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b, c
c, d
d, e
e, f
f) = ( Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b, Proxy ctxt -> c -> WithRewrittenContext c ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p c
c
                                        , Proxy ctxt -> d -> WithRewrittenContext d ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p d
d, Proxy ctxt -> e -> WithRewrittenContext e ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p e
e, Proxy ctxt -> f -> WithRewrittenContext f ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p f
f )
instance ( ContextRewritable a, ContextRewritable b, ContextRewritable c
         , ContextRewritable d, ContextRewritable e, ContextRewritable f
         , ContextRewritable g ) =>
    ContextRewritable (a, b, c, d, e, f, g) where
  type WithRewrittenContext (a, b, c, d, e, f, g) ctxt =
      ( WithRewrittenContext a ctxt, WithRewrittenContext b ctxt, WithRewrittenContext c ctxt
      , WithRewrittenContext d ctxt, WithRewrittenContext e ctxt, WithRewrittenContext f ctxt
      , WithRewrittenContext g ctxt )
  rewriteContext :: Proxy ctxt
-> (a, b, c, d, e, f, g)
-> WithRewrittenContext (a, b, c, d, e, f, g) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b, c
c, d
d, e
e, f
f, g
g) =
    ( Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b, Proxy ctxt -> c -> WithRewrittenContext c ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p c
c
    , Proxy ctxt -> d -> WithRewrittenContext d ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p d
d, Proxy ctxt -> e -> WithRewrittenContext e ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p e
e, Proxy ctxt -> f -> WithRewrittenContext f ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p f
f
    , Proxy ctxt -> g -> WithRewrittenContext g ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p g
g )
instance ( ContextRewritable a, ContextRewritable b, ContextRewritable c
         , ContextRewritable d, ContextRewritable e, ContextRewritable f
         , ContextRewritable g, ContextRewritable h ) =>
    ContextRewritable (a, b, c, d, e, f, g, h) where
  type WithRewrittenContext (a, b, c, d, e, f, g, h) ctxt =
      ( WithRewrittenContext a ctxt, WithRewrittenContext b ctxt, WithRewrittenContext c ctxt
      , WithRewrittenContext d ctxt, WithRewrittenContext e ctxt, WithRewrittenContext f ctxt
      , WithRewrittenContext g ctxt, WithRewrittenContext h ctxt )
  rewriteContext :: Proxy ctxt
-> (a, b, c, d, e, f, g, h)
-> WithRewrittenContext (a, b, c, d, e, f, g, h) ctxt
rewriteContext Proxy ctxt
p (a
a, b
b, c
c, d
d, e
e, f
f, g
g, h
h) =
    ( Proxy ctxt -> a -> WithRewrittenContext a ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p a
a, Proxy ctxt -> b -> WithRewrittenContext b ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p b
b, Proxy ctxt -> c -> WithRewrittenContext c ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p c
c
    , Proxy ctxt -> d -> WithRewrittenContext d ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p d
d, Proxy ctxt -> e -> WithRewrittenContext e ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p e
e, Proxy ctxt -> f -> WithRewrittenContext f ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p f
f
    , Proxy ctxt -> g -> WithRewrittenContext g ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p g
g, Proxy ctxt -> h -> WithRewrittenContext h ctxt
forall a ctxt.
ContextRewritable a =>
Proxy ctxt -> a -> WithRewrittenContext a ctxt
rewriteContext Proxy ctxt
p h
h )

newtype BeamSqlBackendExpressionSyntax' be
  = BeamSqlBackendExpressionSyntax'
  { BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax :: BeamSqlBackendExpressionSyntax be
  }

newtype BeamSqlBackendWindowFrameSyntax' be
  = BeamSqlBackendWindowFrameSyntax'
  { BeamSqlBackendWindowFrameSyntax' be
-> BeamSqlBackendWindowFrameSyntax be
fromBeamSqlBackendWindowFrameSyntax :: BeamSqlBackendWindowFrameSyntax be
  }

class ProjectibleWithPredicate (contextPredicate :: Type -> Constraint) be res a | a -> be where
  project' :: Monad m => Proxy contextPredicate -> Proxy (be, res)
           -> (forall context. contextPredicate context =>
               Proxy context -> Proxy be -> res -> m res)
           -> a -> m a

  projectSkeleton' :: Monad m => Proxy contextPredicate -> Proxy (be, res)
                   -> (forall context. contextPredicate context =>
                       Proxy context -> Proxy be -> m res)
                   -> m a

instance (Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) (t (QGenExpr context be s)) where
  project' :: Proxy contextPredicate
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> t (QGenExpr context be s)
-> m (t (QGenExpr context be s))
project' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mutateM t (QGenExpr context be s)
a =
    (forall a.
 Columnar' (QGenExpr context be s) a
 -> Columnar' (QGenExpr context be s) a
 -> m (Columnar' (QGenExpr context be s) a))
-> t (QGenExpr context be s)
-> t (QGenExpr context be s)
-> m (t (QGenExpr context be s))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\(Columnar' (QExpr e)) Columnar' (QGenExpr context be s) a
_ ->
                      QGenExpr context be s a -> Columnar' (QGenExpr context be s) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QGenExpr context be s a -> Columnar' (QGenExpr context be s) a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> QGenExpr context be s a)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Columnar' (QGenExpr context be s) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax be)
 -> QGenExpr context be s a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> QGenExpr context be s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Text
-> BeamSqlBackendExpressionSyntax be
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> Columnar' (QGenExpr context be s) a)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> m (Columnar' (QGenExpr context be s) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mutateM (Proxy context
forall k (t :: k). Proxy t
Proxy @context) (Proxy be
forall k (t :: k). Proxy t
Proxy @be) (BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
forall be.
BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
BeamSqlBackendExpressionSyntax' (BeamSqlBackendExpressionSyntax be
 -> BeamSqlBackendExpressionSyntax' be)
-> (Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> BeamSqlBackendExpressionSyntax be
e)) t (QGenExpr context be s)
a t (QGenExpr context be s)
a

  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m (t (QGenExpr context be s))
projectSkeleton' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkM =
    (forall a.
 Columnar' Ignored a
 -> Columnar' Ignored a -> m (Columnar' (QGenExpr context be s) a))
-> t Ignored -> t Ignored -> m (t (QGenExpr context be s))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\Columnar' Ignored a
_ Columnar' Ignored a
_ -> QGenExpr context be s a -> Columnar' (QGenExpr context be s) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QGenExpr context be s a -> Columnar' (QGenExpr context be s) a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> QGenExpr context be s a)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Columnar' (QGenExpr context be s) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax be)
 -> QGenExpr context be s a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> QGenExpr context be s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Text
-> BeamSqlBackendExpressionSyntax be
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> Columnar' (QGenExpr context be s) a)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> m (Columnar' (QGenExpr context be s) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkM (Proxy context
forall k (t :: k). Proxy t
Proxy @context)(Proxy be
forall k (t :: k). Proxy t
Proxy @be))
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)

instance (Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) (t (Nullable (QGenExpr context be s))) where
  project' :: Proxy contextPredicate
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> t (Nullable (QGenExpr context be s))
-> m (t (Nullable (QGenExpr context be s)))
project' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mutateM t (Nullable (QGenExpr context be s))
a =
    (forall a.
 Columnar' (Nullable (QGenExpr context be s)) a
 -> Columnar' (Nullable (QGenExpr context be s)) a
 -> m (Columnar' (Nullable (QGenExpr context be s)) a))
-> t (Nullable (QGenExpr context be s))
-> t (Nullable (QGenExpr context be s))
-> m (t (Nullable (QGenExpr context be s)))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\(Columnar' (QExpr e)) Columnar' (Nullable (QGenExpr context be s)) a
_ ->
                      QGenExpr context be s (Maybe a)
-> Columnar' (Nullable (QGenExpr context be s)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QGenExpr context be s (Maybe a)
 -> Columnar' (Nullable (QGenExpr context be s)) a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> QGenExpr context be s (Maybe a))
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Columnar' (Nullable (QGenExpr context be s)) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s (Maybe a)
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax be)
 -> QGenExpr context be s (Maybe a))
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> QGenExpr context be s (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Text
-> BeamSqlBackendExpressionSyntax be
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> Columnar' (Nullable (QGenExpr context be s)) a)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> m (Columnar' (Nullable (QGenExpr context be s)) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mutateM (Proxy context
forall k (t :: k). Proxy t
Proxy @context) (Proxy be
forall k (t :: k). Proxy t
Proxy @be) (BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
forall be.
BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
BeamSqlBackendExpressionSyntax' (BeamSqlBackendExpressionSyntax be
 -> BeamSqlBackendExpressionSyntax' be)
-> (Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> BeamSqlBackendExpressionSyntax be
e)) t (Nullable (QGenExpr context be s))
a t (Nullable (QGenExpr context be s))
a

  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m (t (Nullable (QGenExpr context be s)))
projectSkeleton' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkM =
    (forall a.
 Columnar' Ignored a
 -> Columnar' Ignored a
 -> m (Columnar' (Nullable (QGenExpr context be s)) a))
-> t Ignored
-> t Ignored
-> m (t (Nullable (QGenExpr context be s)))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\Columnar' Ignored a
_ Columnar' Ignored a
_ -> QGenExpr context be s (Maybe a)
-> Columnar' (Nullable (QGenExpr context be s)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QGenExpr context be s (Maybe a)
 -> Columnar' (Nullable (QGenExpr context be s)) a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> QGenExpr context be s (Maybe a))
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Columnar' (Nullable (QGenExpr context be s)) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s (Maybe a)
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax be)
 -> QGenExpr context be s (Maybe a))
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> QGenExpr context be s (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Text
-> BeamSqlBackendExpressionSyntax be
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> Columnar' (Nullable (QGenExpr context be s)) a)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> m (Columnar' (Nullable (QGenExpr context be s)) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkM (Proxy context
forall k (t :: k). Proxy t
Proxy @context)(Proxy be
forall k (t :: k). Proxy t
Proxy @be))
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)

-- instance ProjectibleWithPredicate WindowFrameContext be (QWindow be s) where
--   project' _ be mutateM (QWindow a) =
--     QWindow <$> mutateM (Proxy @QWindowFrameContext) be a

instance contextPredicate context => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendExpressionSyntax' be)) (QGenExpr context be s a) where
  project' :: Proxy contextPredicate
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> QGenExpr context be s a
-> m (QGenExpr context be s a)
project' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkE (QExpr Text -> BeamSqlBackendExpressionSyntax be
a) = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax be)
 -> QGenExpr context be s a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> QGenExpr context be s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Text
-> BeamSqlBackendExpressionSyntax be
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> QGenExpr context be s a)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> m (QGenExpr context be s a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkE (Proxy context
forall k (t :: k). Proxy t
Proxy @context) (Proxy be
forall k (t :: k). Proxy t
Proxy @be) (BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
forall be.
BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
BeamSqlBackendExpressionSyntax' (BeamSqlBackendExpressionSyntax be
 -> BeamSqlBackendExpressionSyntax' be)
-> (Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> BeamSqlBackendExpressionSyntax be
a)
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m (QGenExpr context be s a)
projectSkeleton' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkM = (Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr ((Text -> BeamSqlBackendExpressionSyntax be)
 -> QGenExpr context be s a)
-> (WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> Text -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> QGenExpr context be s a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> Text
-> BeamSqlBackendExpressionSyntax be
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> QGenExpr context be s a)
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> m (QGenExpr context be s a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
mkM (Proxy context
forall k (t :: k). Proxy t
Proxy @context) (Proxy be
forall k (t :: k). Proxy t
Proxy @be)

instance contextPredicate QWindowFrameContext => ProjectibleWithPredicate contextPredicate be (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)) (QWindow be s) where
  project' :: Proxy contextPredicate
-> Proxy
     (be, WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
    -> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)))
-> QWindow be s
-> m (QWindow be s)
project' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
mkW (QWindow WithExprContext (BeamSqlBackendWindowFrameSyntax be)
w) = WithExprContext (BeamSqlBackendWindowFrameSyntax be)
-> QWindow be s
forall be s.
WithExprContext (BeamSqlBackendWindowFrameSyntax be)
-> QWindow be s
QWindow (WithExprContext (BeamSqlBackendWindowFrameSyntax be)
 -> QWindow be s)
-> (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
    -> WithExprContext (BeamSqlBackendWindowFrameSyntax be))
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> QWindow be s
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendWindowFrameSyntax' be
 -> BeamSqlBackendWindowFrameSyntax be)
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> WithExprContext (BeamSqlBackendWindowFrameSyntax be)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendWindowFrameSyntax' be
-> BeamSqlBackendWindowFrameSyntax be
forall be.
BeamSqlBackendWindowFrameSyntax' be
-> BeamSqlBackendWindowFrameSyntax be
fromBeamSqlBackendWindowFrameSyntax (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
 -> QWindow be s)
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
-> m (QWindow be s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy QWindowFrameContext
-> Proxy be
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
mkW (Proxy QWindowFrameContext
forall k (t :: k). Proxy t
Proxy @QWindowFrameContext) (Proxy be
forall k (t :: k). Proxy t
Proxy @be) (BeamSqlBackendWindowFrameSyntax be
-> BeamSqlBackendWindowFrameSyntax' be
forall be.
BeamSqlBackendWindowFrameSyntax be
-> BeamSqlBackendWindowFrameSyntax' be
BeamSqlBackendWindowFrameSyntax' (BeamSqlBackendWindowFrameSyntax be
 -> BeamSqlBackendWindowFrameSyntax' be)
-> WithExprContext (BeamSqlBackendWindowFrameSyntax be)
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WithExprContext (BeamSqlBackendWindowFrameSyntax be)
w)
  projectSkeleton' :: Proxy contextPredicate
-> Proxy
     (be, WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
-> (forall context.
    contextPredicate context =>
    Proxy context
    -> Proxy be
    -> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)))
-> m (QWindow be s)
projectSkeleton' Proxy contextPredicate
_ Proxy (be, WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
_ forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
mkM = WithExprContext (BeamSqlBackendWindowFrameSyntax be)
-> QWindow be s
forall be s.
WithExprContext (BeamSqlBackendWindowFrameSyntax be)
-> QWindow be s
QWindow (WithExprContext (BeamSqlBackendWindowFrameSyntax be)
 -> QWindow be s)
-> (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
    -> WithExprContext (BeamSqlBackendWindowFrameSyntax be))
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> QWindow be s
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (BeamSqlBackendWindowFrameSyntax' be
 -> BeamSqlBackendWindowFrameSyntax be)
-> WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
-> WithExprContext (BeamSqlBackendWindowFrameSyntax be)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendWindowFrameSyntax' be
-> BeamSqlBackendWindowFrameSyntax be
forall be.
BeamSqlBackendWindowFrameSyntax' be
-> BeamSqlBackendWindowFrameSyntax be
fromBeamSqlBackendWindowFrameSyntax (WithExprContext (BeamSqlBackendWindowFrameSyntax' be)
 -> QWindow be s)
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
-> m (QWindow be s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy QWindowFrameContext
-> Proxy be
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
forall context.
contextPredicate context =>
Proxy context
-> Proxy be
-> m (WithExprContext (BeamSqlBackendWindowFrameSyntax' be))
mkM (Proxy QWindowFrameContext
forall k (t :: k). Proxy t
Proxy @QWindowFrameContext) (Proxy be
forall k (t :: k). Proxy t
Proxy @be)

-- instance ProjectibleWithPredicate contextPredicate be res a => ProjectibleWithPredicate contextPredicate be res [a] where
--   project' context be mkE as = traverse (project' context be mkE) as

instance (ProjectibleWithPredicate contextPredicate be res a, KnownNat n) => ProjectibleWithPredicate contextPredicate be res (Vector n a) where
  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> Vector n a
-> m (Vector n a)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE Vector n a
as = (a -> m a) -> Vector n a -> m (Vector n a)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse (Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE) Vector n a
as
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (Vector n a)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM = m a -> m (Vector n a)
forall (n :: Nat) (m :: * -> *) a.
(KnownNat n, Monad m) =>
m a -> m (Vector n a)
VS.replicateM (Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM)

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b)
-> m (a, b)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b) =
    (,) (a -> b -> (a, b)) -> m a -> m (b -> (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> (a, b)) -> m b -> m (a, b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,) (a -> b -> (a, b)) -> m a -> m (b -> (a, b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
        m (b -> (a, b)) -> m b -> m (a, b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b, ProjectibleWithPredicate contextPredicate be res c ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b, c) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b, c)
-> m (a, b, c)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b, c
c) =
    (,,) (a -> b -> c -> (a, b, c)) -> m a -> m (b -> c -> (a, b, c))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> c -> (a, b, c)) -> m b -> m (c -> (a, b, c))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b m (c -> (a, b, c)) -> m c -> m (a, b, c)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> c
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE c
c
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b, c)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,,) (a -> b -> c -> (a, b, c)) -> m a -> m (b -> c -> (a, b, c))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
         m (b -> c -> (a, b, c)) -> m b -> m (c -> (a, b, c))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
         m (c -> (a, b, c)) -> m c -> m (a, b, c)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b, ProjectibleWithPredicate contextPredicate be res c
         , ProjectibleWithPredicate contextPredicate be res d ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b, c, d) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b, c, d)
-> m (a, b, c, d)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b, c
c, d
d) =
    (,,,) (a -> b -> c -> d -> (a, b, c, d))
-> m a -> m (b -> c -> d -> (a, b, c, d))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> c -> d -> (a, b, c, d))
-> m b -> m (c -> d -> (a, b, c, d))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b m (c -> d -> (a, b, c, d)) -> m c -> m (d -> (a, b, c, d))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> c
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE c
c
          m (d -> (a, b, c, d)) -> m d -> m (a, b, c, d)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> d
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE d
d
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b, c, d)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,,,) (a -> b -> c -> d -> (a, b, c, d))
-> m a -> m (b -> c -> d -> (a, b, c, d))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
          m (b -> c -> d -> (a, b, c, d))
-> m b -> m (c -> d -> (a, b, c, d))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
          m (c -> d -> (a, b, c, d)) -> m c -> m (d -> (a, b, c, d))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
          m (d -> (a, b, c, d)) -> m d -> m (a, b, c, d)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b, ProjectibleWithPredicate contextPredicate be res c
         , ProjectibleWithPredicate contextPredicate be res d, ProjectibleWithPredicate contextPredicate be res e ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b, c, d, e) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b, c, d, e)
-> m (a, b, c, d, e)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b, c
c, d
d, e
e) =
    (,,,,) (a -> b -> c -> d -> e -> (a, b, c, d, e))
-> m a -> m (b -> c -> d -> e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> c -> d -> e -> (a, b, c, d, e))
-> m b -> m (c -> d -> e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b m (c -> d -> e -> (a, b, c, d, e))
-> m c -> m (d -> e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> c
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE c
c
           m (d -> e -> (a, b, c, d, e)) -> m d -> m (e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> d
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE d
d m (e -> (a, b, c, d, e)) -> m e -> m (a, b, c, d, e)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> e
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE e
e
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b, c, d, e)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,,,,) (a -> b -> c -> d -> e -> (a, b, c, d, e))
-> m a -> m (b -> c -> d -> e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
           m (b -> c -> d -> e -> (a, b, c, d, e))
-> m b -> m (c -> d -> e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
           m (c -> d -> e -> (a, b, c, d, e))
-> m c -> m (d -> e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
           m (d -> e -> (a, b, c, d, e)) -> m d -> m (e -> (a, b, c, d, e))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
           m (e -> (a, b, c, d, e)) -> m e -> m (a, b, c, d, e)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b, ProjectibleWithPredicate contextPredicate be res c
         , ProjectibleWithPredicate contextPredicate be res d, ProjectibleWithPredicate contextPredicate be res e, ProjectibleWithPredicate contextPredicate be res f ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b, c, d, e, f) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b, c, d, e, f)
-> m (a, b, c, d, e, f)
project' Proxy contextPredicate
context Proxy (be, res)
be  forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b, c
c, d
d, e
e, f
f) =
    (,,,,,) (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> m a -> m (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> m b -> m (c -> d -> e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b m (c -> d -> e -> f -> (a, b, c, d, e, f))
-> m c -> m (d -> e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> c
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE c
c
            m (d -> e -> f -> (a, b, c, d, e, f))
-> m d -> m (e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> d
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE d
d m (e -> f -> (a, b, c, d, e, f))
-> m e -> m (f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> e
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE e
e m (f -> (a, b, c, d, e, f)) -> m f -> m (a, b, c, d, e, f)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> f
-> m f
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE f
f
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b, c, d, e, f)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,,,,,) (a -> b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> m a -> m (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
            m (b -> c -> d -> e -> f -> (a, b, c, d, e, f))
-> m b -> m (c -> d -> e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
            m (c -> d -> e -> f -> (a, b, c, d, e, f))
-> m c -> m (d -> e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
            m (d -> e -> f -> (a, b, c, d, e, f))
-> m d -> m (e -> f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
            m (e -> f -> (a, b, c, d, e, f))
-> m e -> m (f -> (a, b, c, d, e, f))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
            m (f -> (a, b, c, d, e, f)) -> m f -> m (a, b, c, d, e, f)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m f
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b, ProjectibleWithPredicate contextPredicate be res c
         , ProjectibleWithPredicate contextPredicate be res d, ProjectibleWithPredicate contextPredicate be res e, ProjectibleWithPredicate contextPredicate be res f
         , ProjectibleWithPredicate contextPredicate be res g ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b, c, d, e, f, g) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b, c, d, e, f, g)
-> m (a, b, c, d, e, f, g)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b, c
c, d
d, e
e, f
f, g
g) =
    (,,,,,,) (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m a -> m (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m b -> m (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b m (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m c -> m (d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> c
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE c
c
             m (d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m d -> m (e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> d
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE d
d m (e -> f -> g -> (a, b, c, d, e, f, g))
-> m e -> m (f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> e
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE e
e m (f -> g -> (a, b, c, d, e, f, g))
-> m f -> m (g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> f
-> m f
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE f
f
             m (g -> (a, b, c, d, e, f, g)) -> m g -> m (a, b, c, d, e, f, g)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> g
-> m g
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE g
g
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b, c, d, e, f, g)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,,,,,,) (a -> b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m a -> m (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
             m (b -> c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m b -> m (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
             m (c -> d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m c -> m (d -> e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
             m (d -> e -> f -> g -> (a, b, c, d, e, f, g))
-> m d -> m (e -> f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
             m (e -> f -> g -> (a, b, c, d, e, f, g))
-> m e -> m (f -> g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
             m (f -> g -> (a, b, c, d, e, f, g))
-> m f -> m (g -> (a, b, c, d, e, f, g))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m f
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
             m (g -> (a, b, c, d, e, f, g)) -> m g -> m (a, b, c, d, e, f, g)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m g
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

instance ( ProjectibleWithPredicate contextPredicate be res a, ProjectibleWithPredicate contextPredicate be res b, ProjectibleWithPredicate contextPredicate be res c
         , ProjectibleWithPredicate contextPredicate be res d, ProjectibleWithPredicate contextPredicate be res e, ProjectibleWithPredicate contextPredicate be res f
         , ProjectibleWithPredicate contextPredicate be res g, ProjectibleWithPredicate contextPredicate be res h ) =>
  ProjectibleWithPredicate contextPredicate be res (a, b, c, d, e, f, g, h) where

  project' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> (a, b, c, d, e, f, g, h)
-> m (a, b, c, d, e, f, g, h)
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE (a
a, b
b, c
c, d
d, e
e, f
f, g
g, h
h) =
    (,,,,,,,) (a -> b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m a
-> m (b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE a
a m (b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m b
-> m (c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> b
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE b
b m (c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m c -> m (d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> c
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE c
c
              m (d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m d -> m (e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> d
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE d
d m (e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m e -> m (f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> e
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE e
e m (f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m f -> m (g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> f
-> m f
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE f
f
              m (g -> h -> (a, b, c, d, e, f, g, h))
-> m g -> m (h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> g
-> m g
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE g
g m (h -> (a, b, c, d, e, f, g, h))
-> m h -> m (a, b, c, d, e, f, g, h)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> h
-> m h
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> res -> m res
mkE h
h
  projectSkeleton' :: Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m (a, b, c, d, e, f, g, h)
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM =
    (,,,,,,,) (a -> b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m a
-> m (b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (b -> c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m b
-> m (c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m b
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (c -> d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m c -> m (d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m c
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (d -> e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m d -> m (e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m d
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (e -> f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m e -> m (f -> g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m e
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (f -> g -> h -> (a, b, c, d, e, f, g, h))
-> m f -> m (g -> h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m f
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (g -> h -> (a, b, c, d, e, f, g, h))
-> m g -> m (h -> (a, b, c, d, e, f, g, h))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m g
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM
              m (h -> (a, b, c, d, e, f, g, h))
-> m h -> m (a, b, c, d, e, f, g, h)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m h
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' Proxy contextPredicate
context Proxy (be, res)
be forall context.
contextPredicate context =>
Proxy context -> Proxy be -> m res
mkM

-- TODO add projectSkeleton'
instance Beamable t => ProjectibleWithPredicate AnyType () T.Text (t (QField s)) where
  project' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> t (QField s)
-> m (t (QField s))
project' Proxy AnyType
_ Proxy ((), Text)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM t (QField s)
a =
    (forall a.
 Columnar' (QField s) a
 -> Columnar' (QField s) a -> m (Columnar' (QField s) a))
-> t (QField s) -> t (QField s) -> m (t (QField s))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\(Columnar' Columnar (QField s) a
f) Columnar' (QField s) a
_ ->
                      QField s a -> Columnar' (QField s) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QField s a -> Columnar' (QField s) a)
-> m (QField s a) -> m (Columnar' (QField s) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> QField s a
-> m (QField s a)
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) Proxy ((), Text)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM Columnar (QField s) a
QField s a
f) t (QField s)
a t (QField s)
a

  projectSkeleton' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> m Text)
-> m (t (QField s))
projectSkeleton' Proxy AnyType
_ Proxy ((), Text)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM =
    (forall a.
 Columnar' Ignored a
 -> Columnar' Ignored a -> m (Columnar' (QField s) a))
-> t Ignored -> t Ignored -> m (t (QField s))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\Columnar' Ignored a
_ Columnar' Ignored a
_ -> QField s a -> Columnar' (QField s) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QField s a -> Columnar' (QField s) a)
-> (Text -> QField s a) -> Text -> Columnar' (QField s) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Text -> Text -> QField s a
forall s ty. Bool -> Text -> Text -> QField s ty
QField Bool
False Text
"" (Text -> Columnar' (QField s) a)
-> m Text -> m (Columnar' (QField s) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Proxy () -> Proxy () -> m Text
forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @())))
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t) (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)

instance Beamable t => ProjectibleWithPredicate AnyType () T.Text (t (Nullable (QField s))) where
  project' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> t (Nullable (QField s))
-> m (t (Nullable (QField s)))
project' Proxy AnyType
_ Proxy ((), Text)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM t (Nullable (QField s))
a =
    (forall a.
 Columnar' (Nullable (QField s)) a
 -> Columnar' (Nullable (QField s)) a
 -> m (Columnar' (Nullable (QField s)) a))
-> t (Nullable (QField s))
-> t (Nullable (QField s))
-> m (t (Nullable (QField s)))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\(Columnar' Columnar (Nullable (QField s)) a
f) Columnar' (Nullable (QField s)) a
_ ->
                      QField s (Maybe a) -> Columnar' (Nullable (QField s)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QField s (Maybe a) -> Columnar' (Nullable (QField s)) a)
-> m (QField s (Maybe a)) -> m (Columnar' (Nullable (QField s)) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> QField s (Maybe a)
-> m (QField s (Maybe a))
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) Proxy ((), Text)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM Columnar (Nullable (QField s)) a
QField s (Maybe a)
f) t (Nullable (QField s))
a t (Nullable (QField s))
a

  projectSkeleton' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> m Text)
-> m (t (Nullable (QField s)))
projectSkeleton' Proxy AnyType
_ Proxy ((), Text)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM =
    (forall a.
 Columnar' Ignored a
 -> Columnar' Ignored a -> m (Columnar' (Nullable (QField s)) a))
-> t Ignored -> t Ignored -> m (t (Nullable (QField s)))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\Columnar' Ignored a
_ Columnar' Ignored a
_ -> QField s (Maybe a) -> Columnar' (Nullable (QField s)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (QField s (Maybe a) -> Columnar' (Nullable (QField s)) a)
-> (Text -> QField s (Maybe a))
-> Text
-> Columnar' (Nullable (QField s)) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Text -> Text -> QField s (Maybe a)
forall s ty. Bool -> Text -> Text -> QField s ty
QField Bool
False Text
"" (Text -> Columnar' (Nullable (QField s)) a)
-> m Text -> m (Columnar' (Nullable (QField s)) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy () -> Proxy () -> m Text
forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @()))
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t) (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)

instance Beamable t => ProjectibleWithPredicate AnyType () res (t (Const res)) where
  project' :: Proxy AnyType
-> Proxy ((), res)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> res -> m res)
-> t (Const res)
-> m (t (Const res))
project' Proxy AnyType
_ Proxy ((), res)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> res -> m res
mutateM t (Const res)
a =
    (forall a.
 Columnar' (Const res) a
 -> Columnar' (Const res) a -> m (Columnar' (Const res) a))
-> t (Const res) -> t (Const res) -> m (t (Const res))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\(Columnar' Columnar (Const res) a
f) Columnar' (Const res) a
_ ->
                      Const res a -> Columnar' (Const res) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (Const res a -> Columnar' (Const res) a)
-> m (Const res a) -> m (Columnar' (Const res) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy AnyType
-> Proxy ((), res)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> res -> m res)
-> Const res a
-> m (Const res a)
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) Proxy ((), res)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> res -> m res
mutateM Const res a
Columnar (Const res) a
f) t (Const res)
a t (Const res)
a

  projectSkeleton' :: Proxy AnyType
-> Proxy ((), res)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> m res)
-> m (t (Const res))
projectSkeleton' Proxy AnyType
_ Proxy ((), res)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> m res
mkM =
    (forall a.
 Columnar' Ignored a
 -> Columnar' Ignored a -> m (Columnar' (Const res) a))
-> t Ignored -> t Ignored -> m (t (Const res))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\Columnar' Ignored a
_ Columnar' Ignored a
_ -> Const res a -> Columnar' (Const res) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (Const res a -> Columnar' (Const res) a)
-> (res -> Const res a) -> res -> Columnar' (Const res) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. res -> Const res a
forall k a (b :: k). a -> Const a b
Const (res -> Columnar' (Const res) a)
-> m res -> m (Columnar' (Const res) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy () -> Proxy () -> m res
forall context.
AnyType context =>
Proxy context -> Proxy () -> m res
mkM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @()))
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t) (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)

instance Beamable t => ProjectibleWithPredicate AnyType () T.Text (t (Nullable (Const T.Text))) where
  project' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> t (Nullable (Const Text))
-> m (t (Nullable (Const Text)))
project' Proxy AnyType
_ Proxy ((), Text)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM t (Nullable (Const Text))
a =
    (forall a.
 Columnar' (Nullable (Const Text)) a
 -> Columnar' (Nullable (Const Text)) a
 -> m (Columnar' (Nullable (Const Text)) a))
-> t (Nullable (Const Text))
-> t (Nullable (Const Text))
-> m (t (Nullable (Const Text)))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\(Columnar' Columnar (Nullable (Const Text)) a
f) Columnar' (Nullable (Const Text)) a
_ ->
                      Const Text (Maybe a) -> Columnar' (Nullable (Const Text)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (Const Text (Maybe a) -> Columnar' (Nullable (Const Text)) a)
-> m (Const Text (Maybe a))
-> m (Columnar' (Nullable (Const Text)) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> Const Text (Maybe a)
-> m (Const Text (Maybe a))
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) Proxy ((), Text)
be forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM Const Text (Maybe a)
Columnar (Nullable (Const Text)) a
f) t (Nullable (Const Text))
a t (Nullable (Const Text))
a

  projectSkeleton' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> m Text)
-> m (t (Nullable (Const Text)))
projectSkeleton' Proxy AnyType
_ Proxy ((), Text)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM =
    (forall a.
 Columnar' Ignored a
 -> Columnar' Ignored a -> m (Columnar' (Nullable (Const Text)) a))
-> t Ignored -> t Ignored -> m (t (Nullable (Const Text)))
forall (table :: (* -> *) -> *) (m :: * -> *) (f :: * -> *)
       (g :: * -> *) (h :: * -> *).
(Beamable table, Applicative m) =>
(forall a. Columnar' f a -> Columnar' g a -> m (Columnar' h a))
-> table f -> table g -> m (table h)
zipBeamFieldsM (\Columnar' Ignored a
_ Columnar' Ignored a
_ -> Const Text (Maybe a) -> Columnar' (Nullable (Const Text)) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' (Const Text (Maybe a) -> Columnar' (Nullable (Const Text)) a)
-> (Text -> Const Text (Maybe a))
-> Text
-> Columnar' (Nullable (Const Text)) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Const Text (Maybe a)
forall k a (b :: k). a -> Const a b
Const (Text -> Columnar' (Nullable (Const Text)) a)
-> m Text -> m (Columnar' (Nullable (Const Text)) a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy () -> Proxy () -> m Text
forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @()))
                   (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t) (t Ignored
forall (table :: (* -> *) -> *).
Beamable table =>
TableSkeleton table
tblSkeleton :: TableSkeleton t)

instance ProjectibleWithPredicate AnyType () res (Const res a) where
  project' :: Proxy AnyType
-> Proxy ((), res)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> res -> m res)
-> Const res a
-> m (Const res a)
project' Proxy AnyType
_ Proxy ((), res)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> res -> m res
mutateM (Const res
a) = res -> Const res a
forall k a (b :: k). a -> Const a b
Const (res -> Const res a) -> m res -> m (Const res a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy () -> Proxy () -> res -> m res
forall context.
AnyType context =>
Proxy context -> Proxy () -> res -> m res
mutateM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) res
a

  projectSkeleton' :: Proxy AnyType
-> Proxy ((), res)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> m res)
-> m (Const res a)
projectSkeleton' Proxy AnyType
_ Proxy ((), res)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> m res
mkM =
    res -> Const res a
forall k a (b :: k). a -> Const a b
Const (res -> Const res a) -> m res -> m (Const res a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy () -> Proxy () -> m res
forall context.
AnyType context =>
Proxy context -> Proxy () -> m res
mkM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @())

instance ProjectibleWithPredicate AnyType () T.Text (QField s a) where
  project' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> Text -> m Text)
-> QField s a
-> m (QField s a)
project' Proxy AnyType
_ Proxy ((), Text)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM (QField Bool
q Text
tbl Text
f) =
    (Text -> QField s a) -> m Text -> m (QField s a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Bool -> Text -> Text -> QField s a
forall s ty. Bool -> Text -> Text -> QField s ty
QField Bool
q Text
tbl)
         (Proxy (QField s a) -> Proxy () -> Text -> m Text
forall context.
AnyType context =>
Proxy context -> Proxy () -> Text -> m Text
mutateM (Proxy (QField s a)
forall k (t :: k). Proxy t
Proxy @(QField s a)) (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) Text
f)

  projectSkeleton' :: Proxy AnyType
-> Proxy ((), Text)
-> (forall context.
    AnyType context =>
    Proxy context -> Proxy () -> m Text)
-> m (QField s a)
projectSkeleton' Proxy AnyType
_ Proxy ((), Text)
_ forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM =
    Bool -> Text -> Text -> QField s a
forall s ty. Bool -> Text -> Text -> QField s ty
QField Bool
False Text
"" (Text -> QField s a) -> m Text -> m (QField s a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Proxy () -> Proxy () -> m Text
forall context.
AnyType context =>
Proxy context -> Proxy () -> m Text
mkM (Proxy ()
forall k (t :: k). Proxy t
Proxy @()) (Proxy ()
forall k (t :: k). Proxy t
Proxy @())

project :: forall be a
         . Projectible be a => Proxy be -> a -> WithExprContext [ BeamSqlBackendExpressionSyntax be ]
project :: Proxy be
-> a -> WithExprContext [BeamSqlBackendExpressionSyntax be]
project Proxy be
_ = ([BeamSqlBackendExpressionSyntax' be]
 -> [BeamSqlBackendExpressionSyntax be])
-> (Text -> [BeamSqlBackendExpressionSyntax' be])
-> WithExprContext [BeamSqlBackendExpressionSyntax be]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((BeamSqlBackendExpressionSyntax' be
 -> BeamSqlBackendExpressionSyntax be)
-> [BeamSqlBackendExpressionSyntax' be]
-> [BeamSqlBackendExpressionSyntax be]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
forall be.
BeamSqlBackendExpressionSyntax' be
-> BeamSqlBackendExpressionSyntax be
fromBeamSqlBackendExpressionSyntax) ((Text -> [BeamSqlBackendExpressionSyntax' be])
 -> WithExprContext [BeamSqlBackendExpressionSyntax be])
-> (a -> Text -> [BeamSqlBackendExpressionSyntax' be])
-> a
-> WithExprContext [BeamSqlBackendExpressionSyntax be]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Text -> BeamSqlBackendExpressionSyntax' be]
-> Text -> [BeamSqlBackendExpressionSyntax' be]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([Text -> BeamSqlBackendExpressionSyntax' be]
 -> Text -> [BeamSqlBackendExpressionSyntax' be])
-> (a -> [Text -> BeamSqlBackendExpressionSyntax' be])
-> a
-> Text
-> [BeamSqlBackendExpressionSyntax' be]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DList (Text -> BeamSqlBackendExpressionSyntax' be)
-> [Text -> BeamSqlBackendExpressionSyntax' be]
forall a. DList a -> [a]
DList.toList (DList (Text -> BeamSqlBackendExpressionSyntax' be)
 -> [Text -> BeamSqlBackendExpressionSyntax' be])
-> (a -> DList (Text -> BeamSqlBackendExpressionSyntax' be))
-> a
-> [Text -> BeamSqlBackendExpressionSyntax' be]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Writer (DList (Text -> BeamSqlBackendExpressionSyntax' be)) a
-> DList (Text -> BeamSqlBackendExpressionSyntax' be)
forall w a. Writer w a -> w
execWriter (Writer (DList (Text -> BeamSqlBackendExpressionSyntax' be)) a
 -> DList (Text -> BeamSqlBackendExpressionSyntax' be))
-> (a
    -> Writer (DList (Text -> BeamSqlBackendExpressionSyntax' be)) a)
-> a
-> DList (Text -> BeamSqlBackendExpressionSyntax' be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
            Proxy AnyType
-> Proxy (be, Text -> BeamSqlBackendExpressionSyntax' be)
-> (forall context.
    AnyType context =>
    Proxy context
    -> Proxy be
    -> (Text -> BeamSqlBackendExpressionSyntax' be)
    -> WriterT
         (DList (Text -> BeamSqlBackendExpressionSyntax' be))
         Identity
         (Text -> BeamSqlBackendExpressionSyntax' be))
-> a
-> Writer (DList (Text -> BeamSqlBackendExpressionSyntax' be)) a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) (Proxy (be, Text -> BeamSqlBackendExpressionSyntax' be)
forall k (t :: k). Proxy t
Proxy @(be, WithExprContext (BeamSqlBackendExpressionSyntax' be))) (\Proxy context
_ Proxy be
_ Text -> BeamSqlBackendExpressionSyntax' be
e -> DList (Text -> BeamSqlBackendExpressionSyntax' be)
-> WriterT
     (DList (Text -> BeamSqlBackendExpressionSyntax' be)) Identity ()
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell ((Text -> BeamSqlBackendExpressionSyntax' be)
-> DList (Text -> BeamSqlBackendExpressionSyntax' be)
forall a. a -> DList a
DList.singleton Text -> BeamSqlBackendExpressionSyntax' be
e) WriterT
  (DList (Text -> BeamSqlBackendExpressionSyntax' be)) Identity ()
-> WriterT
     (DList (Text -> BeamSqlBackendExpressionSyntax' be))
     Identity
     (Text -> BeamSqlBackendExpressionSyntax' be)
-> WriterT
     (DList (Text -> BeamSqlBackendExpressionSyntax' be))
     Identity
     (Text -> BeamSqlBackendExpressionSyntax' be)
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (Text -> BeamSqlBackendExpressionSyntax' be)
-> WriterT
     (DList (Text -> BeamSqlBackendExpressionSyntax' be))
     Identity
     (Text -> BeamSqlBackendExpressionSyntax' be)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Text -> BeamSqlBackendExpressionSyntax' be
e)

reproject :: forall be a
           . (BeamSqlBackend be, Projectible be a)
          => Proxy be -> (Int -> BeamSqlBackendExpressionSyntax be) -> a -> a
reproject :: Proxy be -> (Int -> BeamSqlBackendExpressionSyntax be) -> a -> a
reproject Proxy be
_ Int -> BeamSqlBackendExpressionSyntax be
mkField a
a =
  State Int a -> Int -> a
forall s a. State s a -> s -> a
evalState (Proxy AnyType
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    AnyType context =>
    Proxy context
    -> Proxy be
    -> WithExprContext (BeamSqlBackendExpressionSyntax' be)
    -> StateT
         Int
         Identity
         (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> a
-> State Int a
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> res -> m res)
-> a
-> m a
project' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) (Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall k (t :: k). Proxy t
Proxy @(be, WithExprContext (BeamSqlBackendExpressionSyntax' be))) (\Proxy context
_ Proxy be
_ WithExprContext (BeamSqlBackendExpressionSyntax' be)
_ -> (Int -> (Int, Int)) -> StateT Int Identity Int
forall s (m :: * -> *) a. MonadState s m => (s -> (a, s)) -> m a
state (\Int
i -> (Int
i, Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)) StateT Int Identity Int
-> (Int
    -> StateT
         Int
         Identity
         (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> StateT
     Int Identity (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> StateT
     Int Identity (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (WithExprContext (BeamSqlBackendExpressionSyntax' be)
 -> StateT
      Int
      Identity
      (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> (Int -> WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> Int
-> StateT
     Int Identity (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. BeamSqlBackendExpressionSyntax' be
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BeamSqlBackendExpressionSyntax' be
 -> WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (Int -> BeamSqlBackendExpressionSyntax' be)
-> Int
-> WithExprContext (BeamSqlBackendExpressionSyntax' be)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sql92UpdateExpressionSyntax
  (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
-> BeamSqlBackendExpressionSyntax' be
forall be.
BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
BeamSqlBackendExpressionSyntax' (Sql92UpdateExpressionSyntax
   (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
 -> BeamSqlBackendExpressionSyntax' be)
-> (Int
    -> Sql92UpdateExpressionSyntax
         (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Int
-> BeamSqlBackendExpressionSyntax' be
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
Int -> BeamSqlBackendExpressionSyntax be
mkField) a
a) Int
0

-- | suitable as argument to 'QAll' in the case of a table result
tableFieldsToExpressions :: ( BeamSqlBackend be, Beamable table )
                         => TableSettings table -> T.Text -> table (QGenExpr ctxt be s)
tableFieldsToExpressions :: TableSettings table -> Text -> table (QGenExpr ctxt be s)
tableFieldsToExpressions TableSettings table
tblSettings Text
newTblNm =
    (forall a.
 Columnar' (TableField table) a -> Columnar' (QGenExpr ctxt be s) a)
-> TableSettings table -> table (QGenExpr ctxt be s)
forall (table :: (* -> *) -> *) (f :: * -> *) (g :: * -> *).
Beamable table =>
(forall a. Columnar' f a -> Columnar' g a) -> table f -> table g
changeBeamRep (\(Columnar' Columnar (TableField table) a
f) -> Columnar (QGenExpr ctxt be s) a -> Columnar' (QGenExpr ctxt be s) a
forall (f :: * -> *) a. Columnar f a -> Columnar' f a
Columnar' ((Text -> BeamSqlBackendExpressionSyntax be) -> QGenExpr ctxt be s a
forall context be s t.
(Text -> BeamSqlBackendExpressionSyntax be)
-> QGenExpr context be s t
QExpr (\Text
_ -> Sql92ExpressionFieldNameSyntax
  (Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionFieldNameSyntax expr -> expr
fieldE (Text
-> Text
-> Sql92ExpressionFieldNameSyntax
     (Sql92InsertValuesExpressionSyntax
        (Sql92InsertValuesSyntax
           (Sql92InsertSyntax (BeamSqlBackendSyntax be))))
forall fn. IsSql92FieldNameSyntax fn => Text -> Text -> fn
qualifiedField Text
newTblNm (TableField table a -> Text
forall (table :: (* -> *) -> *) ty. TableField table ty -> Text
_fieldName TableField table a
Columnar (TableField table) a
f))))) TableSettings table
tblSettings

mkFieldsSkeleton :: forall be res m
                  . (Projectible be res, MonadState Int m)
                 => (Int -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))) -> m res
mkFieldsSkeleton :: (Int -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m res
mkFieldsSkeleton Int -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
go =
    Proxy AnyType
-> Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
-> (forall context.
    AnyType context =>
    Proxy context
    -> Proxy be
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m res
forall (contextPredicate :: * -> Constraint) be res a
       (m :: * -> *).
(ProjectibleWithPredicate contextPredicate be res a, Monad m) =>
Proxy contextPredicate
-> Proxy (be, res)
-> (forall context.
    contextPredicate context =>
    Proxy context -> Proxy be -> m res)
-> m a
projectSkeleton' (Proxy AnyType
forall k (t :: k). Proxy t
Proxy @AnyType) (Proxy (be, WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall k (t :: k). Proxy t
Proxy @(be, WithExprContext (BeamSqlBackendExpressionSyntax' be))) ((forall context.
  AnyType context =>
  Proxy context
  -> Proxy be
  -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
 -> m res)
-> (forall context.
    AnyType context =>
    Proxy context
    -> Proxy be
    -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m res
forall a b. (a -> b) -> a -> b
$ \Proxy context
_ Proxy be
_ ->
    do Int
i <- m Int
forall s (m :: * -> *). MonadState s m => m s
get
       Int -> m ()
forall s (m :: * -> *). MonadState s m => s -> m ()
put (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
       Int -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be))
go Int
i

mkFieldNames :: forall be res
              . ( BeamSqlBackend be, Projectible be res )
             => (T.Text -> BeamSqlBackendFieldNameSyntax be) -> (res, [ T.Text ])
mkFieldNames :: (Text -> BeamSqlBackendFieldNameSyntax be) -> (res, [Text])
mkFieldNames Text -> BeamSqlBackendFieldNameSyntax be
mkField =
    Writer [Text] res -> (res, [Text])
forall w a. Writer w a -> (a, w)
runWriter (Writer [Text] res -> (res, [Text]))
-> (StateT Int (WriterT [Text] Identity) res -> Writer [Text] res)
-> StateT Int (WriterT [Text] Identity) res
-> (res, [Text])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StateT Int (WriterT [Text] Identity) res
 -> Int -> Writer [Text] res)
-> Int
-> StateT Int (WriterT [Text] Identity) res
-> Writer [Text] res
forall a b c. (a -> b -> c) -> b -> a -> c
flip StateT Int (WriterT [Text] Identity) res
-> Int -> Writer [Text] res
forall (m :: * -> *) s a. Monad m => StateT s m a -> s -> m a
evalStateT Int
0 (StateT Int (WriterT [Text] Identity) res -> (res, [Text]))
-> StateT Int (WriterT [Text] Identity) res -> (res, [Text])
forall a b. (a -> b) -> a -> b
$
    forall be res (m :: * -> *).
(Projectible be res, MonadState Int m) =>
(Int -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m res
forall (m :: * -> *).
(Projectible be res, MonadState Int m) =>
(Int -> m (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> m res
mkFieldsSkeleton @be @res ((Int
  -> StateT
       Int
       (WriterT [Text] Identity)
       (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
 -> StateT Int (WriterT [Text] Identity) res)
-> (Int
    -> StateT
         Int
         (WriterT [Text] Identity)
         (WithExprContext (BeamSqlBackendExpressionSyntax' be)))
-> StateT Int (WriterT [Text] Identity) res
forall a b. (a -> b) -> a -> b
$ \Int
i -> do
      let fieldName' :: Text
fieldName' = String -> Text
forall a. IsString a => String -> a
fromString (String
"res" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
i)
      [Text] -> StateT Int (WriterT [Text] Identity) ()
forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell [ Text
fieldName' ]
      WithExprContext (BeamSqlBackendExpressionSyntax' be)
-> StateT
     Int
     (WriterT [Text] Identity)
     (WithExprContext (BeamSqlBackendExpressionSyntax' be))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (\Text
_ -> BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
forall be.
BeamSqlBackendExpressionSyntax be
-> BeamSqlBackendExpressionSyntax' be
BeamSqlBackendExpressionSyntax' (Sql92ExpressionFieldNameSyntax
  (Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be)))
-> Sql92UpdateExpressionSyntax
     (Sql92UpdateSyntax (BeamSqlBackendSyntax be))
forall expr.
IsSql92ExpressionSyntax expr =>
Sql92ExpressionFieldNameSyntax expr -> expr
fieldE (Text -> BeamSqlBackendFieldNameSyntax be
mkField Text
fieldName')))

tableNameFromEntity :: IsSql92TableNameSyntax name
                    => DatabaseEntityDescriptor be (TableEntity tbl)
                    -> name

tableNameFromEntity :: DatabaseEntityDescriptor be (TableEntity tbl) -> name
tableNameFromEntity = Maybe Text -> Text -> name
forall tblName.
IsSql92TableNameSyntax tblName =>
Maybe Text -> Text -> tblName
tableName (Maybe Text -> Text -> name)
-> (DatabaseEntityDescriptor be (TableEntity tbl) -> Maybe Text)
-> DatabaseEntityDescriptor be (TableEntity tbl)
-> Text
-> name
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> DatabaseEntityDescriptor be (TableEntity tbl) -> Maybe Text
forall be (tbl :: (* -> *) -> *).
DatabaseEntityDescriptor be (TableEntity tbl) -> Maybe Text
dbTableSchema (DatabaseEntityDescriptor be (TableEntity tbl) -> Text -> name)
-> (DatabaseEntityDescriptor be (TableEntity tbl) -> Text)
-> DatabaseEntityDescriptor be (TableEntity tbl)
-> name
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> DatabaseEntityDescriptor be (TableEntity tbl) -> Text
forall be (tbl :: (* -> *) -> *).
DatabaseEntityDescriptor be (TableEntity tbl) -> Text
dbTableCurrentName

rescopeQ :: QM be db s res -> QM be db s' res
rescopeQ :: QM be db s res -> QM be db s' res
rescopeQ = QM be db s res -> QM be db s' res
forall a b. a -> b
unsafeCoerce