on dev help sign in
operator renaming
commit9a2cd8d1598c210d8fbad44ed34d81fae44488cc authorEitan Chatav <eitan@EEM109LMBP-1.local> dateTue 16 Jul 2019, 12:37 (7 years ago) parent5105396
2 files changed+37−34
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+10−3 squeal-postgresql/src/Squeal/PostgreSQL/Expression/Range.hs+27−31
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+10−3
@@ -45,6 +45,7 @@ module Squeal.PostgreSQL.Expression
4545 , FunctionN
4646 , unsafeFunctionN
4747 , PGSubset (..)
48+ , PGIntersect (..)
4849 -- * Re-export
4950 , (&)
5051 , K (..)
@@ -353,16 +354,22 @@ instance (ty `In` PGNum, ty `In` PGFloating) => Floating
353354 atanh x = log ((1 + x) / (1 - x)) / 2
354355
355356-- | Contained by operators
356−class PGSubset subset where
357− (@>) :: Operator (null0 subset) (null1 subset) ('Null 'PGbool)
357+class PGSubset ty where
358+ (@>) :: Operator (null0 ty) (null1 ty) ('Null 'PGbool)
358359 (@>) = unsafeBinaryOp "@>"
359− (<@) :: Operator (null0 subset) (null1 subset) ('Null 'PGbool)
360+ (<@) :: Operator (null0 ty) (null1 ty) ('Null 'PGbool)
360361 (<@) = unsafeBinaryOp "<@"
361362instance PGSubset 'PGjsonb
362363instance PGSubset 'PGtsquery
363364instance PGSubset ('PGvararray ty)
364365instance PGSubset ('PGrange ty)
365366
367+class PGIntersect ty where
368+ (@&&) :: Operator (null0 ty) (null1 ty) ('Null 'PGbool)
369+ (@&&) = unsafeBinaryOp "&&"
370+instance PGIntersect ('PGvararray ty)
371+instance PGIntersect ('PGrange ty)
372+
366373instance IsString
367374 (Expression outer commons grp schemas params from (null 'PGtext)) where
368375 fromString str = UnsafeExpression $
squeal-postgresql/src/Squeal/PostgreSQL/Expression/Range.hs+27−31
@@ -38,17 +38,16 @@ module Squeal.PostgreSQL.Expression.Range
3838 , moreThan, atLeast, lessThan, atMost
3939 , singleton, whole
4040 , Bound (..)
41− , (<@.)
41+ , (.<@)
4242 , (@>.)
43− , (&&.)
44− , (<<.)
45− , (>>.)
46− , (&<.)
47− , (&>.)
48− , (=|=.)
49− , (+.)
50− , (*.)
51− , (-.)
43+ , (<<@)
44+ , (@>>)
45+ , (&<)
46+ , (&>)
47+ , (-|-)
48+ , (@+)
49+ , (@*)
50+ , (@-)
5251 , lowerBound
5352 , upperBound
5453 , isEmpty
@@ -128,38 +127,35 @@ singleton x = x <=..<= x
128127whole :: Range x
129128whole = NonEmpty Infinite Infinite
130129
131−(<@.) :: Operator ('NotNull ty) (null ('PGrange ty)) ('Null 'PGbool)
132−(<@.) = unsafeBinaryOp "<@"
130+(.<@) :: Operator ('NotNull ty) (null ('PGrange ty)) ('Null 'PGbool)
131+(.<@) = unsafeBinaryOp "<@"
133132
134133(@>.) :: Operator (null ('PGrange ty)) ('NotNull ty) ('Null 'PGbool)
135134(@>.) = unsafeBinaryOp "<@"
136135
137−(&&.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
138−(&&.) = unsafeBinaryOp "&&"
136+(<<@) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
137+(<<@) = unsafeBinaryOp "<<"
139138
140−(<<.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
141−(<<.) = unsafeBinaryOp "<<"
139+(@>>) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
140+(@>>) = unsafeBinaryOp ">>"
142141
143−(>>.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
144−(>>.) = unsafeBinaryOp ">>"
142+(&<) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
143+(&<) = unsafeBinaryOp "&<"
145144
146−(&<.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
147−(&<.) = unsafeBinaryOp "&<"
145+(&>) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
146+(&>) = unsafeBinaryOp "&>"
148147
149−(&>.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
150−(&>.) = unsafeBinaryOp "&>"
148+(-|-) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
149+(-|-) = unsafeBinaryOp "-|-"
151150
152−(=|=.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
153−(=|=.) = unsafeBinaryOp "&>"
151+(@+) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
152+(@+) = unsafeBinaryOp "+"
154153
155−(+.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
156−(+.) = unsafeBinaryOp "+"
154+(@*) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
155+(@*) = unsafeBinaryOp "*"
157156
158−(*.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
159−(*.) = unsafeBinaryOp "*"
160−
161−(-.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
162−(-.) = unsafeBinaryOp "-"
157+(@-) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
158+(@-) = unsafeBinaryOp "-"
163159
164160lowerBound :: null ('PGrange ty) :--> 'Null ty
165161lowerBound = unsafeFunction "lower"