morphismtech / squeal

Squeal, a deep embedding of SQL in Haskell
352 stars 32 forks source link

Relax some type nullities #315

Closed echatav closed 2 years ago

echatav commented 2 years ago

@Sciencei

why does @>. require the rhs be non-null? postgres doesn’t seem to have this same constraint test=# select '[1,2]'::int4range @> null; -[ RECORD 1 ] ?column? |

We should relax the nullities of these terms' type signatures as follows:

(.<@) :: Operator (null0 ty) (null1 ('PGrange ty)) ('Null 'PGbool)

(@>.) :: Operator (null0 ('PGrange ty)) (null1 ty) ('Null 'PGbool)

arrAll
  :: Expression grp lat with db params from ty1 -- ^ expression
  -> Operator ty1 ty2 ('Null 'PGbool) -- ^ operator
  -> Expression grp lat with db params from (null ('PGvararray ty2)) -- ^ array
  -> Condition grp lat with db params from

arrAny
  :: Expression grp lat with db params from ty1 -- ^ expression
  -> Operator ty1 ty2 ('Null 'PGbool) -- ^ operator
  -> Expression grp lat with db params from (null ('PGvararray ty2)) -- ^ array
  -> Condition grp lat with db params from