on dev help sign in
fix tests & haddocks
9d8d46eEitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+9−9
@@ -1540,7 +1540,7 @@ class Aggregate expr1 expr2 aggr
1540
1540
1541 >>> :{
1541 >>> :{
1542 let
1542 let
1543− expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGbool]] (nullity 'PGbool)
1543+ expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGbool]] ('Null 'PGbool)
1544 expression = boolOr (All #col)
1544 expression = boolOr (All #col)
1545 in printSQL expression
1545 in printSQL expression
1546 :}
1546 :}
@@ -1556,7 +1556,7 @@ class Aggregate expr1 expr2 aggr
1556
1556
1557 >>> :{
1557 >>> :{
1558 let
1558 let
1559− expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGbool]] (nullity 'PGbool)
1559+ expression :: Expression '[] ('Grouped bys) commons schemas params '[tab ::: '["col" ::: nullity 'PGbool]] ('Null 'PGbool)
1560 expression = every (Distinct #col)
1560 expression = every (Distinct #col)
1561 in printSQL expression
1561 in printSQL expression
1562 :}
1562 :}
@@ -1588,7 +1588,7 @@ class Aggregate expr1 expr2 aggr
1588 {- | correlation coefficient
1588 {- | correlation coefficient
1589 >>> :{
1589 >>> :{
1590 let
1590 let
1591− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGfloat8)
1591+ expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1592 expression = corr (All (#y :*: #x))
1592 expression = corr (All (#y :*: #x))
1593 in printSQL expression
1593 in printSQL expression
1594 :}
1594 :}
@@ -1601,7 +1601,7 @@ class Aggregate expr1 expr2 aggr
1601 {- | population covariance
1601 {- | population covariance
1602 >>> :{
1602 >>> :{
1603 let
1603 let
1604− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGfloat8)
1604+ expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1605 expression = covarPop (All (#y :*: #x))
1605 expression = covarPop (All (#y :*: #x))
1606 in printSQL expression
1606 in printSQL expression
1607 :}
1607 :}
@@ -1614,7 +1614,7 @@ class Aggregate expr1 expr2 aggr
1614 {- | sample covariance
1614 {- | sample covariance
1615 >>> :{
1615 >>> :{
1616 let
1616 let
1617− winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGfloat8)
1617+ winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1618 winFun = covarSamp (#y :*: #x)
1618 winFun = covarSamp (#y :*: #x)
1619 in printSQL winFun
1619 in printSQL winFun
1620 :}
1620 :}
@@ -1627,7 +1627,7 @@ class Aggregate expr1 expr2 aggr
1627 {- | average of the independent variable (sum(X)/N)
1627 {- | average of the independent variable (sum(X)/N)
1628 >>> :{
1628 >>> :{
1629 let
1629 let
1630− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGfloat8)
1630+ expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1631 expression = regrAvgX (All (#y :*: #x))
1631 expression = regrAvgX (All (#y :*: #x))
1632 in printSQL expression
1632 in printSQL expression
1633 :}
1633 :}
@@ -1640,7 +1640,7 @@ class Aggregate expr1 expr2 aggr
1640 {- | average of the dependent variable (sum(Y)/N)
1640 {- | average of the dependent variable (sum(Y)/N)
1641 >>> :{
1641 >>> :{
1642 let
1642 let
1643− winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGfloat8)
1643+ winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1644 winFun = regrAvgY (#y :*: #x)
1644 winFun = regrAvgY (#y :*: #x)
1645 in printSQL winFun
1645 in printSQL winFun
1646 :}
1646 :}
@@ -1653,7 +1653,7 @@ class Aggregate expr1 expr2 aggr
1653 {- | number of input rows in which both expressions are nonnull
1653 {- | number of input rows in which both expressions are nonnull
1654 >>> :{
1654 >>> :{
1655 let
1655 let
1656− winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGint8)
1656+ winFun :: WindowFunction '[] 'Ungrouped c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGint8)
1657 winFun = regrCount (#y :*: #x)
1657 winFun = regrCount (#y :*: #x)
1658 in printSQL winFun
1658 in printSQL winFun
1659 :}
1659 :}
@@ -1666,7 +1666,7 @@ class Aggregate expr1 expr2 aggr
1666 {- | y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs
1666 {- | y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs
1667 >>> :{
1667 >>> :{
1668 let
1668 let
1669− expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('NotNull 'PGfloat8)
1669+ expression :: Expression '[] ('Grouped g) c s p '[t ::: '["x" ::: 'NotNull 'PGfloat8, "y" ::: 'NotNull 'PGfloat8]] ('Null 'PGfloat8)
1670 expression = regrIntercept (All (#y :*: #x))
1670 expression = regrIntercept (All (#y :*: #x))
1671 in printSQL expression
1671 in printSQL expression
1672 :}
1672 :}
squeal-postgresql/src/Squeal/PostgreSQL/Query.hs+5−3
@@ -720,6 +720,7 @@ unsafeSetOfFunction
720unsafeSetOfFunction fun expr = UnsafeQuery $
720unsafeSetOfFunction fun expr = UnsafeQuery $
721 "SELECT * FROM " <> fun <> "(" <> renderSQL expr <> ")"
721 "SELECT * FROM " <> fun <> "(" <> renderSQL expr <> ")"
722
722
723+-- | Expand an array to a set of rows
723unnest
724unnest
724 :: Expression outer 'Ungrouped commons schemas params '[] (nullity ('PGvararray ty))
725 :: Expression outer 'Ungrouped commons schemas params '[] (nullity ('PGvararray ty))
725 -> Query outer commons schemas params '[ "unnest" ::: ty ]
726 -> Query outer commons schemas params '[ "unnest" ::: ty ]
@@ -891,6 +892,7 @@ view
891view (vw `As` alias) = UnsafeFromClause $
892view (vw `As` alias) = UnsafeFromClause $
892 renderSQL vw <+> "AS" <+> renderSQL alias
893 renderSQL vw <+> "AS" <+> renderSQL alias
893
894
895+-- | `common` derives a table from a common table expression.
894common
896common
895 :: Has cte commons common
897 :: Has cte commons common
896 => Aliased Alias (alias ::: cte)
898 => Aliased Alias (alias ::: cte)
@@ -1063,7 +1065,7 @@ instance RenderSQL (HavingClause outer grp commons schemas params from) where
1063 Having conditions ->
1065 Having conditions ->
1064 " HAVING" <+> commaSeparated (renderSQL <$> conditions)
1066 " HAVING" <+> commaSeparated (renderSQL <$> conditions)
1065
1067
1066−{-
1068+{- |
1067The argument of `exists` is an arbitrary subquery. The subquery is evaluated
1069The argument of `exists` is an arbitrary subquery. The subquery is evaluated
1068to determine whether it returns any rows. If it returns at least one row,
1070to determine whether it returns any rows. If it returns at least one row,
1069the result of `exists` is `true`; if the subquery returns no rows,
1071the result of `exists` is `true`; if the subquery returns no rows,
@@ -1125,7 +1127,7 @@ subAny
1125subAny expr (?) qry = expr ?
1127subAny expr (?) qry = expr ?
1126 (UnsafeExpression $ "ANY" <+> parenthesized (renderSQL qry))
1128 (UnsafeExpression $ "ANY" <+> parenthesized (renderSQL qry))
1127
1129
1128−{-
1130+{- |
1129The result is `true` if the left-hand expression's result is equal
1131The result is `true` if the left-hand expression's result is equal
1130to any of the right-hand expressions.
1132to any of the right-hand expressions.
1131
1133
@@ -1139,7 +1141,7 @@ in_
1139expr `in_` exprs = UnsafeExpression $ renderSQL expr <+> "IN"
1141expr `in_` exprs = UnsafeExpression $ renderSQL expr <+> "IN"
1140 <+> parenthesized (commaSeparated (renderSQL <$> exprs))
1142 <+> parenthesized (commaSeparated (renderSQL <$> exprs))
1141
1143
1142−{-
1144+{- |
1143The result is `true` if the left-hand expression's result is not equal
1145The result is `true` if the left-hand expression's result is not equal
1144to any of the right-hand expressions.
1146to any of the right-hand expressions.
1145
1147