@@ -39,6 +39,25 @@ module Squeal.PostgreSQL.Expression.Range
39 , singleton, whole
39 , singleton, whole
40 , Bound (..)
40 , Bound (..)
41 , closed, open
41 , closed, open
44import Data.Bool
63import Data.Bool
@@ -112,3 +131,61 @@ singleton x = x <=..<= x
113whole :: Range x
132whole :: Range x
114whole = NonEmpty (open Nothing) (open Nothing)
133whole = NonEmpty (open Nothing) (open Nothing)
135+(<@.) :: Operator ('NotNull ty) (null ('PGrange ty)) ('Null 'PGbool)
136+(<@.) = unsafeBinaryOp "<@"
138+(@>.) :: Operator (null ('PGrange ty)) ('NotNull ty) ('Null 'PGbool)
139+(@>.) = unsafeBinaryOp "<@"
141+(&&.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
142+(&&.) = unsafeBinaryOp "&&"
144+(<<.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
145+(<<.) = unsafeBinaryOp "<<"
147+(>>.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
148+(>>.) = unsafeBinaryOp ">>"
150+(&<.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
151+(&<.) = unsafeBinaryOp "&<"
153+(&>.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
154+(&>.) = unsafeBinaryOp "&>"
156+(=|=.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) ('Null 'PGbool)
157+(=|=.) = unsafeBinaryOp "&>"
159+(+.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
160+(+.) = unsafeBinaryOp "+"
162+(*.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
163+(*.) = unsafeBinaryOp "*"
165+(-.) :: Operator (null ('PGrange ty)) (null ('PGrange ty)) (null ('PGrange ty))
166+(-.) = unsafeBinaryOp "-"
168+lowerBound :: null ('PGrange ty) :--> null ty
169+lowerBound = unsafeFunction "lower"
171+upperBound :: null ('PGrange ty) :--> null ty
172+upperBound = unsafeFunction "upper"
174+isEmpty :: null ('PGrange ty) :--> 'Null 'PGbool
175+isEmpty = unsafeFunction "isempty"
177+lowerInc :: null ('PGrange ty) :--> 'Null 'PGbool
178+lowerInc = unsafeFunction "lower_inc"
180+lowerInf :: null ('PGrange ty) :--> 'Null 'PGbool
181+lowerInf = unsafeFunction "lower_inf"
183+upperInc :: null ('PGrange ty) :--> 'Null 'PGbool
184+upperInc = unsafeFunction "upper_inc"
186+upperInf :: null ('PGrange ty) :--> 'Null 'PGbool
187+upperInf = unsafeFunction "upper_inf"
189+rangeMerge :: FunctionN
190+ '[ null ('PGrange ty), null ('PGrange ty)] (null ('PGrange ty))
191+rangeMerge = unsafeFunctionN "range_merge"