on dev help sign in
Het ~> N
commitfc0615c3c1f50c0518d006de48a0b6dbe52ea239 authorEitan Chatav <eitan@Eitans-MacBook-Pro.local> dateFri 29 Mar 2019, 16:35 (8 years ago) parentd1181e4
1 file changed+33−33
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+33−33
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+33−33
@@ -1609,20 +1609,20 @@ tsHeadline = unsafeFunctionN "ts_headline"
16091609aggregation
16101610-----------------------------------------}
16111611
1612−unsafeAggregateHet
1612+unsafeAggregateN
16131613 :: SOP.SListI xs
16141614 => ByteString -- ^ function
16151615 -> Distinction (NP (Expression outer commons 'Ungrouped schemas params from)) xs
16161616 -> Expression outer commons ('Grouped bys) schemas params from y
1617−unsafeAggregateHet fun xs = UnsafeExpression $ fun <> parenthesized (renderSQL xs)
1617+unsafeAggregateN fun xs = UnsafeExpression $ fun <> parenthesized (renderSQL xs)
16181618
16191619{- |
16201620`Aggregate` functions compute a single result from a set of input values.
16211621`Aggregate` functions can be used as `GroupedBy` `Expression`s as well
16221622as `WindowFunction`s.
16231623-}
1624−class Aggregate expr1 exprHet aggr
1625− | aggr -> expr1, aggr -> exprHet where
1624+class Aggregate expr1 exprN aggr
1625+ | aggr -> expr1, aggr -> exprN where
16261626
16271627 -- | A special aggregation that does not require an input
16281628 --
@@ -1783,7 +1783,7 @@ class Aggregate expr1 exprHet aggr
17831783 corr(ALL "y", "x")
17841784 -}
17851785 corr
1786− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1786+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
17871787 -> aggr ('Null 'PGfloat8)
17881788
17891789 {- | population covariance
@@ -1796,7 +1796,7 @@ class Aggregate expr1 exprHet aggr
17961796 covar_pop(ALL "y", "x")
17971797 -}
17981798 covarPop
1799− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1799+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18001800 -> aggr ('Null 'PGfloat8)
18011801
18021802 {- | sample covariance
@@ -1809,7 +1809,7 @@ class Aggregate expr1 exprHet aggr
18091809 covar_samp("y", "x")
18101810 -}
18111811 covarSamp
1812− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1812+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18131813 -> aggr ('Null 'PGfloat8)
18141814
18151815 {- | average of the independent variable (sum(X)/N)
@@ -1822,7 +1822,7 @@ class Aggregate expr1 exprHet aggr
18221822 regr_avgx(ALL "y", "x")
18231823 -}
18241824 regrAvgX
1825− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1825+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18261826 -> aggr ('Null 'PGfloat8)
18271827
18281828 {- | average of the dependent variable (sum(Y)/N)
@@ -1835,7 +1835,7 @@ class Aggregate expr1 exprHet aggr
18351835 regr_avgy("y", "x")
18361836 -}
18371837 regrAvgY
1838− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1838+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18391839 -> aggr ('Null 'PGfloat8)
18401840
18411841 {- | number of input rows in which both expressions are nonnull
@@ -1848,7 +1848,7 @@ class Aggregate expr1 exprHet aggr
18481848 regr_count("y", "x")
18491849 -}
18501850 regrCount
1851− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1851+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18521852 -> aggr ('Null 'PGint8)
18531853
18541854 {- | y-intercept of the least-squares-fit linear equation determined by the (X, Y) pairs
@@ -1861,36 +1861,36 @@ class Aggregate expr1 exprHet aggr
18611861 regr_intercept(ALL "y", "x")
18621862 -}
18631863 regrIntercept
1864− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1864+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18651865 -> aggr ('Null 'PGfloat8)
18661866
18671867 -- | @regr_r2(Y, X)@, square of the correlation coefficient
18681868 regrR2
1869− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1869+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18701870 -> aggr ('Null 'PGfloat8)
18711871
18721872 -- | @regr_slope(Y, X)@, slope of the least-squares-fit linear equation
18731873 -- determined by the (X, Y) pairs
18741874 regrSlope
1875− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1875+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18761876 -> aggr ('Null 'PGfloat8)
18771877
18781878 -- | @regr_sxx(Y, X)@, sum(X^2) - sum(X)^2/N
18791879 -- (“sum of squares” of the independent variable)
18801880 regrSxx
1881− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1881+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18821882 -> aggr ('Null 'PGfloat8)
18831883
18841884 -- | @regr_sxy(Y, X)@, sum(X*Y) - sum(X) * sum(Y)/N
18851885 -- (“sum of products” of independent times dependent variable)
18861886 regrSxy
1887− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1887+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18881888 -> aggr ('Null 'PGfloat8)
18891889
18901890 -- | @regr_syy(Y, X)@, sum(Y^2) - sum(Y)^2/N
18911891 -- (“sum of squares” of the dependent variable)
18921892 regrSyy
1893− :: exprHet '[null 'PGfloat8, null 'PGfloat8]
1893+ :: exprN '[null 'PGfloat8, null 'PGfloat8]
18941894 -> aggr ('Null 'PGfloat8)
18951895
18961896 -- | historical alias for `stddevSamp`
@@ -1964,18 +1964,18 @@ instance Aggregate
19641964 max_ = unsafeAggregate1 "max"
19651965 min_ = unsafeAggregate1 "min"
19661966 avg = unsafeAggregate1 "avg"
1967− corr = unsafeAggregateHet "corr"
1968− covarPop = unsafeAggregateHet "covar_pop"
1969− covarSamp = unsafeAggregateHet "covar_samp"
1970− regrAvgX = unsafeAggregateHet "regr_avgx"
1971− regrAvgY = unsafeAggregateHet "regr_avgy"
1972− regrCount = unsafeAggregateHet "regr_count"
1973− regrIntercept = unsafeAggregateHet "regr_intercept"
1974− regrR2 = unsafeAggregateHet "regr_r2"
1975− regrSlope = unsafeAggregateHet "regr_slope"
1976− regrSxx = unsafeAggregateHet "regr_sxx"
1977− regrSxy = unsafeAggregateHet "regr_sxy"
1978− regrSyy = unsafeAggregateHet "regr_syy"
1967+ corr = unsafeAggregateN "corr"
1968+ covarPop = unsafeAggregateN "covar_pop"
1969+ covarSamp = unsafeAggregateN "covar_samp"
1970+ regrAvgX = unsafeAggregateN "regr_avgx"
1971+ regrAvgY = unsafeAggregateN "regr_avgy"
1972+ regrCount = unsafeAggregateN "regr_count"
1973+ regrIntercept = unsafeAggregateN "regr_intercept"
1974+ regrR2 = unsafeAggregateN "regr_r2"
1975+ regrSlope = unsafeAggregateN "regr_slope"
1976+ regrSxx = unsafeAggregateN "regr_sxx"
1977+ regrSxy = unsafeAggregateN "regr_sxy"
1978+ regrSyy = unsafeAggregateN "regr_syy"
19791979 stddev = unsafeAggregate1 "stddev"
19801980 stddevPop = unsafeAggregate1 "stddev_pop"
19811981 stddevSamp = unsafeAggregate1 "stddev_samp"
@@ -2353,7 +2353,7 @@ type WinFun1 x y
23532353 -> WindowFunction outer commons grp schemas params from y
23542354 -- ^ output
23552355
2356−type WinFunHet xs y
2356+type WinFunN xs y
23572357 = forall outer commons grp schemas params from
23582358 . NP (Expression outer commons grp schemas params from) xs
23592359 -- ^ inputs
@@ -2364,7 +2364,7 @@ unsafeWindowFunction1 :: ByteString -> WinFun1 x y
23642364unsafeWindowFunction1 fun x
23652365 = UnsafeWindowFunction $ fun <> parenthesized (renderSQL x)
23662366
2367−unsafeWindowFunctionN :: SOP.SListI xs => ByteString -> WinFunHet xs y
2367+unsafeWindowFunctionN :: SOP.SListI xs => ByteString -> WinFunN xs y
23682368unsafeWindowFunctionN fun xs = UnsafeWindowFunction $ fun <>
23692369 parenthesized (renderCommaSeparated renderSQL xs)
23702370
@@ -2415,7 +2415,7 @@ row within the partition; if there is no such row, instead return default
24152415(which must be of the same type as value). Both offset and default are
24162416evaluated with respect to the current row.
24172417-}
2418−lag :: WinFunHet '[ty, 'NotNull 'PGint4, ty] ty
2418+lag :: WinFunN '[ty, 'NotNull 'PGint4, ty] ty
24192419lag = unsafeWindowFunctionN "lag"
24202420
24212421{- | returns value evaluated at the row that is offset rows after the current
@@ -2423,7 +2423,7 @@ row within the partition; if there is no such row, instead return default
24232423(which must be of the same type as value). Both offset and default are
24242424evaluated with respect to the current row.
24252425-}
2426−lead :: WinFunHet '[ty, 'NotNull 'PGint4, ty] ty
2426+lead :: WinFunN '[ty, 'NotNull 'PGint4, ty] ty
24272427lead = unsafeWindowFunctionN "lag"
24282428
24292429{- | returns value evaluated at the row that is the
@@ -2441,7 +2441,7 @@ lastValue = unsafeWindowFunction1 "last_value"
24412441{- | returns value evaluated at the row that is the nth
24422442row of the window frame (counting from 1); null if no such row
24432443-}
2444−nthValue :: WinFunHet '[null ty, 'NotNull 'PGint4] ('Null ty)
2444+nthValue :: WinFunN '[null ty, 'NotNull 'PGint4] ('Null ty)
24452445nthValue = unsafeWindowFunctionN "nth_value"
24462446
24472447{-|