@@ -450,7 +450,7 @@ instance (PGNum ty, PGFloating ty) => Floating
450450 acosh x = log (x + sqrt (x*x - 1))
451451 atanh x = log ((1 + x) / (1 - x)) / 2
452452
453−-- | :{
453+-- | >>> :{
454454-- let
455455-- expression :: Expression tables grouping params (nullity 'PGfloat4)
456456-- expression = atan2_ pi 2
@@ -483,7 +483,8 @@ cast ty x = UnsafeExpression $ parenthesized $
483483 renderExpression x <+> "::" <+> renderTypeExpression ty
484484
485485-- | integer division, truncates the result
486−-- :{
486+--
487+-- >>> :{
487488-- let
488489-- expression :: Expression tables grouping params (nullity 'PGint2)
489490-- expression = 5 `quot_` 2
@@ -501,7 +502,7 @@ quot_ = unsafeBinaryOp "/"
501502
502503-- | remainder upon integer division
503504--
504−-- :{
505+-- >>> :{
505506-- let
506507-- expression :: Expression tables grouping params (nullity 'PGint2)
507508-- expression = 5 `rem_` 2
@@ -517,7 +518,7 @@ rem_
517518 -> Expression tables grouping params (nullity int)
518519rem_ = unsafeBinaryOp "%"
519520
520−-- | :{
521+-- | >>> :{
521522-- let
522523-- expression :: Expression tables grouping params (nullity 'PGfloat4)
523524-- expression = trunc pi
@@ -531,7 +532,7 @@ trunc
531532 -> Expression tables grouping params (nullity frac)
532533trunc = unsafeFunction "trunc"
533534
534−-- | :{
535+-- | >>> :{
535536-- let
536537-- expression :: Expression tables grouping params (nullity 'PGfloat4)
537538-- expression = round_ pi
@@ -545,7 +546,7 @@ round_
545546 -> Expression tables grouping params (nullity frac)
546547round_ = unsafeFunction "round"
547548
548−-- | :{
549+-- | >>> :{
549550-- let
550551-- expression :: Expression tables grouping params (nullity 'PGfloat4)
551552-- expression = ceiling_ pi
@@ -599,7 +600,7 @@ not_ = unsafeUnaryOp "NOT"
599600 -> Condition tables grouping params
600601(.||) = unsafeBinaryOp "OR"
601602
602−-- | :{
603+-- | >>> :{
603604-- let
604605-- expression :: Expression tables grouping params (nullity 'PGint2)
605606-- expression = caseWhenThenElse [(true, 1), (false, 2)] 3
@@ -625,7 +626,7 @@ caseWhenThenElse whenThens else_ = UnsafeExpression $ mconcat
625626 , " END"
626627 ]
627628
628−-- | :{
629+-- | >>> :{
629630-- let
630631-- expression :: Expression tables grouping params (nullity 'PGint2)
631632-- expression = ifThenElse true 1 0
@@ -812,7 +813,7 @@ unsafeAggregateDistinct
812813unsafeAggregateDistinct fun x = UnsafeExpression $ mconcat
813814 [fun, "(DISTINCT ", renderExpression x, ")"]
814815
815−-- | :{
816+-- | >>> :{
816817-- let
817818-- expression :: Expression [tab ::: ["col" ::: nullity 'PGnumeric]] grouping params (nullity 'PGnumeric)
818819-- expression = sum_ #col
@@ -826,7 +827,7 @@ sum_
826827 -> Expression tables ('Grouped bys) params (nullity ty)
827828sum_ = unsafeAggregate "sum"
828829
829−-- | :{
830+-- | >>> :{
830831-- let
831832-- expression :: Expression [tab ::: ["col" ::: nullity 'PGnumeric]] grouping params (nullity 'PGnumeric)
832833-- expression = sumDistinct #col
@@ -857,7 +858,7 @@ instance PGAvg 'PGfloat4 'PGfloat8
857858instance PGAvg 'PGfloat8 'PGfloat8
858859instance PGAvg 'PGinterval 'PGinterval
859860
860−-- | :{
861+-- | >>> :{
861862-- let
862863-- expression :: Expression [tab ::: ["col" ::: nullity 'PGint4]] grouping params (nullity 'PGint4)
863864-- expression = bitAnd #col
@@ -871,7 +872,7 @@ bitAnd
871872 -> Expression tables ('Grouped bys) params (nullity int)
872873bitAnd = unsafeAggregate "bit_and"
873874
874−-- | :{
875+-- | >>> :{
875876-- let
876877-- expression :: Expression [tab ::: ["col" ::: nullity 'PGint4]] grouping params (nullity 'PGint4)
877878-- expression = bitOr #col
@@ -885,7 +886,7 @@ bitOr
885886 -> Expression tables ('Grouped bys) params (nullity int)
886887bitOr = unsafeAggregate "bit_or"
887888
888−-- | :{
889+-- | >>> :{
889890-- let
890891-- expression :: Expression [tab ::: ["col" ::: nullity 'PGint4]] grouping params (nullity 'PGint4)
891892-- expression = bitAndDistinct #col
@@ -899,7 +900,7 @@ bitAndDistinct
899900 -> Expression tables ('Grouped bys) params (nullity int)
900901bitAndDistinct = unsafeAggregateDistinct "bit_and"
901902
902−-- | :{
903+-- | >>> :{
903904-- let
904905-- expression :: Expression [tab ::: ["col" ::: nullity 'PGint4]] grouping params (nullity 'PGint4)
905906-- expression = bitOrDistinct #col
@@ -913,7 +914,7 @@ bitOrDistinct
913914 -> Expression tables ('Grouped bys) params (nullity int)
914915bitOrDistinct = unsafeAggregateDistinct "bit_or"
915916
916−-- | :{
917+-- | >>> :{
917918-- let
918919-- expression :: Expression [tab ::: ["col" ::: nullity 'PGbool]] grouping params (nullity 'PGbool)
919920-- expression = boolAnd #col
@@ -926,7 +927,7 @@ boolAnd
926927 -> Expression tables ('Grouped bys) params (nullity 'PGbool)
927928boolAnd = unsafeAggregate "bool_and"
928929
929−-- | :{
930+-- | >>> :{
930931-- let
931932-- expression :: Expression [tab ::: ["col" ::: nullity 'PGbool]] grouping params (nullity 'PGbool)
932933-- expression = boolOr #col
@@ -939,7 +940,7 @@ boolOr
939940 -> Expression tables ('Grouped bys) params (nullity 'PGbool)
940941boolOr = unsafeAggregate "bool_or"
941942
942−-- | :{
943+-- | >>> :{
943944-- let
944945-- expression :: Expression [tab ::: ["col" ::: nullity 'PGbool]] grouping params (nullity 'PGbool)
945946-- expression = boolAndDistinct #col
@@ -952,7 +953,7 @@ boolAndDistinct
952953 -> Expression tables ('Grouped bys) params (nullity 'PGbool)
953954boolAndDistinct = unsafeAggregateDistinct "bool_and"
954955
955−-- | :{
956+-- | >>> :{
956957-- let
957958-- expression :: Expression [tab ::: ["col" ::: nullity 'PGbool]] grouping params (nullity 'PGbool)
958959-- expression = boolOrDistinct #col
@@ -973,7 +974,7 @@ countStar
973974 :: Expression tables ('Grouped bys) params ('NotNull 'PGint8)
974975countStar = UnsafeExpression $ "count(*)"
975976
976−-- | :{
977+-- | >>> :{
977978-- let
978979-- expression :: Expression [tab ::: ["col" ::: nullity ty]] grouping params (nullity 'PGbool)
979980-- expression = count #col
@@ -986,7 +987,7 @@ count
986987 -> Expression tables ('Grouped bys) params ('NotNull 'PGint8)
987988count = unsafeAggregate "count"
988989
989−-- | :{
990+-- | >>> :{
990991-- let
991992-- expression :: Expression [tab ::: ["col" ::: nullity ty]] grouping params (nullity 'PGbool)
992993-- expression = countDistinct #col
@@ -1001,7 +1002,7 @@ countDistinct = unsafeAggregateDistinct "count"
10011002
10021003-- | synonym for `boolAnd`
10031004--
1004−-- :{
1005+-- >>> :{
10051006-- let
10061007-- expression :: Expression [tab ::: ["col" ::: nullity 'PGbool]] grouping params (nullity 'PGbool)
10071008-- expression = every #col
@@ -1016,7 +1017,7 @@ every = unsafeAggregate "every"
10161017
10171018-- | synonym for `boolAndDistinct`
10181019--
1019−-- :{
1020+-- >>> :{
10201021-- let
10211022-- expression :: Expression [tab ::: ["col" ::: nullity 'PGbool]] grouping params (nullity 'PGbool)
10221023-- expression = everyDistinct #col