on dev help sign in
move some type variables around
commitcabe722524b5cb029a710f0b9a4eb48ab006ecc8 authorEitan Chatav <eitan@Eitans-MacBook-Pro.local> dateWed 20 Mar 2019, 19:16 (8 years ago) parent991b0b2
4 files changed+301−301
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+4−4 squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+195−195 squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+11−11 squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+91−91
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+4−4
@@ -298,7 +298,7 @@ check
298298 , HasAll aliases (TableToRow table) subcolumns )
299299 => NP Alias aliases
300300 -- ^ specify the subcolumns which are getting checked
301− -> (forall t. Condition '[] 'Ungrouped '[] schemas '[] '[t ::: subcolumns])
301+ -> (forall t. Condition '[] '[] 'Ungrouped schemas '[] '[t ::: subcolumns])
302302 -- ^ a closed `Condition` on those subcolumns
303303 -> TableConstraintExpression sch tab schemas ('Check aliases)
304304check _cols condition = UnsafeTableConstraintExpression $
@@ -773,7 +773,7 @@ newtype AlterColumn (schemas :: SchemasType) (ty0 :: ColumnType) (ty1 :: ColumnT
773773-- :}
774774-- ALTER TABLE "tab" ALTER COLUMN "col" SET DEFAULT 5;
775775setDefault
776− :: Expression '[] 'Ungrouped '[] schemas '[] '[] ty -- ^ default value to set
776+ :: Expression '[] '[] 'Ungrouped schemas '[] '[] ty -- ^ default value to set
777777 -> AlterColumn schemas (constraint :=> ty) ('Def :=> ty)
778778setDefault expression = UnsafeAlterColumn $
779779 "SET DEFAULT" <+> renderExpression expression
@@ -1003,7 +1003,7 @@ createDomain
10031003 :: (Has sch schemas schema, KnownSymbol dom)
10041004 => QualifiedAlias sch dom
10051005 -> (forall nullity. TypeExpression schemas (nullity ty))
1006− -> (forall tab. Condition '[] 'Ungrouped '[] schemas '[] '[tab ::: '["value" ::: 'Null ty]])
1006+ -> (forall tab. Condition '[] '[] 'Ungrouped schemas '[] '[tab ::: '["value" ::: 'Null ty]])
10071007 -> Definition schemas (Alter sch (Create alias ('Typedef ty) schema) schemas)
10081008createDomain dom ty condition =
10091009 UnsafeDefinition $ "CREATE DOMAIN" <+> renderSQL dom
@@ -1053,7 +1053,7 @@ notNullable ty = UnsafeColumnTypeExpression $ renderSQL ty <+> "NOT NULL"
10531053
10541054-- | used in `createTable` commands as a column constraint to give a default
10551055default_
1056− :: Expression '[] 'Ungrouped '[] schemas '[] '[] ty
1056+ :: Expression '[] '[] 'Ungrouped schemas '[] '[] ty
10571057 -> ColumnTypeExpression schemas ('NoDef :=> ty)
10581058 -> ColumnTypeExpression schemas ('Def :=> ty)
10591059default_ x ty = UnsafeColumnTypeExpression $
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+195−195
@@ -293,15 +293,15 @@ and other operations.
293293-}
294294newtype Expression
295295 (outer :: FromType)
296− (grp :: Grouping)
297296 (commons :: FromType)
297+ (grp :: Grouping)
298298 (schemas :: SchemasType)
299299 (params :: [NullityType])
300300 (from :: FromType)
301301 (ty :: NullityType)
302302 = UnsafeExpression { renderExpression :: ByteString }
303303 deriving (GHC.Generic,Show,Eq,Ord,NFData)
304−instance RenderSQL (Expression outer grp commons schemas params from ty) where
304+instance RenderSQL (Expression outer commons grp schemas params from ty) where
305305 renderSQL = renderExpression
306306
307307-- | An `Expr` is a closed `Expression`.
@@ -311,18 +311,18 @@ instance RenderSQL (Expression outer grp commons schemas params from ty) where
311311-- or alias references. It can be used as
312312-- a simple piece of more complex `Expression`s.
313313type Expr x
314− = forall outer grp commons schemas params from
315− . Expression outer grp commons schemas params from x
314+ = forall outer commons grp schemas params from
315+ . Expression outer commons grp schemas params from x
316316 -- ^ cannot reference aliases
317317
318318-- | A `RankNType` for binary operators.
319319type Operator x1 x2 y
320− = forall outer grp commons schemas params from
321− . Expression outer grp commons schemas params from x1
320+ = forall outer commons grp schemas params from
321+ . Expression outer commons grp schemas params from x1
322322 -- ^ left input
323− -> Expression outer grp commons schemas params from x2
323+ -> Expression outer commons grp schemas params from x2
324324 -- ^ right input
325− -> Expression outer grp commons schemas params from y
325+ -> Expression outer commons grp schemas params from y
326326 -- ^ output
327327
328328-- | A `RankNType` for functions with a single argument.
@@ -331,10 +331,10 @@ type Operator x1 x2 y
331331-- indeed a subcategory as it is closed under the usual
332332-- `Prelude..` and `Prelude.id`.
333333type (:-->) x y
334− = forall outer grp commons schemas params from
335− . Expression outer grp commons schemas params from x
334+ = forall outer commons grp schemas params from
335+ . Expression outer commons grp schemas params from x
336336 -- ^ input
337− -> Expression outer grp commons schemas params from y
337+ -> Expression outer commons grp schemas params from y
338338 -- ^ output
339339
340340{- | A `RankNType` for functions with a fixed-length list of heterogeneous arguments.
@@ -344,22 +344,22 @@ Use the `*:` operator to end your argument lists, like so.
344344fun(TRUE, FALSE, LOCALTIME, TRUE)
345345-}
346346type FunctionHet xs y
347− = forall outer grp commons schemas params from
348− . NP (Expression outer grp commons schemas params from) xs
347+ = forall outer commons grp schemas params from
348+ . NP (Expression outer commons grp schemas params from) xs
349349 -- ^ inputs
350− -> Expression outer grp commons schemas params from y
350+ -> Expression outer commons grp schemas params from y
351351 -- ^ output
352352
353353{- | A `RankNType` for functions with a variable-length list of
354354homogeneous arguments and at least 1 more argument.
355355-}
356356type FunctionHom x0 x1 y
357− = forall outer grp commons schemas params from
358− . [Expression outer grp commons schemas params from x0]
357+ = forall outer commons grp schemas params from
358+ . [Expression outer commons grp schemas params from x0]
359359 -- ^ inputs
360− -> Expression outer grp commons schemas params from x1
360+ -> Expression outer commons grp schemas params from x1
361361 -- ^ must have at least 1 input
362− -> Expression outer grp commons schemas params from y
362+ -> Expression outer commons grp schemas params from y
363363 -- ^ output
364364
365365{- | >>> printSQL (unsafeFunctionHom "greatest" [true, null_] false)
@@ -384,12 +384,12 @@ class KnownNat n => HasParameter
384384 | n params -> ty where
385385 -- | `parameter` takes a `Nat` using type application and a `TypeExpression`.
386386 --
387− -- >>> let expr = parameter @1 int4 :: Expression outer grp '[] schemas '[ 'Null 'PGint4] from ('Null 'PGint4)
387+ -- >>> let expr = parameter @1 int4 :: Expression outer '[] grp schemas '[ 'Null 'PGint4] from ('Null 'PGint4)
388388 -- >>> printSQL expr
389389 -- ($1 :: int4)
390390 parameter
391391 :: TypeExpression schemas ty
392− -> Expression outer grp commons schemas params from ty
392+ -> Expression outer commons grp schemas params from ty
393393 parameter ty = UnsafeExpression $ parenthesized $
394394 "$" <> renderNat @n <+> "::"
395395 <+> renderSQL ty
@@ -400,44 +400,44 @@ instance {-# OVERLAPPABLE #-} (KnownNat n, HasParameter (n-1) params ty)
400400-- | `param` takes a `Nat` using type application and for basic types,
401401-- infers a `TypeExpression`.
402402--
403−-- >>> let expr = param @1 :: Expression outer grp commons schemas '[ 'Null 'PGint4] from ('Null 'PGint4)
403+-- >>> let expr = param @1 :: Expression outer commons grp schemas '[ 'Null 'PGint4] from ('Null 'PGint4)
404404-- >>> printSQL expr
405405-- ($1 :: int4)
406406param
407407 :: forall n outer commons schemas params from grp ty
408408 . (PGTyped schemas ty, HasParameter n params ty)
409− => Expression outer grp commons schemas params from ty -- ^ param
409+ => Expression outer commons grp schemas params from ty -- ^ param
410410param = parameter @n (pgtype @schemas)
411411
412412instance (HasUnique tab (Join outer from) row, Has col row ty)
413− => IsLabel col (Expression outer 'Ungrouped commons schemas params from ty) where
413+ => IsLabel col (Expression outer commons 'Ungrouped schemas params from ty) where
414414 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
415415instance (HasUnique tab (Join outer from) row, Has col row ty, tys ~ '[ty])
416− => IsLabel col (NP (Expression outer 'Ungrouped commons schemas params from) tys) where
416+ => IsLabel col (NP (Expression outer commons 'Ungrouped schemas params from) tys) where
417417 fromLabel = fromLabel @col :* Nil
418418instance (HasUnique tab (Join outer from) row, Has col row ty, column ~ (col ::: ty))
419419 => IsLabel col
420− (Aliased (Expression outer 'Ungrouped commons schemas params from) column) where
420+ (Aliased (Expression outer commons 'Ungrouped schemas params from) column) where
421421 fromLabel = fromLabel @col `As` Alias
422422instance (HasUnique tab (Join outer from) row, Has col row ty, columns ~ '[col ::: ty])
423423 => IsLabel col
424− (NP (Aliased (Expression outer 'Ungrouped commons schemas params from)) columns) where
424+ (NP (Aliased (Expression outer commons 'Ungrouped schemas params from)) columns) where
425425 fromLabel = fromLabel @col :* Nil
426426
427427instance (Has tab (Join outer from) row, Has col row ty)
428− => IsQualified tab col (Expression outer 'Ungrouped commons schemas params from ty) where
428+ => IsQualified tab col (Expression outer commons 'Ungrouped schemas params from ty) where
429429 tab ! col = UnsafeExpression $
430430 renderSQL tab <> "." <> renderSQL col
431431instance (Has tab (Join outer from) row, Has col row ty, tys ~ '[ty])
432− => IsQualified tab col (NP (Expression outer 'Ungrouped commons schemas params from) tys) where
432+ => IsQualified tab col (NP (Expression outer commons 'Ungrouped schemas params from) tys) where
433433 tab ! col = tab ! col :* Nil
434434instance (Has tab (Join outer from) row, Has col row ty, column ~ (col ::: ty))
435435 => IsQualified tab col
436− (Aliased (Expression outer 'Ungrouped commons schemas params from) column) where
436+ (Aliased (Expression outer commons 'Ungrouped schemas params from) column) where
437437 tab ! col = tab ! col `As` col
438438instance (Has tab (Join outer from) row, Has col row ty, columns ~ '[col ::: ty])
439439 => IsQualified tab col
440− (NP (Aliased (Expression outer 'Ungrouped commons schemas params from)) columns) where
440+ (NP (Aliased (Expression outer commons 'Ungrouped schemas params from)) columns) where
441441 tab ! col = tab ! col :* Nil
442442
443443instance
@@ -445,7 +445,7 @@ instance
445445 , Has col row ty
446446 , GroupedBy tab col bys
447447 ) => IsLabel col
448− (Expression outer ('Grouped bys) commons schemas params from ty) where
448+ (Expression outer commons ('Grouped bys) schemas params from ty) where
449449 fromLabel = UnsafeExpression $ renderSQL (Alias @col)
450450instance
451451 ( HasUnique tab (Join outer from) row
@@ -453,7 +453,7 @@ instance
453453 , GroupedBy tab col bys
454454 , tys ~ '[ty]
455455 ) => IsLabel col
456− (NP (Expression outer ('Grouped bys) commons schemas params from) tys) where
456+ (NP (Expression outer commons ('Grouped bys) schemas params from) tys) where
457457 fromLabel = fromLabel @col :* Nil
458458instance
459459 ( HasUnique tab (Join outer from) row
@@ -461,7 +461,7 @@ instance
461461 , GroupedBy tab col bys
462462 , column ~ (col ::: ty)
463463 ) => IsLabel col
464− (Aliased (Expression outer ('Grouped bys) commons schemas params from) column) where
464+ (Aliased (Expression outer commons ('Grouped bys) schemas params from) column) where
465465 fromLabel = fromLabel @col `As` Alias
466466instance
467467 ( HasUnique tab (Join outer from) row
@@ -469,7 +469,7 @@ instance
469469 , GroupedBy tab col bys
470470 , columns ~ '[col ::: ty]
471471 ) => IsLabel col
472− (NP (Aliased (Expression outer ('Grouped bys) commons schemas params from)) columns) where
472+ (NP (Aliased (Expression outer commons ('Grouped bys) schemas params from)) columns) where
473473 fromLabel = fromLabel @col :* Nil
474474
475475instance
@@ -477,7 +477,7 @@ instance
477477 , Has col row ty
478478 , GroupedBy tab col bys
479479 ) => IsQualified tab col
480− (Expression outer ('Grouped bys) commons schemas params from ty) where
480+ (Expression outer commons ('Grouped bys) schemas params from ty) where
481481 tab ! col = UnsafeExpression $
482482 renderSQL tab <> "." <> renderSQL col
483483instance
@@ -486,7 +486,7 @@ instance
486486 , GroupedBy tab col bys
487487 , tys ~ '[ty]
488488 ) => IsQualified tab col
489− (NP (Expression outer ('Grouped bys) commons schemas params from) tys) where
489+ (NP (Expression outer commons ('Grouped bys) schemas params from) tys) where
490490 tab ! col = tab ! col :* Nil
491491instance
492492 ( Has tab (Join outer from) row
@@ -494,7 +494,7 @@ instance
494494 , GroupedBy tab col bys
495495 , column ~ (col ::: ty)
496496 ) => IsQualified tab col
497− (Aliased (Expression outer ('Grouped bys) commons schemas params from) column) where
497+ (Aliased (Expression outer commons ('Grouped bys) schemas params from) column) where
498498 tab ! col = tab ! col `As` col
499499instance
500500 ( Has tab (Join outer from) row
@@ -502,7 +502,7 @@ instance
502502 , GroupedBy tab col bys
503503 , columns ~ '[col ::: ty]
504504 ) => IsQualified tab col
505− (NP (Aliased (Expression outer ('Grouped bys) commons schemas params from)) columns) where
505+ (NP (Aliased (Expression outer commons ('Grouped bys) schemas params from)) columns) where
506506 tab ! col = tab ! col :* Nil
507507
508508-- | analagous to `Nothing`
@@ -533,10 +533,10 @@ coalesce nullxs notNullx = UnsafeExpression $
533533-- >>> printSQL $ fromNull true null_
534534-- COALESCE(NULL, TRUE)
535535fromNull
536− :: Expression outer grp commons schemas params from ('NotNull ty)
536+ :: Expression outer commons grp schemas params from ('NotNull ty)
537537 -- ^ what to convert @NULL@ to
538− -> Expression outer grp commons schemas params from ('Null ty)
539− -> Expression outer grp commons schemas params from ('NotNull ty)
538+ -> Expression outer commons grp schemas params from ('Null ty)
539+ -> Expression outer commons grp schemas params from ('NotNull ty)
540540fromNull notNullx nullx = coalesce [nullx] notNullx
541541
542542-- | >>> printSQL $ null_ & isNull
@@ -554,13 +554,13 @@ isNotNull x = UnsafeExpression $ renderSQL x <+> "IS NOT NULL"
554554-- >>> printSQL $ matchNull true not_ null_
555555-- CASE WHEN NULL IS NULL THEN TRUE ELSE (NOT NULL) END
556556matchNull
557− :: Expression outer grp commons schemas params from (nullty)
557+ :: Expression outer commons grp schemas params from (nullty)
558558 -- ^ what to convert @NULL@ to
559− -> ( Expression outer grp commons schemas params from ('NotNull ty)
560− -> Expression outer grp commons schemas params from (nullty) )
559+ -> ( Expression outer commons grp schemas params from ('NotNull ty)
560+ -> Expression outer commons grp schemas params from (nullty) )
561561 -- ^ function to perform when @NULL@ is absent
562− -> Expression outer grp commons schemas params from ('Null ty)
563− -> Expression outer grp commons schemas params from (nullty)
562+ -> Expression outer commons grp schemas params from ('Null ty)
563+ -> Expression outer commons grp schemas params from (nullty)
564564matchNull y f x = ifThenElse (isNull x) y
565565 (f (UnsafeExpression (renderSQL x)))
566566
@@ -568,7 +568,7 @@ matchNull y f x = ifThenElse (isNull x) y
568568`nullIf` gives @NULL@.
569569
570570>>> :set -XTypeApplications -XDataKinds
571−>>> let expr = nullIf (false *: param @1) :: Expression outer grp commons schemas '[ 'NotNull 'PGbool] from ('Null 'PGbool)
571+>>> let expr = nullIf (false *: param @1) :: Expression outer commons grp schemas '[ 'NotNull 'PGbool] from ('Null 'PGbool)
572572>>> printSQL expr
573573NULLIF(FALSE, ($1 :: bool))
574574-}
@@ -578,9 +578,9 @@ nullIf = unsafeFunctionHet "NULLIF"
578578-- | >>> printSQL $ array [null_, false, true]
579579-- ARRAY[NULL, FALSE, TRUE]
580580array
581− :: [Expression outer grp commons schemas params from ty]
581+ :: [Expression outer commons grp schemas params from ty]
582582 -- ^ array elements
583− -> Expression outer grp commons schemas params from (null ('PGvararray ty))
583+ -> Expression outer commons grp schemas params from (null ('PGvararray ty))
584584array xs = UnsafeExpression $ "ARRAY" <>
585585 bracketed (commaSeparated (renderSQL <$> xs))
586586
@@ -593,8 +593,8 @@ ARRAY[NULL, FALSE, TRUE]
593593array1 (null_ :* false *: true)
594594 :: Expression
595595 outer
596− grp
597596 commons
597+ grp
598598 schemas
599599 params
600600 from
@@ -602,8 +602,8 @@ array1 (null_ :* false *: true)
602602-}
603603array1
604604 :: (n ~ Length tys, SOP.All ((~) ty) tys)
605− => NP (Expression outer grp commons schemas params from) tys
606− -> Expression outer grp commons schemas params from (null ('PGfixarray '[n] ty))
605+ => NP (Expression outer commons grp schemas params from) tys
606+ -> Expression outer commons grp schemas params from (null ('PGfixarray '[n] ty))
607607array1 xs = UnsafeExpression $ "ARRAY" <>
608608 bracketed (renderCommaSeparated renderSQL xs)
609609
@@ -616,8 +616,8 @@ ARRAY[[NULL, FALSE, TRUE], [FALSE, NULL, TRUE]]
616616array2 ((null_ :* false *: true) *: (false :* null_ *: true))
617617 :: Expression
618618 outer
619− grp
620619 commons
620+ grp
621621 schemas
622622 params
623623 from
@@ -629,8 +629,8 @@ array2
629629 , Length tyss ~ n1
630630 , SOP.All ((~) ty) tys
631631 , Length tys ~ n2 )
632− => NP (NP (Expression outer grp commons schemas params from)) tyss
633− -> Expression outer grp commons schemas params from (null ('PGfixarray '[n1,n2] ty))
632+ => NP (NP (Expression outer commons grp schemas params from)) tyss
633+ -> Expression outer commons grp schemas params from (null ('PGfixarray '[n1,n2] ty))
634634array2 xss = UnsafeExpression $ "ARRAY" <>
635635 bracketed (renderCommaSeparatedConstraint @SOP.SListI (bracketed . renderCommaSeparated renderSQL) xss)
636636
@@ -648,7 +648,7 @@ index n expr = UnsafeExpression $
648648 parenthesized (renderSQL expr) <> "[" <> fromString (show n) <> "]"
649649
650650instance (KnownSymbol label, label `In` labels) => IsPGlabel label
651− (Expression outer grp commons schemas params from (null ('PGenum labels))) where
651+ (Expression outer commons grp schemas params from (null ('PGenum labels))) where
652652 label = UnsafeExpression $ renderSQL (PGlabel @label)
653653
654654-- | A row constructor is an expression that builds a row value
@@ -660,14 +660,14 @@ instance (KnownSymbol label, label `In` labels) => IsPGlabel label
660660-- , "imaginary" ::: 'NotNull 'PGfloat8 ]
661661-- :}
662662--
663−-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression outer grp commons schemas params from ('NotNull Complex)
663+-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression outer commons grp schemas params from ('NotNull Complex)
664664-- >>> printSQL i
665665-- ROW(0, 1)
666666row
667667 :: SListI row
668− => NP (Aliased (Expression outer grp commons schemas params from)) row
668+ => NP (Aliased (Expression outer commons grp schemas params from)) row
669669 -- ^ zero or more expressions for the row field values
670− -> Expression outer grp commons schemas params from (null ('PGcomposite row))
670+ -> Expression outer commons grp schemas params from (null ('PGcomposite row))
671671row exprs = UnsafeExpression $ "ROW" <> parenthesized
672672 (renderCommaSeparated (\ (expr `As` _) -> renderSQL expr) exprs)
673673
@@ -678,7 +678,7 @@ row exprs = UnsafeExpression $ "ROW" <> parenthesized
678678-- type Schema = '["complex" ::: 'Typedef Complex]
679679-- :}
680680--
681−-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression outer grp '[] (Public Schema) from params ('NotNull Complex)
681+-- >>> let i = row (0 `as` #real :* 1 `as` #imaginary) :: Expression outer '[] grp (Public Schema) from params ('NotNull Complex)
682682-- >>> printSQL $ i & field #complex #imaginary
683683-- (ROW(0, 1)::"complex")."imaginary"
684684field
@@ -687,22 +687,22 @@ field
687687 , Has field row ty)
688688 => QualifiedAlias sch tydef -- ^ row type
689689 -> Alias field -- ^ field name
690− -> Expression outer grp commons schemas params from ('NotNull ('PGcomposite row))
691− -> Expression outer grp commons schemas params from ty
690+ -> Expression outer commons grp schemas params from ('NotNull ('PGcomposite row))
691+ -> Expression outer commons grp schemas params from ty
692692field td fld expr = UnsafeExpression $
693693 parenthesized (renderSQL expr <> "::" <> renderSQL td)
694694 <> "." <> renderSQL fld
695695
696696instance Semigroup
697− (Expression outer grp commons schemas params from (null ('PGvararray ty))) where
697+ (Expression outer commons grp schemas params from (null ('PGvararray ty))) where
698698 (<>) = unsafeBinaryOp "||"
699699
700700instance Monoid
701− (Expression outer grp commons schemas params from (null ('PGvararray ty))) where
701+ (Expression outer commons grp schemas params from (null ('PGvararray ty))) where
702702 mempty = array []
703703 mappend = (<>)
704704
705−-- | >>> let expr = greatest [param @1] currentTimestamp :: Expression outer grp commons schemas '[ 'NotNull 'PGtimestamptz] from ('NotNull 'PGtimestamptz)
705+-- | >>> let expr = greatest [param @1] currentTimestamp :: Expression outer commons grp schemas '[ 'NotNull 'PGtimestamptz] from ('NotNull 'PGtimestamptz)
706706-- >>> printSQL expr
707707-- GREATEST(($1 :: timestamp with time zone), CURRENT_TIMESTAMP)
708708greatest :: FunctionHom ty ty ty
@@ -745,7 +745,7 @@ unsafeFunctionHet fun xs = UnsafeExpression $
745745 fun <> parenthesized (renderCommaSeparated renderSQL xs)
746746
747747instance ty `In` PGNum
748− => Num (Expression outer grp commons schemas params from (null ty)) where
748+ => Num (Expression outer commons grp schemas params from (null ty)) where
749749 (+) = unsafeBinaryOp "+"
750750 (-) = unsafeBinaryOp "-"
751751 (*) = unsafeBinaryOp "*"
@@ -757,7 +757,7 @@ instance ty `In` PGNum
757757 . show
758758
759759instance (ty `In` PGNum, ty `In` PGFloating) => Fractional
760− (Expression outer grp commons schemas params from (null ty)) where
760+ (Expression outer commons grp schemas params from (null ty)) where
761761 (/) = unsafeBinaryOp "/"
762762 fromRational
763763 = UnsafeExpression
@@ -767,7 +767,7 @@ instance (ty `In` PGNum, ty `In` PGFloating) => Fractional
767767 . fromRat @Double
768768
769769instance (ty `In` PGNum, ty `In` PGFloating) => Floating
770− (Expression outer grp commons schemas params from (null ty)) where
770+ (Expression outer commons grp schemas params from (null ty)) where
771771 pi = UnsafeExpression "pi()"
772772 exp = unsafeFunction "exp"
773773 log = unsafeFunction "ln"
@@ -809,9 +809,9 @@ atan2_ = unsafeFunctionHet "atan2"
809809cast
810810 :: TypeExpression schemas ty1
811811 -- ^ type to cast as
812− -> Expression outer grp commons schemas params from ty0
812+ -> Expression outer commons grp schemas params from ty0
813813 -- ^ value to convert
814− -> Expression outer grp commons schemas params from ty1
814+ -> Expression outer commons grp schemas params from ty1
815815cast ty x = UnsafeExpression $ parenthesized $
816816 renderSQL x <+> "::" <+> renderSQL ty
817817
@@ -819,7 +819,7 @@ cast ty x = UnsafeExpression $ parenthesized $
819819--
820820-- >>> :{
821821-- let
822−-- expression :: Expression outer grp commons schemas params from (null 'PGint2)
822+-- expression :: Expression outer commons grp schemas params from (null 'PGint2)
823823-- expression = 5 `quot_` 2
824824-- in printSQL expression
825825-- :}
@@ -833,7 +833,7 @@ quot_ = unsafeBinaryOp "/"
833833--
834834-- >>> :{
835835-- let
836−-- expression :: Expression outer grp commons schemas params from (null 'PGint2)
836+-- expression :: Expression outer commons grp schemas params from (null 'PGint2)
837837-- expression = 5 `rem_` 2
838838-- in printSQL expression
839839-- :}
@@ -845,7 +845,7 @@ rem_ = unsafeBinaryOp "%"
845845
846846-- | >>> :{
847847-- let
848−-- expression :: Expression outer grp commons schemas params from (null 'PGfloat4)
848+-- expression :: Expression outer commons grp schemas params from (null 'PGfloat4)
849849-- expression = trunc pi
850850-- in printSQL expression
851851-- :}
@@ -855,7 +855,7 @@ trunc = unsafeFunction "trunc"
855855
856856-- | >>> :{
857857-- let
858−-- expression :: Expression outer grp commons schemas params from (null 'PGfloat4)
858+-- expression :: Expression outer commons grp schemas params from (null 'PGfloat4)
859859-- expression = round_ pi
860860-- in printSQL expression
861861-- :}
@@ -865,7 +865,7 @@ round_ = unsafeFunction "round"
865865
866866-- | >>> :{
867867-- let
868−-- expression :: Expression outer grp commons schemas params from (null 'PGfloat4)
868+-- expression :: Expression outer commons grp schemas params from (null 'PGfloat4)
869869-- expression = ceiling_ pi
870870-- in printSQL expression
871871-- :}
@@ -876,8 +876,8 @@ ceiling_ = unsafeFunction "ceiling"
876876-- | A `Condition` is an `Expression`, which can evaluate
877877-- to `true`, `false` or `null_`. This is because SQL uses
878878-- a three valued logic.
879−type Condition outer grp commons schemas params from =
880− Expression outer grp commons schemas params from ('Null 'PGbool)
879+type Condition outer commons grp schemas params from =
880+ Expression outer commons grp schemas params from ('Null 'PGbool)
881881
882882-- | >>> printSQL true
883883-- TRUE
@@ -908,19 +908,19 @@ infixr 2 .||
908908
909909-- | >>> :{
910910-- let
911−-- expression :: Expression outer grp commons schemas params from (null 'PGint2)
911+-- expression :: Expression outer commons grp schemas params from (null 'PGint2)
912912-- expression = caseWhenThenElse [(true, 1), (false, 2)] 3
913913-- in printSQL expression
914914-- :}
915915-- CASE WHEN TRUE THEN 1 WHEN FALSE THEN 2 ELSE 3 END
916916caseWhenThenElse
917− :: [ ( Condition outer grp commons schemas params from
918− , Expression outer grp commons schemas params from ty
917+ :: [ ( Condition outer commons grp schemas params from
918+ , Expression outer commons grp schemas params from ty
919919 ) ]
920920 -- ^ whens and thens
921− -> Expression outer grp commons schemas params from ty
921+ -> Expression outer commons grp schemas params from ty
922922 -- ^ else
923− -> Expression outer grp commons schemas params from ty
923+ -> Expression outer commons grp schemas params from ty
924924caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
925925 [ "CASE"
926926 , mconcat
@@ -936,16 +936,16 @@ caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
936936
937937-- | >>> :{
938938-- let
939−-- expression :: Expression outer grp commons schemas params from (null 'PGint2)
939+-- expression :: Expression outer commons grp schemas params from (null 'PGint2)
940940-- expression = ifThenElse true 1 0
941941-- in printSQL expression
942942-- :}
943943-- CASE WHEN TRUE THEN 1 ELSE 0 END
944944ifThenElse
945− :: Condition outer grp commons schemas params from
946− -> Expression outer grp commons schemas params from ty -- ^ then
947− -> Expression outer grp commons schemas params from ty -- ^ else
948− -> Expression outer grp commons schemas params from ty
945+ :: Condition outer commons grp schemas params from
946+ -> Expression outer commons grp schemas params from ty -- ^ then
947+ -> Expression outer commons grp schemas params from ty -- ^ else
948+ -> Expression outer commons grp schemas params from ty
949949ifThenElse if_ then_ else_ = caseWhenThenElse [(if_,then_)] else_
950950
951951-- | Comparison operations like `.==`, `./=`, `.>`, `.>=`, `.<` and `.<=`
@@ -991,10 +991,10 @@ infix 4 .>
991991TRUE BETWEEN NULL AND FALSE
992992-}
993993between
994− :: Expression outer grp commons schemas params from (null ty)
995− -> ( Expression outer grp commons schemas params from (null ty)
996− , Expression outer grp commons schemas params from (null ty) ) -- ^ bounds
997− -> Condition outer grp commons schemas params from
994+ :: Expression outer commons grp schemas params from (null ty)
995+ -> ( Expression outer commons grp schemas params from (null ty)
996+ , Expression outer commons grp schemas params from (null ty) ) -- ^ bounds
997+ -> Condition outer commons grp schemas params from
998998between a (x,y) = UnsafeExpression $ renderSQL a <+> "BETWEEN"
999999 <+> renderSQL x <+> "AND" <+> renderSQL y
10001000
@@ -1002,10 +1002,10 @@ between a (x,y) = UnsafeExpression $ renderSQL a <+> "BETWEEN"
10021002TRUE NOT BETWEEN NULL AND FALSE
10031003-}
10041004notBetween
1005− :: Expression outer grp commons schemas params from (null ty)
1006− -> ( Expression outer grp commons schemas params from (null ty)
1007− , Expression outer grp commons schemas params from (null ty) ) -- ^ bounds
1008− -> Condition outer grp commons schemas params from
1005+ :: Expression outer commons grp schemas params from (null ty)
1006+ -> ( Expression outer commons grp schemas params from (null ty)
1007+ , Expression outer commons grp schemas params from (null ty) ) -- ^ bounds
1008+ -> Condition outer commons grp schemas params from
10091009notBetween a (x,y) = UnsafeExpression $ renderSQL a <+> "NOT BETWEEN"
10101010 <+> renderSQL x <+> "AND" <+> renderSQL y
10111011
@@ -1015,10 +1015,10 @@ notBetween a (x,y) = UnsafeExpression $ renderSQL a <+> "NOT BETWEEN"
10151015TRUE BETWEEN SYMMETRIC NULL AND FALSE
10161016-}
10171017betweenSymmetric
1018− :: Expression outer grp commons schemas params from (null ty)
1019− -> ( Expression outer grp commons schemas params from (null ty)
1020− , Expression outer grp commons schemas params from (null ty) ) -- ^ bounds
1021− -> Condition outer grp commons schemas params from
1018+ :: Expression outer commons grp schemas params from (null ty)
1019+ -> ( Expression outer commons grp schemas params from (null ty)
1020+ , Expression outer commons grp schemas params from (null ty) ) -- ^ bounds
1021+ -> Condition outer commons grp schemas params from
10221022betweenSymmetric a (x,y) = UnsafeExpression $ renderSQL a
10231023 <+> "BETWEEN SYMMETRIC" <+> renderSQL x <+> "AND" <+> renderSQL y
10241024
@@ -1028,10 +1028,10 @@ betweenSymmetric a (x,y) = UnsafeExpression $ renderSQL a
10281028TRUE NOT BETWEEN SYMMETRIC NULL AND FALSE
10291029-}
10301030notBetweenSymmetric
1031− :: Expression outer grp commons schemas params from (null ty)
1032− -> ( Expression outer grp commons schemas params from (null ty)
1033− , Expression outer grp commons schemas params from (null ty) ) -- ^ bounds
1034− -> Condition outer grp commons schemas params from
1031+ :: Expression outer commons grp schemas params from (null ty)
1032+ -> ( Expression outer commons grp schemas params from (null ty)
1033+ , Expression outer commons grp schemas params from (null ty) ) -- ^ bounds
1034+ -> Condition outer commons grp schemas params from
10351035notBetweenSymmetric a (x,y) = UnsafeExpression $ renderSQL a
10361036 <+> "NOT BETWEEN SYMMETRIC" <+> renderSQL x <+> "AND" <+> renderSQL y
10371037
@@ -1148,31 +1148,31 @@ escape = \case
11481148 c -> [c]
11491149
11501150instance IsString
1151− (Expression outer grp commons schemas params from (null 'PGtext)) where
1151+ (Expression outer commons grp schemas params from (null 'PGtext)) where
11521152 fromString str = UnsafeExpression $
11531153 "E\'" <> fromString (escape =<< str) <> "\'"
11541154instance IsString
1155− (Expression outer grp commons schemas params from (null 'PGtsvector)) where
1155+ (Expression outer commons grp schemas params from (null 'PGtsvector)) where
11561156 fromString str = cast tsvector . UnsafeExpression $
11571157 "E\'" <> fromString (escape =<< str) <> "\'"
11581158instance IsString
1159− (Expression outer grp commons schemas params from (null 'PGtsquery)) where
1159+ (Expression outer commons grp schemas params from (null 'PGtsquery)) where
11601160 fromString str = cast tsquery . UnsafeExpression $
11611161 "E\'" <> fromString (escape =<< str) <> "\'"
11621162
11631163instance Semigroup
1164− (Expression outer grp commons schemas params from (null 'PGtext)) where
1164+ (Expression outer commons grp schemas params from (null 'PGtext)) where
11651165 (<>) = unsafeBinaryOp "||"
11661166instance Semigroup
1167− (Expression outer grp commons schemas params from (null 'PGtsvector)) where
1167+ (Expression outer commons grp schemas params from (null 'PGtsvector)) where
11681168 (<>) = unsafeBinaryOp "||"
11691169
11701170instance Monoid
1171− (Expression outer grp commons schemas params from (null 'PGtext)) where
1171+ (Expression outer commons grp schemas params from (null 'PGtext)) where
11721172 mempty = fromString ""
11731173 mappend = (<>)
11741174instance Monoid
1175− (Expression outer grp commons schemas params from (null 'PGtsvector)) where
1175+ (Expression outer commons grp schemas params from (null 'PGtsvector)) where
11761176 mempty = fromString ""
11771177 mappend = (<>)
11781178
@@ -1282,7 +1282,7 @@ infixl 9 .?&
12821282
12831283-- | Concatenate two jsonb values into a new jsonb value.
12841284instance Semigroup
1285− (Expression outer grp commons schemas params from (null 'PGjsonb)) where
1285+ (Expression outer commons grp schemas params from (null 'PGjsonb)) where
12861286 (<>) = unsafeBinaryOp "||"
12871287
12881288-- | Delete a key or keys from a JSON object, or remove an array element.
@@ -1432,9 +1432,9 @@ jsonbArrayLength = unsafeFunction "jsonb_array_length"
14321432-- operator).
14331433jsonExtractPath
14341434 :: SListI elems
1435− => Expression outer grp commons schemas params from (null 'PGjson)
1436− -> NP (Expression outer grp commons schemas params from) elems
1437− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1435+ => Expression outer commons grp schemas params from (null 'PGjson)
1436+ -> NP (Expression outer commons grp schemas params from) elems
1437+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
14381438jsonExtractPath x xs =
14391439 unsafeFunctionHet "json_extract_path" (x :* xs)
14401440
@@ -1442,9 +1442,9 @@ jsonExtractPath x xs =
14421442-- operator).
14431443jsonbExtractPath
14441444 :: SListI elems
1445− => Expression outer grp commons schemas params from (null 'PGjsonb)
1446− -> NP (Expression outer grp commons schemas params from) elems
1447− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1445+ => Expression outer commons grp schemas params from (null 'PGjsonb)
1446+ -> NP (Expression outer commons grp schemas params from) elems
1447+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
14481448jsonbExtractPath x xs =
14491449 unsafeFunctionHet "jsonb_extract_path" (x :* xs)
14501450
@@ -1452,9 +1452,9 @@ jsonbExtractPath x xs =
14521452-- operator), as text.
14531453jsonExtractPathAsText
14541454 :: SListI elems
1455− => Expression outer grp commons schemas params from (null 'PGjson)
1456− -> NP (Expression outer grp commons schemas params from) elems
1457− -> Expression outer grp commons schemas params from (null 'PGjson)
1455+ => Expression outer commons grp schemas params from (null 'PGjson)
1456+ -> NP (Expression outer commons grp schemas params from) elems
1457+ -> Expression outer commons grp schemas params from (null 'PGjson)
14581458jsonExtractPathAsText x xs =
14591459 unsafeFunctionHet "json_extract_path_text" (x :* xs)
14601460
@@ -1462,9 +1462,9 @@ jsonExtractPathAsText x xs =
14621462-- operator), as text.
14631463jsonbExtractPathAsText
14641464 :: SListI elems
1465− => Expression outer grp commons schemas params from (null 'PGjsonb)
1466− -> NP (Expression outer grp commons schemas params from) elems
1467− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1465+ => Expression outer commons grp schemas params from (null 'PGjsonb)
1466+ -> NP (Expression outer commons grp schemas params from) elems
1467+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
14681468jsonbExtractPathAsText x xs =
14691469 unsafeFunctionHet "jsonb_extract_path_text" (x :* xs)
14701470
@@ -1496,11 +1496,11 @@ jsonbStripNulls = unsafeFunction "jsonb_strip_nulls"
14961496-- operators, negative integers that appear in path count from the end of JSON
14971497-- arrays.
14981498jsonbSet
1499− :: Expression outer grp commons schemas params from (null 'PGjsonb)
1500− -> Expression outer grp commons schemas params from (null ('PGvararray ('NotNull 'PGtext)))
1501− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1502− -> Maybe (Expression outer grp commons schemas params from (null 'PGbool))
1503− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1499+ :: Expression outer commons grp schemas params from (null 'PGjsonb)
1500+ -> Expression outer commons grp schemas params from (null ('PGvararray ('NotNull 'PGtext)))
1501+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
1502+ -> Maybe (Expression outer commons grp schemas params from (null 'PGbool))
1503+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
15041504jsonbSet tgt path val createMissing = case createMissing of
15051505 Just m -> unsafeFunctionHet "jsonb_set" (tgt :* path :* val :* m :* Nil)
15061506 Nothing -> unsafeFunctionHet "jsonb_set" (tgt :* path :* val :* Nil)
@@ -1514,11 +1514,11 @@ jsonbSet tgt path val createMissing = case createMissing of
15141514-- exist. As with the path orientated operators, negative integers that appear
15151515-- in path count from the end of JSON arrays.
15161516jsonbInsert
1517− :: Expression outer grp commons schemas params from (null 'PGjsonb)
1518− -> Expression outer grp commons schemas params from (null ('PGvararray ('NotNull 'PGtext)))
1519− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1520− -> Maybe (Expression outer grp commons schemas params from (null 'PGbool))
1521− -> Expression outer grp commons schemas params from (null 'PGjsonb)
1517+ :: Expression outer commons grp schemas params from (null 'PGjsonb)
1518+ -> Expression outer commons grp schemas params from (null ('PGvararray ('NotNull 'PGtext)))
1519+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
1520+ -> Maybe (Expression outer commons grp schemas params from (null 'PGbool))
1521+ -> Expression outer commons grp schemas params from (null 'PGjsonb)
15221522jsonbInsert tgt path val insertAfter = case insertAfter of
15231523 Just i -> unsafeFunctionHet "jsonb_insert" (tgt :* path :* val :* i :* Nil)
15241524 Nothing -> unsafeFunctionHet "jsonb_insert" (tgt :* path :* val :* Nil)
@@ -1610,16 +1610,16 @@ aggregation
16101610
16111611type AggrFun x y
16121612 = forall outer bys commons schemas params from
1613− . Distinction (Expression outer 'Ungrouped commons schemas params from) x
1613+ . Distinction (Expression outer commons 'Ungrouped schemas params from) x
16141614 -- ^ input
1615− -> Expression outer ('Grouped bys) commons schemas params from y
1615+ -> Expression outer commons ('Grouped bys) schemas params from y
16161616 -- ^ output
16171617
16181618type AggrHet xs y
16191619 = forall outer bys commons schemas params from
1620− . Distinction (NP (Expression outer 'Ungrouped commons schemas params from)) xs
1620+ . Distinction (NP (Expression outer commons 'Ungrouped schemas params from)) xs
16211621 -- ^ inputs
1622− -> Expression outer ('Grouped bys) commons schemas params from y
1622+ -> Expression outer commons ('Grouped bys) schemas params from y
16231623 -- ^ output
16241624
16251625unsafeAggregateHet :: SOP.SListI xs => ByteString -> AggrHet xs y
@@ -1638,7 +1638,7 @@ class Aggregate expr1 exprHet aggr
16381638 --
16391639 -- >>> :{
16401640 -- let
1641− -- expression :: Expression '[] ('Grouped bys) commons schemas params from ('NotNull 'PGint8)
1641+ -- expression :: Expression '[] commons ('Grouped bys) schemas params from ('NotNull 'PGint8)
16421642 -- expression = countStar
16431643 -- in printSQL expression
16441644 -- :}
@@ -1647,7 +1647,7 @@ class Aggregate expr1 exprHet aggr
16471647
16481648 -- | >>> :{
16491649 -- let
1650− -- expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: null ty]] ('NotNull 'PGint8)
1650+ -- expression :: Expression '[] commons ('Grouped bys) schemas params '[tab ::: '["col" ::: null ty]] ('NotNull 'PGint8)
16511651 -- expression = count (All #col)
16521652 -- in printSQL expression
16531653 -- :}
@@ -1659,7 +1659,7 @@ class Aggregate expr1 exprHet aggr
16591659
16601660 -- | >>> :{
16611661 -- let
1662− -- expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: 'Null 'PGnumeric]] ('NotNull 'PGnumeric)
1662+ -- expression :: Expression '[] commons ('Grouped bys) schemas params '[tab ::: '["col" ::: 'Null 'PGnumeric]] ('NotNull 'PGnumeric)
16631663 -- expression = sum_ (Distinct #col)
16641664 -- in printSQL expression
16651665 -- :}
@@ -1688,7 +1688,7 @@ class Aggregate expr1 exprHet aggr
16881688 the bitwise AND of all non-null input values, or null if none
16891689 >>> :{
16901690 let
1691− expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: null 'PGint4]] ('Null 'PGint4)
1691+ expression :: Expression '[] commons ('Grouped bys) schemas params '[tab ::: '["col" ::: null 'PGint4]] ('Null 'PGint4)
16921692 expression = bitAnd (Distinct #col)
16931693 in printSQL expression
16941694 :}
@@ -1705,7 +1705,7 @@ class Aggregate expr1 exprHet aggr
17051705
17061706 >>> :{
17071707 let
1708− expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: null 'PGint4]] ('Null 'PGint4)
1708+ expression :: Expression '[] commons ('Grouped bys) schemas params '[tab ::: '["col" ::: null 'PGint4]] ('Null 'PGint4)
17091709 expression = bitOr (All #col)
17101710 in printSQL expression
17111711 :}
@@ -1722,7 +1722,7 @@ class Aggregate expr1 exprHet aggr
17221722
17231723 >>> :{
17241724 let
1725− winFun :: WindowFunction '[] 'Ungrouped commons schemas params '[tab ::: '["col" ::: null 'PGbool]] ('Null 'PGbool)
1725+ winFun :: WindowFunction '[] commons 'Ungrouped schemas params '[tab ::: '["col" ::: null 'PGbool]] ('Null 'PGbool)
17261726 winFun = boolAnd #col
17271727 in printSQL winFun
17281728 :}
@@ -1738,7 +1738,7 @@ class Aggregate expr1 exprHet aggr
17381738
17391739 >>> :{
17401740 let
1741− expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: null 'PGbool]] ('Null 'PGbool)
1741+ expression :: Expression '[] commons ('Grouped bys) schemas params '[tab ::: '["col" ::: null 'PGbool]] ('Null 'PGbool)
17421742 expression = boolOr (All #col)
17431743 in printSQL expression
17441744 :}
@@ -1754,7 +1754,7 @@ class Aggregate expr1 exprHet aggr
17541754
17551755 >>> :{
17561756 let
1757− expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: null 'PGbool]] ('Null 'PGbool)
1757+ expression :: Expression '[] commons ('Grouped bys) schemas params '[tab ::: '["col" ::: null 'PGbool]] ('Null 'PGbool)
17581758 expression = every (Distinct #col)
17591759 in printSQL expression
17601760 :}
@@ -1786,7 +1786,7 @@ class Aggregate expr1 exprHet aggr
17861786 {- | correlation coefficient
17871787 >>> :{
17881788 let
1789− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1789+ expression :: Expression '[] c ('Grouped g) s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
17901790 expression = corr (All (#y *: #x))
17911791 in printSQL expression
17921792 :}
@@ -1799,7 +1799,7 @@ class Aggregate expr1 exprHet aggr
17991799 {- | population covariance
18001800 >>> :{
18011801 let
1802− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1802+ expression :: Expression '[] c ('Grouped g) s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
18031803 expression = covarPop (All (#y *: #x))
18041804 in printSQL expression
18051805 :}
@@ -1812,7 +1812,7 @@ class Aggregate expr1 exprHet aggr
18121812 {- | sample covariance
18131813 >>> :{
18141814 let
1815− winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1815+ winFun :: WindowFunction '[] c 'Ungrouped s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
18161816 winFun = covarSamp (#y *: #x)
18171817 in printSQL winFun
18181818 :}
@@ -1825,7 +1825,7 @@ class Aggregate expr1 exprHet aggr
18251825 {- | average of the independent variable (sum(X)/N)
18261826 >>> :{
18271827 let
1828− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1828+ expression :: Expression '[] c ('Grouped g) s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
18291829 expression = regrAvgX (All (#y *: #x))
18301830 in printSQL expression
18311831 :}
@@ -1838,7 +1838,7 @@ class Aggregate expr1 exprHet aggr
18381838 {- | average of the dependent variable (sum(Y)/N)
18391839 >>> :{
18401840 let
1841− winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1841+ winFun :: WindowFunction '[] c 'Ungrouped s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
18421842 winFun = regrAvgY (#y *: #x)
18431843 in printSQL winFun
18441844 :}
@@ -1851,7 +1851,7 @@ class Aggregate expr1 exprHet aggr
18511851 {- | number of input rows in which both expressions are nonnull
18521852 >>> :{
18531853 let
1854− winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGint8)
1854+ winFun :: WindowFunction '[] c 'Ungrouped s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGint8)
18551855 winFun = regrCount (#y *: #x)
18561856 in printSQL winFun
18571857 :}
@@ -1864,7 +1864,7 @@ class Aggregate expr1 exprHet aggr
18641864 {- | y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs
18651865 >>> :{
18661866 let
1867− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1867+ expression :: Expression '[] c ('Grouped g) s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
18681868 expression = regrIntercept (All (#y *: #x))
18691869 in printSQL expression
18701870 :}
@@ -1945,21 +1945,21 @@ data Distinction (expr :: kind -> Type) (ty :: kind)
19451945 = All (expr ty)
19461946 | Distinct (expr ty)
19471947 deriving (GHC.Generic,Show,Eq,Ord)
1948−instance NFData (Distinction (Expression outer grp commons schemas params from) ty)
1949−instance RenderSQL (Distinction (Expression outer grp commons schemas params from) ty) where
1948+instance NFData (Distinction (Expression outer commons grp schemas params from) ty)
1949+instance RenderSQL (Distinction (Expression outer commons grp schemas params from) ty) where
19501950 renderSQL = \case
19511951 All x -> "ALL" <+> renderSQL x
19521952 Distinct x -> "DISTINCT" <+> renderSQL x
19531953instance SOP.SListI tys => RenderSQL
1954− (Distinction (NP (Expression outer grp commons schemas params from)) tys) where
1954+ (Distinction (NP (Expression outer commons grp schemas params from)) tys) where
19551955 renderSQL = \case
19561956 All xs -> "ALL" <+> renderCommaSeparated renderSQL xs
19571957 Distinct xs -> "DISTINCT" <+> renderCommaSeparated renderSQL xs
19581958
19591959instance Aggregate
1960− (Distinction (Expression outer 'Ungrouped commons schemas params from))
1961− (Distinction (NP (Expression outer 'Ungrouped commons schemas params from)))
1962− (Expression outer ('Grouped bys) commons schemas params from) where
1960+ (Distinction (Expression outer commons 'Ungrouped schemas params from))
1961+ (Distinction (NP (Expression outer commons 'Ungrouped schemas params from)))
1962+ (Expression outer commons ('Grouped bys) schemas params from) where
19631963 countStar = UnsafeExpression "count(*)"
19641964 count = unsafeAggregate1 "count"
19651965 sum_ = unsafeAggregate1 "sum"
@@ -1993,9 +1993,9 @@ instance Aggregate
19931993 varPop = unsafeAggregate1 "var_pop"
19941994 varSamp = unsafeAggregate1 "var_samp"
19951995instance Aggregate
1996− (Expression outer grp commons schemas params from)
1997− (NP (Expression outer grp commons schemas params from))
1998− (WindowFunction outer grp commons schemas params from) where
1996+ (Expression outer commons grp schemas params from)
1997+ (NP (Expression outer commons grp schemas params from))
1998+ (WindowFunction outer commons grp schemas params from) where
19991999 countStar = UnsafeWindowFunction "count(*)"
20002000 count = unsafeWindowFunction1 "count"
20012001 sum_ = unsafeWindowFunction1 "sum"
@@ -2240,26 +2240,26 @@ Sorting
22402240-- `AscNullsLast`, `DescNullsFirst` and `DescNullsLast` options are used to
22412241-- determine whether nulls appear before or after non-null values in the sort
22422242-- ordering of a `Null` result column.
2243−data SortExpression outer grp commons schemas params from where
2243+data SortExpression outer commons grp schemas params from where
22442244 Asc
2245− :: Expression outer grp commons schemas params from ('NotNull ty)
2246− -> SortExpression outer grp commons schemas params from
2245+ :: Expression outer commons grp schemas params from ('NotNull ty)
2246+ -> SortExpression outer commons grp schemas params from
22472247 Desc
2248− :: Expression outer grp commons schemas params from ('NotNull ty)
2249− -> SortExpression outer grp commons schemas params from
2248+ :: Expression outer commons grp schemas params from ('NotNull ty)
2249+ -> SortExpression outer commons grp schemas params from
22502250 AscNullsFirst
2251− :: Expression outer grp commons schemas params from ('Null ty)
2252− -> SortExpression outer grp commons schemas params from
2251+ :: Expression outer commons grp schemas params from ('Null ty)
2252+ -> SortExpression outer commons grp schemas params from
22532253 AscNullsLast
2254− :: Expression outer grp commons schemas params from ('Null ty)
2255− -> SortExpression outer grp commons schemas params from
2254+ :: Expression outer commons grp schemas params from ('Null ty)
2255+ -> SortExpression outer commons grp schemas params from
22562256 DescNullsFirst
2257− :: Expression outer grp commons schemas params from ('Null ty)
2258− -> SortExpression outer grp commons schemas params from
2257+ :: Expression outer commons grp schemas params from ('Null ty)
2258+ -> SortExpression outer commons grp schemas params from
22592259 DescNullsLast
2260− :: Expression outer grp commons schemas params from ('Null ty)
2261− -> SortExpression outer grp commons schemas params from
2262−deriving instance Show (SortExpression outer grp commons schemas params from)
2260+ :: Expression outer commons grp schemas params from ('Null ty)
2261+ -> SortExpression outer commons grp schemas params from
2262+deriving instance Show (SortExpression outer commons grp schemas params from)
22632263
22642264{- |
22652265The `orderBy` clause causes the result rows of a `Squeal.PostgreSQL.Query.TableExpression`
@@ -2274,12 +2274,12 @@ using `orderBy` within `Squeal.PostgreSQL.Query.Over`.
22742274-}
22752275class OrderBy expr where
22762276 orderBy
2277− :: [SortExpression outer grp commons schemas params from]
2278− -> expr outer grp commons schemas params from
2279− -> expr outer grp commons schemas params from
2277+ :: [SortExpression outer commons grp schemas params from]
2278+ -> expr outer commons grp schemas params from
2279+ -> expr outer commons grp schemas params from
22802280
22812281-- | Render a `SortExpression`.
2282−instance RenderSQL (SortExpression outer grp commons schemas params from) where
2282+instance RenderSQL (SortExpression outer commons grp schemas params from) where
22832283 renderSQL = \case
22842284 Asc expression -> renderSQL expression <+> "ASC"
22852285 Desc expression -> renderSQL expression <+> "DESC"
@@ -2292,12 +2292,12 @@ instance RenderSQL (SortExpression outer grp commons schemas params from) where
22922292
22932293-- | A `WindowDefinition` is a set of table rows that are somehow related
22942294-- to the current row
2295−data WindowDefinition outer grp commons schemas params from where
2295+data WindowDefinition outer commons grp schemas params from where
22962296 WindowDefinition
22972297 :: SListI bys
2298− => NP (Expression outer grp commons schemas params from) bys
2299− -> [SortExpression outer grp commons schemas params from]
2300− -> WindowDefinition outer grp commons schemas params from
2298+ => NP (Expression outer commons grp schemas params from) bys
2299+ -> [SortExpression outer commons grp schemas params from]
2300+ -> WindowDefinition outer commons grp schemas params from
23012301
23022302instance OrderBy WindowDefinition where
23032303 orderBy sortsR (WindowDefinition parts sortsL)
@@ -2323,8 +2323,8 @@ the same partition as the current row.
23232323-}
23242324partitionBy
23252325 :: SListI bys
2326− => NP (Expression outer grp commons schemas params from) bys
2327− -> WindowDefinition outer grp commons schemas params from
2326+ => NP (Expression outer commons grp schemas params from) bys
2327+ -> WindowDefinition outer commons grp schemas params from
23282328partitionBy bys = WindowDefinition bys []
23292329
23302330{- |
@@ -2339,8 +2339,8 @@ just the current row of the query result.
23392339-}
23402340newtype WindowFunction
23412341 (outer :: FromType)
2342− (grp :: Grouping)
23432342 (commons :: FromType)
2343+ (grp :: Grouping)
23442344 (schemas :: SchemasType)
23452345 (params :: [NullityType])
23462346 (from :: FromType)
@@ -2348,26 +2348,26 @@ newtype WindowFunction
23482348 = UnsafeWindowFunction { renderWindowFunction :: ByteString }
23492349 deriving (GHC.Generic,Show,Eq,Ord,NFData)
23502350
2351−instance RenderSQL (WindowFunction outer grp commons schemas params from ty) where
2351+instance RenderSQL (WindowFunction outer commons grp schemas params from ty) where
23522352 renderSQL = renderWindowFunction
23532353
23542354type WinFun0 x
2355− = forall outer grp commons schemas params from
2356− . WindowFunction outer grp commons schemas params from x
2355+ = forall outer commons grp schemas params from
2356+ . WindowFunction outer commons grp schemas params from x
23572357 -- ^ cannot reference aliases
23582358
23592359type WinFun1 x y
2360− = forall outer grp commons schemas params from
2361− . Expression outer grp commons schemas params from x
2360+ = forall outer commons grp schemas params from
2361+ . Expression outer commons grp schemas params from x
23622362 -- ^ input
2363− -> WindowFunction outer grp commons schemas params from y
2363+ -> WindowFunction outer commons grp schemas params from y
23642364 -- ^ output
23652365
23662366type WinFunHet xs y
2367− = forall outer grp commons schemas params from
2368− . NP (Expression outer grp commons schemas params from) xs
2367+ = forall outer commons grp schemas params from
2368+ . NP (Expression outer commons grp schemas params from) xs
23692369 -- ^ inputs
2370− -> WindowFunction outer grp commons schemas params from y
2370+ -> WindowFunction outer commons grp schemas params from y
23712371 -- ^ output
23722372
23732373unsafeWindowFunction1 :: ByteString -> WinFun1 x y
squeal-postgresql/src/Squeal/PostgreSQL/Manipulation.hs+11−11
@@ -269,7 +269,7 @@ data QueryClause commons schemas params columns where
269269 Select
270270 :: SOP.SListI columns
271271 => NP (ColumnExpression grp schemas params from) columns
272− -> TableExpression '[] grp commons schemas params from
272+ -> TableExpression '[] commons grp schemas params from
273273 -> QueryClause commons schemas params columns
274274 Subquery
275275 :: ColumnsToRow columns ~ row
@@ -320,17 +320,17 @@ data ColumnExpression grp schemas params from column where
320320 => Alias col
321321 -> ColumnExpression grp schemas params from (col ::: 'Def :=> ty)
322322 Specific
323− :: Aliased (Expression '[] grp '[] schemas params from) (col ::: ty)
323+ :: Aliased (Expression '[] '[] grp schemas params from) (col ::: ty)
324324 -> ColumnExpression grp schemas params from (col ::: defness :=> ty)
325325
326326instance (KnownSymbol col, column ~ (col ::: defness :=> ty))
327327 => Aliasable col
328− (Expression '[] grp '[] schemas params from ty)
328+ (Expression '[] '[] grp schemas params from ty)
329329 (ColumnExpression grp schemas params from column) where
330330 expression `as` col = Specific (expression `As` col)
331331instance (KnownSymbol col, columns ~ '[col ::: defness :=> ty])
332332 => Aliasable col
333− (Expression '[] grp '[] schemas params from ty)
333+ (Expression '[] '[] grp schemas params from ty)
334334 (NP (ColumnExpression grp schemas params from) columns) where
335335 expression `as` col = expression `as` col :* Nil
336336instance (KnownSymbol col, column ~ (col ::: 'Def :=> ty))
@@ -407,7 +407,7 @@ instance RenderSQL (ColumnExpression grp schemas params from column) where
407407-- in the row. Use @Returning Nil@ in the common case where no return
408408-- values are desired.
409409newtype ReturningClause commons schemas params from row =
410− Returning (Selection '[] 'Ungrouped commons schemas params from row)
410+ Returning (Selection '[] commons 'Ungrouped schemas params from row)
411411
412412instance RenderSQL (ReturningClause commons schemas params from row) where
413413 renderSQL = \case
@@ -416,7 +416,7 @@ instance RenderSQL (ReturningClause commons schemas params from row) where
416416
417417pattern Returning_
418418 :: SOP.SListI row
419− => NP (Aliased (Expression '[] 'Ungrouped commons schemas params from)) row
419+ => NP (Aliased (Expression '[] commons 'Ungrouped schemas params from)) row
420420 -> ReturningClause commons schemas params from row
421421pattern Returning_ list = Returning (List list)
422422
@@ -449,7 +449,7 @@ data ConflictAction tab commons schemas params columns where
449449 , SOP.All (HasIn columns) subcolumns
450450 , AllUnique subcolumns )
451451 => NP (ColumnExpression 'Ungrouped schemas params '[tab ::: row, "excluded" ::: row]) subcolumns
452− -> [Condition '[] 'Ungrouped commons schemas params '[tab ::: row, "excluded" ::: row]]
452+ -> [Condition '[] commons 'Ungrouped schemas params '[tab ::: row, "excluded" ::: row]]
453453 -> ConflictAction tab commons schemas params columns
454454
455455instance RenderSQL (ConflictAction tab commons schemas params columns) where
@@ -494,7 +494,7 @@ update
494494 => QualifiedAlias sch tab -- ^ table to update
495495 -> NP (ColumnExpression 'Ungrouped schemas params '[tab ::: row0]) subcolumns
496496 -- ^ modified values to replace old values
497− -> Condition '[] 'Ungrouped commons schemas params '[tab ::: row0]
497+ -> Condition '[] commons 'Ungrouped schemas params '[tab ::: row0]
498498 -- ^ condition under which to perform update on a row
499499 -> ReturningClause commons schemas params '[tab ::: row0] row1 -- ^ results to return
500500 -> Manipulation commons schemas params row1
@@ -519,7 +519,7 @@ update_
519519 => QualifiedAlias sch tab -- ^ table to update
520520 -> NP (ColumnExpression 'Ungrouped schemas params '[tab ::: row]) subcolumns
521521 -- ^ modified values to replace old values
522− -> Condition '[] 'Ungrouped commons schemas params '[tab ::: row]
522+ -> Condition '[] commons 'Ungrouped schemas params '[tab ::: row]
523523 -- ^ condition under which to perform update on a row
524524 -> Manipulation commons schemas params '[]
525525update_ tab columns wh = update tab columns wh (Returning_ Nil)
@@ -544,7 +544,7 @@ deleteFrom
544544 , columns ~ TableToColumns table )
545545 => QualifiedAlias sch tab -- ^ table to delete from
546546 -> UsingClause commons schemas params from
547− -> Condition '[] 'Ungrouped commons schemas params (tab ::: row0 ': from)
547+ -> Condition '[] commons 'Ungrouped schemas params (tab ::: row0 ': from)
548548 -- ^ condition under which to delete a row
549549 -> ReturningClause commons schemas params '[tab ::: row0] row1 -- ^ results to return
550550 -> Manipulation commons schemas params row1
@@ -565,7 +565,7 @@ deleteFrom_
565565 , row ~ TableToRow table
566566 , columns ~ TableToColumns table )
567567 => QualifiedAlias sch tab -- ^ table to delete from
568− -> Condition '[] 'Ungrouped commons schemas params '[tab ::: row]
568+ -> Condition '[] commons 'Ungrouped schemas params '[tab ::: row]
569569 -- ^ condition under which to delete a row
570570 -> Manipulation commons schemas params '[]
571571deleteFrom_ tab wh = deleteFrom tab NoUsing wh (Returning_ Nil)
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+91−91
@@ -403,35 +403,35 @@ q1 `exceptAll` q2 = UnsafeQuery $
403403SELECT queries
404404-----------------------------------------}
405405
406−data Selection outer grp commons schemas params from row where
406+data Selection outer commons grp schemas params from row where
407407 List
408408 :: SListI row
409− => NP (Aliased (Expression outer grp commons schemas params from)) row
410− -> Selection outer grp commons schemas params from row
409+ => NP (Aliased (Expression outer commons grp schemas params from)) row
410+ -> Selection outer commons grp schemas params from row
411411 Star
412412 :: HasUnique tab from row
413− => Selection outer 'Ungrouped commons schemas params from row
413+ => Selection outer commons 'Ungrouped schemas params from row
414414 DotStar
415415 :: Has tab from row
416416 => Alias tab
417− -> Selection outer 'Ungrouped commons schemas params from row
417+ -> Selection outer commons 'Ungrouped schemas params from row
418418 Also
419− :: Selection outer grp commons schemas params from right
420− -> Selection outer grp commons schemas params from left
421− -> Selection outer grp commons schemas params from (Join left right)
419+ :: Selection outer commons grp schemas params from right
420+ -> Selection outer commons grp schemas params from left
421+ -> Selection outer commons grp schemas params from (Join left right)
422422 Over
423423 :: SListI row
424− => NP (Aliased (WindowFunction outer grp commons schemas params from)) row
425− -> WindowDefinition outer grp commons schemas params from
426− -> Selection outer grp commons schemas params from row
424+ => NP (Aliased (WindowFunction outer commons grp schemas params from)) row
425+ -> WindowDefinition outer commons grp schemas params from
426+ -> Selection outer commons grp schemas params from row
427427instance (KnownSymbol col, row ~ '[col ::: ty])
428428 => Aliasable col
429− (Expression outer grp commons schemas params from ty)
430− (Selection outer grp commons schemas params from row) where
429+ (Expression outer commons grp schemas params from ty)
430+ (Selection outer commons grp schemas params from row) where
431431 expr `as` col = List (expr `as` col)
432432instance (Has tab (Join outer from) row0, Has col row0 ty, row1 ~ '[col ::: ty])
433433 => IsQualified tab col
434− (Selection outer 'Ungrouped commons schemas params from row1) where
434+ (Selection outer commons 'Ungrouped schemas params from row1) where
435435 tab ! col = tab ! col `as` col
436436instance
437437 ( Has tab (Join outer from) row0
@@ -439,11 +439,11 @@ instance
439439 , row1 ~ '[col ::: ty]
440440 , GroupedBy tab col bys )
441441 => IsQualified tab col
442− (Selection outer ('Grouped bys) commons schemas params from row1) where
442+ (Selection outer commons ('Grouped bys) schemas params from row1) where
443443 tab ! col = tab ! col `as` col
444444instance (HasUnique tab (Join outer from) row0, Has col row0 ty, row1 ~ '[col ::: ty])
445445 => IsLabel col
446− (Selection outer 'Ungrouped commons schemas params from row1) where
446+ (Selection outer commons 'Ungrouped schemas params from row1) where
447447 fromLabel = fromLabel @col `as` Alias
448448instance
449449 ( HasUnique tab (Join outer from) row0
@@ -451,10 +451,10 @@ instance
451451 , row1 ~ '[col ::: ty]
452452 , GroupedBy tab col bys )
453453 => IsLabel col
454− (Selection outer ('Grouped bys) commons schemas params from row1) where
454+ (Selection outer commons ('Grouped bys) schemas params from row1) where
455455 fromLabel = fromLabel @col `as` Alias
456456
457−instance RenderSQL (Selection outer grp commons schemas params from row) where
457+instance RenderSQL (Selection outer commons grp schemas params from row) where
458458 renderSQL = \case
459459 List list -> renderCommaSeparated (renderAliased renderSQL) list
460460 Star -> "*"
@@ -463,7 +463,7 @@ instance RenderSQL (Selection outer grp commons schemas params from row) where
463463 Over winFns winDef ->
464464 let
465465 renderOver
466− :: Aliased (WindowFunction outer grp commons schemas params from) field
466+ :: Aliased (WindowFunction outer commons grp schemas params from) field
467467 -> ByteString
468468 renderOver (winFn `As` col) = renderSQL winFn
469469 <+> "OVER" <+> parenthesized (renderSQL winDef)
@@ -472,7 +472,7 @@ instance RenderSQL (Selection outer grp commons schemas params from row) where
472472 renderCommaSeparated renderOver winFns
473473
474474instance IsString
475− (Selection outer grp commons schemas params from '["fromOnly" ::: 'NotNull 'PGtext]) where
475+ (Selection outer commons grp schemas params from '["fromOnly" ::: 'NotNull 'PGtext]) where
476476 fromString str = fromString str `as` Alias
477477
478478-- | the `TableExpression` in the `select` command constructs an intermediate
@@ -482,9 +482,9 @@ instance IsString
482482-- the intermediate table are actually output.
483483select
484484 :: (SListI row, row ~ (x ': xs))
485− => Selection outer grp commons schemas params from row
485+ => Selection outer commons grp schemas params from row
486486 -- ^ select list
487− -> TableExpression outer grp commons schemas params from
487+ -> TableExpression outer commons grp schemas params from
488488 -- ^ intermediate virtual table
489489 -> Query outer commons schemas params row
490490select selection tabexpr = UnsafeQuery $
@@ -494,8 +494,8 @@ select selection tabexpr = UnsafeQuery $
494494
495495select_
496496 :: (SListI row, row ~ (x ': xs))
497− => NP (Aliased (Expression outer grp commons schemas params from)) row
498− -> TableExpression outer grp commons schemas params from
497+ => NP (Aliased (Expression outer commons grp schemas params from)) row
498+ -> TableExpression outer commons grp schemas params from
499499 -> Query outer commons schemas params row
500500select_ list = select (List list)
501501
@@ -503,9 +503,9 @@ select_ list = select (List list)
503503-- be subject to the elimination of duplicate rows using `selectDistinct`.
504504selectDistinct
505505 :: (SListI columns, columns ~ (col ': cols))
506− => Selection outer 'Ungrouped commons schemas params from columns
506+ => Selection outer commons 'Ungrouped schemas params from columns
507507 -- ^ select list
508− -> TableExpression outer 'Ungrouped commons schemas params from
508+ -> TableExpression outer commons 'Ungrouped schemas params from
509509 -- ^ intermediate virtual table
510510 -> Query outer commons schemas params columns
511511selectDistinct selection tabexpr = UnsafeQuery $
@@ -515,9 +515,9 @@ selectDistinct selection tabexpr = UnsafeQuery $
515515
516516selectDistinct_
517517 :: (SListI columns, columns ~ (col ': cols))
518− => NP (Aliased (Expression outer 'Ungrouped commons schemas params from)) columns
518+ => NP (Aliased (Expression outer commons 'Ungrouped schemas params from)) columns
519519 -- ^ select list
520− -> TableExpression outer 'Ungrouped commons schemas params from
520+ -> TableExpression outer commons 'Ungrouped schemas params from
521521 -- ^ intermediate virtual table
522522 -> Query outer commons schemas params columns
523523selectDistinct_ list = select (List list)
@@ -533,8 +533,8 @@ selectDistinct_ list = select (List list)
533533-- SELECT * FROM (VALUES (1, E'one')) AS t ("a", "b")
534534values
535535 :: SListI cols
536− => NP (Aliased (Expression outer 'Ungrouped commons schemas params '[] )) cols
537− -> [NP (Aliased (Expression outer 'Ungrouped commons schemas params '[] )) cols]
536+ => NP (Aliased (Expression outer commons 'Ungrouped schemas params '[] )) cols
537+ -> [NP (Aliased (Expression outer commons 'Ungrouped schemas params '[] )) cols]
538538 -- ^ When more than one row is specified, all the rows must
539539 -- must have the same number of elements
540540 -> Query outer commons schemas params cols
@@ -548,7 +548,7 @@ values rw rws = UnsafeQuery $ "SELECT * FROM"
548548 <+> parenthesized (renderCommaSeparated renderAliasPart rw)
549549 where
550550 renderAliasPart, renderValuePart
551− :: Aliased (Expression outer 'Ungrouped commons schemas params '[] ) ty -> ByteString
551+ :: Aliased (Expression outer commons 'Ungrouped schemas params '[] ) ty -> ByteString
552552 renderAliasPart (_ `As` name) = renderSQL name
553553 renderValuePart (value `As` _) = renderSQL value
554554
@@ -556,7 +556,7 @@ values rw rws = UnsafeQuery $ "SELECT * FROM"
556556-- specified by value expressions.
557557values_
558558 :: SListI cols
559− => NP (Aliased (Expression outer 'Ungrouped commons schemas params '[] )) cols
559+ => NP (Aliased (Expression outer commons 'Ungrouped schemas params '[] )) cols
560560 -- ^ one row of values
561561 -> Query outer commons schemas params cols
562562values_ rw = values rw []
@@ -573,8 +573,8 @@ Table Expressions
573573-- can be used to modify or combine base tables in various ways.
574574data TableExpression
575575 (outer :: FromType)
576− (grp :: Grouping)
577576 (commons :: FromType)
577+ (grp :: Grouping)
578578 (schemas :: SchemasType)
579579 (params :: [NullityType])
580580 (from :: FromType)
@@ -582,7 +582,7 @@ data TableExpression
582582 { fromClause :: FromClause outer commons schemas params from
583583 -- ^ A table reference that can be a table name, or a derived table such
584584 -- as a subquery, a @JOIN@ construct, or complex combinations of these.
585− , whereClause :: [Condition outer 'Ungrouped commons schemas params from]
585+ , whereClause :: [Condition outer commons 'Ungrouped schemas params from]
586586 -- ^ optional search coditions, combined with `.&&`. After the processing
587587 -- of the `fromClause` is done, each row of the derived virtual table
588588 -- is checked against the search condition. If the result of the
@@ -598,13 +598,13 @@ data TableExpression
598598 -- set of rows having common values into one group row that represents all
599599 -- rows in the group. This is done to eliminate redundancy in the output
600600 -- and/or compute aggregates that apply to these groups.
601− , havingClause :: HavingClause outer grp commons schemas params from
601+ , havingClause :: HavingClause outer commons grp schemas params from
602602 -- ^ If a table has been grouped using `groupBy`, but only certain groups
603603 -- are of interest, the `havingClause` can be used, much like a
604604 -- `whereClause`, to eliminate groups from the result. Expressions in the
605605 -- `havingClause` can refer both to grouped expressions and to ungrouped
606606 -- expressions (which necessarily involve an aggregate function).
607− , orderByClause :: [SortExpression outer grp commons schemas params from]
607+ , orderByClause :: [SortExpression outer commons grp schemas params from]
608608 -- ^ The `orderByClause` is for optional sorting. When more than one
609609 -- `SortExpression` is specified, the later (right) values are used to sort
610610 -- rows that are equal according to the earlier (left) values.
@@ -621,7 +621,7 @@ data TableExpression
621621 } deriving (GHC.Generic)
622622
623623-- | Render a `TableExpression`
624−instance RenderSQL (TableExpression outer grp commons schemas params from) where
624+instance RenderSQL (TableExpression outer commons grp schemas params from) where
625625 renderSQL
626626 (TableExpression frm' whs' grps' hvs' srts' lims' offs') = mconcat
627627 [ "FROM ", renderSQL frm'
@@ -654,15 +654,15 @@ instance RenderSQL (TableExpression outer grp commons schemas params from) where
654654-- to match the left-to-right sequencing of their placement in SQL.
655655from
656656 :: FromClause outer commons schemas params from -- ^ table reference
657− -> TableExpression outer 'Ungrouped commons schemas params from
657+ -> TableExpression outer commons 'Ungrouped schemas params from
658658from tab = TableExpression tab [] NoGroups NoHaving [] [] []
659659
660660-- | A `where_` is an endomorphism of `TableExpression`s which adds a
661661-- search condition to the `whereClause`.
662662where_
663− :: Condition outer 'Ungrouped commons schemas params from -- ^ filtering condition
664− -> TableExpression outer grp commons schemas params from
665− -> TableExpression outer grp commons schemas params from
663+ :: Condition outer commons 'Ungrouped schemas params from -- ^ filtering condition
664+ -> TableExpression outer commons grp schemas params from
665+ -> TableExpression outer commons grp schemas params from
666666where_ wh rels = rels {whereClause = wh : whereClause rels}
667667
668668-- | A `groupBy` is a transformation of `TableExpression`s which switches
@@ -671,8 +671,8 @@ where_ wh rels = rels {whereClause = wh : whereClause rels}
671671groupBy
672672 :: SListI bys
673673 => NP (By from) bys -- ^ grouped columns
674− -> TableExpression outer 'Ungrouped commons schemas params from
675− -> TableExpression outer ('Grouped bys) commons schemas params from
674+ -> TableExpression outer commons 'Ungrouped schemas params from
675+ -> TableExpression outer commons ('Grouped bys) schemas params from
676676groupBy bys rels = TableExpression
677677 { fromClause = fromClause rels
678678 , whereClause = whereClause rels
@@ -686,9 +686,9 @@ groupBy bys rels = TableExpression
686686-- | A `having` is an endomorphism of `TableExpression`s which adds a
687687-- search condition to the `havingClause`.
688688having
689− :: Condition outer ('Grouped bys) commons schemas params from -- ^ having condition
690− -> TableExpression outer ('Grouped bys) commons schemas params from
691− -> TableExpression outer ('Grouped bys) commons schemas params from
689+ :: Condition outer commons ('Grouped bys) schemas params from -- ^ having condition
690+ -> TableExpression outer commons ('Grouped bys) schemas params from
691+ -> TableExpression outer commons ('Grouped bys) schemas params from
692692having hv rels = rels
693693 { havingClause = case havingClause rels of Having hvs -> Having (hv:hvs) }
694694
@@ -699,16 +699,16 @@ instance OrderBy TableExpression where
699699-- `limitClause`.
700700limit
701701 :: Word64 -- ^ limit parameter
702− -> TableExpression outer grp commons schemas params from
703− -> TableExpression outer grp commons schemas params from
702+ -> TableExpression outer commons grp schemas params from
703+ -> TableExpression outer commons grp schemas params from
704704limit lim rels = rels {limitClause = lim : limitClause rels}
705705
706706-- | An `offset` is an endomorphism of `TableExpression`s which adds to the
707707-- `offsetClause`.
708708offset
709709 :: Word64 -- ^ offset parameter
710− -> TableExpression outer grp commons schemas params from
711− -> TableExpression outer grp commons schemas params from
710+ -> TableExpression outer commons grp schemas params from
711+ -> TableExpression outer commons grp schemas params from
712712offset off rels = rels {offsetClause = off : offsetClause rels}
713713
714714{-----------------------------------------
@@ -717,14 +717,14 @@ JSON stuff
717717
718718unsafeSetOfFunction
719719 :: ByteString
720− -> Expression outer 'Ungrouped commons schemas params '[] ty
720+ -> Expression outer commons 'Ungrouped schemas params '[] ty
721721 -> FromClause outer commons schemas params from
722722unsafeSetOfFunction fun expr = UnsafeFromClause $
723723 fun <> "(" <> renderSQL expr <> ")"
724724
725725-- | Expand an array to a set of rows
726726unnest
727− :: Expression outer 'Ungrouped commons schemas params '[] (nullity ('PGvararray ty))
727+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity ('PGvararray ty))
728728 -> FromClause outer commons schemas params '["unnest" ::: '["unnest" ::: ty]]
729729unnest = unsafeSetOfFunction "unnest"
730730
@@ -733,7 +733,7 @@ unnest = unsafeSetOfFunction "unnest"
733733-- >>> printSQL (select Star (from (jsonEach (jsonLit (object ["a" .= "foo", "b" .= "bar"])))))
734734-- SELECT * FROM json_each(('{"a":"foo","b":"bar"}' :: json))
735735jsonEach
736− :: Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
736+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json object
737737 -> FromClause outer commons schemas params
738738 '["json_each" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson]]
739739jsonEach = unsafeSetOfFunction "json_each"
@@ -743,7 +743,7 @@ jsonEach = unsafeSetOfFunction "json_each"
743743-- >>> printSQL (select Star (from (jsonbEach (jsonbLit (object ["a" .= "foo", "b" .= "bar"])))))
744744-- SELECT * FROM jsonb_each(('{"a":"foo","b":"bar"}' :: jsonb))
745745jsonbEach
746− :: Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
746+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
747747 -> FromClause outer commons schemas params
748748 '["jsonb_each" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGjson]]
749749jsonbEach = unsafeSetOfFunction "jsonb_each"
@@ -753,7 +753,7 @@ jsonbEach = unsafeSetOfFunction "jsonb_each"
753753-- >>> printSQL (select Star (from (jsonEachText (jsonLit (object ["a" .= "foo", "b" .= "bar"])))))
754754-- SELECT * FROM json_each_text(('{"a":"foo","b":"bar"}' :: json))
755755jsonEachText
756− :: Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
756+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json object
757757 -> FromClause outer commons schemas params
758758 '["json_each" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]]
759759jsonEachText = unsafeSetOfFunction "json_each_text"
@@ -763,7 +763,7 @@ jsonEachText = unsafeSetOfFunction "json_each_text"
763763-- >>> printSQL (select Star (from (jsonbEachText (jsonbLit (object ["a" .= "foo", "b" .= "bar"])))))
764764-- SELECT * FROM jsonb_each_text(('{"a":"foo","b":"bar"}' :: jsonb))
765765jsonbEachText
766− :: Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
766+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
767767 -> FromClause outer commons schemas params
768768 '["jsonb_each" ::: '["key" ::: 'NotNull 'PGtext, "value" ::: 'NotNull 'PGtext]]
769769jsonbEachText = unsafeSetOfFunction "jsonb_each_text"
@@ -773,7 +773,7 @@ jsonbEachText = unsafeSetOfFunction "jsonb_each_text"
773773-- >>> printSQL (jsonObjectKeys (jsonLit (object ["a" .= "foo", "b" .= "bar"])))
774774-- json_object_keys(('{"a":"foo","b":"bar"}' :: json))
775775jsonObjectKeys
776− :: Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
776+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json object
777777 -> FromClause outer commons schemas params
778778 '["json_object_keys" ::: '["json_object_keys" ::: 'NotNull 'PGtext]]
779779jsonObjectKeys = unsafeSetOfFunction "json_object_keys"
@@ -783,7 +783,7 @@ jsonObjectKeys = unsafeSetOfFunction "json_object_keys"
783783-- >>> printSQL (jsonbObjectKeys (jsonbLit (object ["a" .= "foo", "b" .= "bar"])))
784784-- jsonb_object_keys(('{"a":"foo","b":"bar"}' :: jsonb))
785785jsonbObjectKeys
786− :: Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
786+ :: Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
787787 -> FromClause outer commons schemas params
788788 '["jsonb_object_keys" ::: '["jsonb_object_keys" ::: 'NotNull 'PGtext]]
789789jsonbObjectKeys = unsafeSetOfFunction "jsonb_object_keys"
@@ -792,7 +792,7 @@ unsafePopulateFunction
792792 :: KnownSymbol fun
793793 => Alias fun
794794 -> TypeExpression schemas (nullity ('PGcomposite row))
795− -> Expression outer 'Ungrouped commons schemas params '[] ty
795+ -> Expression outer commons 'Ungrouped schemas params '[] ty
796796 -> FromClause outer commons schemas params '[fun ::: row]
797797unsafePopulateFunction fun ty expr = UnsafeFromClause $ renderSQL fun
798798 <> parenthesized ("null::" <> renderSQL ty <> ", " <> renderSQL expr)
@@ -801,7 +801,7 @@ unsafePopulateFunction fun ty expr = UnsafeFromClause $ renderSQL fun
801801-- type defined by the given table.
802802jsonPopulateRecord
803803 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
804− -> Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
804+ -> Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json object
805805 -> FromClause outer commons schemas params '["json_populate_record" ::: row]
806806jsonPopulateRecord = unsafePopulateFunction #json_populate_record
807807
@@ -809,7 +809,7 @@ jsonPopulateRecord = unsafePopulateFunction #json_populate_record
809809-- type defined by the given table.
810810jsonbPopulateRecord
811811 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
812− -> Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
812+ -> Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
813813 -> FromClause outer commons schemas params '["jsonb_populate_record" ::: row]
814814jsonbPopulateRecord = unsafePopulateFunction #jsonb_populate_record
815815
@@ -817,7 +817,7 @@ jsonbPopulateRecord = unsafePopulateFunction #jsonb_populate_record
817817-- set of rows whose columns match the record type defined by the given table.
818818jsonPopulateRecordSet
819819 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
820− -> Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json array
820+ -> Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json array
821821 -> FromClause outer commons schemas params '["json_populate_record_set" ::: row]
822822jsonPopulateRecordSet = unsafePopulateFunction #json_populate_record_set
823823
@@ -826,14 +826,14 @@ jsonPopulateRecordSet = unsafePopulateFunction #json_populate_record_set
826826-- table.
827827jsonbPopulateRecordSet
828828 :: TypeExpression schemas (nullity ('PGcomposite row)) -- ^ row type
829− -> Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb array
829+ -> Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb array
830830 -> FromClause outer commons schemas params '["jsonb_populate_record_set" ::: row]
831831jsonbPopulateRecordSet = unsafePopulateFunction #jsonb_populate_record_set
832832
833833unsafeRecordFunction
834834 :: (SListI record, json `In` PGJsonType)
835835 => ByteString
836− -> Expression outer 'Ungrouped commons schemas params '[] (nullity json)
836+ -> Expression outer commons 'Ungrouped schemas params '[] (nullity json)
837837 -> Aliased (NP (Aliased (TypeExpression schemas))) (tab ::: record)
838838 -> FromClause outer commons schemas params '[tab ::: record]
839839unsafeRecordFunction fun expr (types `As` tab) = UnsafeFromClause $
@@ -846,7 +846,7 @@ unsafeRecordFunction fun expr (types `As` tab) = UnsafeFromClause $
846846-- | Builds an arbitrary record from a JSON object.
847847jsonToRecord
848848 :: SListI record
849− => Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json object
849+ => Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json object
850850 -> Aliased (NP (Aliased (TypeExpression schemas))) (tab ::: record)
851851 -> FromClause outer commons schemas params '[tab ::: record]
852852jsonToRecord = unsafeRecordFunction "json_to_record"
@@ -854,7 +854,7 @@ jsonToRecord = unsafeRecordFunction "json_to_record"
854854-- | Builds an arbitrary record from a binary JSON object.
855855jsonbToRecord
856856 :: SListI record
857− => Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
857+ => Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb object
858858 -> Aliased (NP (Aliased (TypeExpression schemas))) (tab ::: record)
859859 -> FromClause outer commons schemas params '[tab ::: record]
860860jsonbToRecord = unsafeRecordFunction "jsonb_to_record"
@@ -862,7 +862,7 @@ jsonbToRecord = unsafeRecordFunction "jsonb_to_record"
862862-- | Builds an arbitrary set of records from a JSON array of objects.
863863jsonToRecordSet
864864 :: SListI record
865− => Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjson) -- ^ json array
865+ => Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjson) -- ^ json array
866866 -> Aliased (NP (Aliased (TypeExpression schemas))) (tab ::: record)
867867 -> FromClause outer commons schemas params '[tab ::: record]
868868jsonToRecordSet = unsafeRecordFunction "json_to_record_set"
@@ -870,7 +870,7 @@ jsonToRecordSet = unsafeRecordFunction "json_to_record_set"
870870-- | Builds an arbitrary set of records from a binary JSON array of objects.
871871jsonbToRecordSet
872872 :: SListI record
873− => Expression outer 'Ungrouped commons schemas params '[] (nullity 'PGjsonb) -- ^ jsonb array
873+ => Expression outer commons 'Ungrouped schemas params '[] (nullity 'PGjsonb) -- ^ jsonb array
874874 -> Aliased (NP (Aliased (TypeExpression schemas))) (tab ::: record)
875875 -> FromClause outer commons schemas params '[tab ::: record]
876876jsonbToRecordSet = unsafeRecordFunction "jsonb_to_record_set"
@@ -940,7 +940,7 @@ the @on@ condition.
940940innerJoin
941941 :: FromClause outer commons schemas params right
942942 -- ^ right
943− -> Condition outer 'Ungrouped commons schemas params (Join left right)
943+ -> Condition outer commons 'Ungrouped schemas params (Join left right)
944944 -- ^ @on@ condition
945945 -> FromClause outer commons schemas params left
946946 -- ^ left
@@ -957,7 +957,7 @@ innerJoin right on left = UnsafeFromClause $
957957leftOuterJoin
958958 :: FromClause outer commons schemas params right
959959 -- ^ right
960− -> Condition outer 'Ungrouped commons schemas params (Join left right)
960+ -> Condition outer commons 'Ungrouped schemas params (Join left right)
961961 -- ^ @on@ condition
962962 -> FromClause outer commons schemas params left
963963 -- ^ left
@@ -975,7 +975,7 @@ leftOuterJoin right on left = UnsafeFromClause $
975975rightOuterJoin
976976 :: FromClause outer commons schemas params right
977977 -- ^ right
978− -> Condition outer 'Ungrouped commons schemas params (Join left right)
978+ -> Condition outer commons 'Ungrouped schemas params (Join left right)
979979 -- ^ @on@ condition
980980 -> FromClause outer commons schemas params left
981981 -- ^ left
@@ -994,7 +994,7 @@ rightOuterJoin right on left = UnsafeFromClause $
994994fullOuterJoin
995995 :: FromClause outer commons schemas params right
996996 -- ^ right
997− -> Condition outer 'Ungrouped commons schemas params (Join left right)
997+ -> Condition outer commons 'Ungrouped schemas params (Join left right)
998998 -- ^ @on@ condition
999999 -> FromClause outer commons schemas params left
10001000 -- ^ left
@@ -1067,17 +1067,17 @@ instance RenderSQL (GroupByClause grp from) where
10671067-- An `Ungrouped` `TableExpression` may only use `NoHaving` while a `Grouped`
10681068-- `TableExpression` must use `Having` whose conditions are combined with
10691069-- `.&&`.
1070−data HavingClause outer grp commons schemas params from where
1071− NoHaving :: HavingClause outer 'Ungrouped commons schemas params from
1070+data HavingClause outer commons grp schemas params from where
1071+ NoHaving :: HavingClause outer commons 'Ungrouped schemas params from
10721072 Having
1073− :: [Condition outer ('Grouped bys) commons schemas params from]
1074− -> HavingClause outer ('Grouped bys) commons schemas params from
1075−deriving instance Show (HavingClause outer grp commons schemas params from)
1076−deriving instance Eq (HavingClause outer grp commons schemas params from)
1077−deriving instance Ord (HavingClause outer grp commons schemas params from)
1073+ :: [Condition outer commons ('Grouped bys) schemas params from]
1074+ -> HavingClause outer commons ('Grouped bys) schemas params from
1075+deriving instance Show (HavingClause outer commons grp schemas params from)
1076+deriving instance Eq (HavingClause outer commons grp schemas params from)
1077+deriving instance Ord (HavingClause outer commons grp schemas params from)
10781078
10791079-- | Render a `HavingClause`.
1080−instance RenderSQL (HavingClause outer grp commons schemas params from) where
1080+instance RenderSQL (HavingClause outer commons grp schemas params from) where
10811081 renderSQL = \case
10821082 NoHaving -> ""
10831083 Having [] -> ""
@@ -1098,7 +1098,7 @@ at least one row is returned, not all the way to completion.
10981098-}
10991099exists
11001100 :: Query (Join outer from) commons schemas params row
1101− -> Condition outer grp commons schemas params from
1101+ -> Condition outer commons grp schemas params from
11021102exists query = UnsafeExpression $ "EXISTS" <+> parenthesized (renderSQL query)
11031103
11041104{- |
@@ -1115,10 +1115,10 @@ and at least one comparison returns `null_`.
11151115(TRUE = ALL (SELECT * FROM (VALUES (TRUE)) AS t ("foo")))
11161116-}
11171117subAll
1118− :: Expression outer grp commons schemas params from ty1 -- ^ expression
1118+ :: Expression outer commons grp schemas params from ty1 -- ^ expression
11191119 -> Operator ty1 ty2 ('Null 'PGbool) -- ^ operator
11201120 -> Query (Join outer from) commons schemas params '[col ::: ty2] -- ^ subquery
1121− -> Condition outer grp commons schemas params from
1121+ -> Condition outer commons grp schemas params from
11221122subAll expr (?) qry = expr ?
11231123 (UnsafeExpression $ "ALL" <+> parenthesized (renderSQL qry))
11241124
@@ -1133,10 +1133,10 @@ if any `true` result is obtained. The result is `false` if no true result is fou
11331133(E'foo' LIKE ALL (SELECT * FROM (VALUES (E'foobar')) AS t ("foo")))
11341134-}
11351135subAny
1136− :: Expression outer grp commons schemas params from ty1 -- ^ expression
1136+ :: Expression outer commons grp schemas params from ty1 -- ^ expression
11371137 -> Operator ty1 ty2 ('Null 'PGbool) -- ^ operator
11381138 -> Query (Join outer from) commons schemas params '[col ::: ty2] -- ^ subquery
1139− -> Condition outer grp commons schemas params from
1139+ -> Condition outer commons grp schemas params from
11401140subAny expr (?) qry = expr ?
11411141 (UnsafeExpression $ "ANY" <+> parenthesized (renderSQL qry))
11421142
@@ -1148,9 +1148,9 @@ to any of the right-hand expressions.
11481148TRUE IN (TRUE, FALSE, NULL)
11491149-}
11501150in_
1151− :: Expression outer grp commons schemas params from ty -- ^ expression
1152− -> [Expression outer grp commons schemas params from ty]
1153− -> Condition outer grp commons schemas params from
1151+ :: Expression outer commons grp schemas params from ty -- ^ expression
1152+ -> [Expression outer commons grp schemas params from ty]
1153+ -> Condition outer commons grp schemas params from
11541154expr `in_` exprs = UnsafeExpression $ renderSQL expr <+> "IN"
11551155 <+> parenthesized (commaSeparated (renderSQL <$> exprs))
11561156
@@ -1162,9 +1162,9 @@ to any of the right-hand expressions.
11621162TRUE NOT IN (FALSE, NULL)
11631163-}
11641164notIn
1165− :: Expression outer grp commons schemas params from ty -- ^ expression
1166− -> [Expression outer grp commons schemas params from ty]
1167− -> Condition outer grp commons schemas params from
1165+ :: Expression outer commons grp schemas params from ty -- ^ expression
1166+ -> [Expression outer commons grp schemas params from ty]
1167+ -> Condition outer commons grp schemas params from
11681168expr `notIn` exprs = UnsafeExpression $ renderSQL expr <+> "NOT IN"
11691169 <+> parenthesized (commaSeparated (renderSQL <$> exprs))
11701170