@@ -54,8 +54,8 @@ module Squeal.PostgreSQL.Definition
5454 , createSetFunction
5555 , createOrReplaceSetFunction
5656 , createBinaryOp
57− , createUnaryOpL
58− , createUnaryOpR
57+ , createLeftOp
58+ , createRightOp
5959 , TableConstraintExpression (..)
6060 , check
6161 , unique
@@ -1220,17 +1220,17 @@ createOrReplaceSetFunction fun args rets fundef = UnsafeDefinition $
12201220 renderRet (ty `As` col) = renderSQL col <+> renderSQL ty
12211221
12221222createBinaryOp
1223− :: ( Has sch schemas schema
1223+ :: forall op fun sch schemas schema x y z.
1224+ ( Has sch schemas schema
12241225 , Has fun schema ('Function '[x,y] ('Returns z))
12251226 , KnownSymbol op )
1226− => Alias op
1227− -> Alias fun
1227+ => Alias fun
12281228 -> TypeExpression schemas x
12291229 -> TypeExpression schemas y
12301230 -> Definition schemas
12311231 (Alter sch (Create op ('Operator ('BinaryOp x y z)) schema) schemas)
1232−createBinaryOp op fun x y = UnsafeDefinition $
1233− "CREATE" <+> "OPERATOR" <+> renderSQL op
1232+createBinaryOp fun x y = UnsafeDefinition $
1233+ "CREATE" <+> "OPERATOR" <+> renderSymbol @op
12341234 <+> parenthesized (commaSeparated opdef)
12351235 where
12361236 opdef =
@@ -1238,34 +1238,34 @@ createBinaryOp op fun x y = UnsafeDefinition $
12381238 , "LEFTARG" <+> "=" <+> renderSQL x
12391239 , "RIGHTARG" <+> "=" <+> renderSQL y ]
12401240
1241−createUnaryOpL
1242− :: ( Has sch schemas schema
1241+createLeftOp
1242+ :: forall op fun sch schemas schema x y.
1243+ ( Has sch schemas schema
12431244 , Has fun schema ('Function '[x] ('Returns y))
12441245 , KnownSymbol op )
1245− => Alias op
1246− -> Alias fun
1246+ => Alias fun
12471247 -> TypeExpression schemas x
12481248 -> Definition schemas
1249− (Alter sch (Create op ('Operator ('UnaryOpL x y)) schema) schemas)
1250−createUnaryOpL op fun x = UnsafeDefinition $
1251− "CREATE" <+> "OPERATOR" <+> renderSQL op
1249+ (Alter sch (Create op ('Operator ('LeftOp x y)) schema) schemas)
1250+createLeftOp fun x = UnsafeDefinition $
1251+ "CREATE" <+> "OPERATOR" <+> renderSymbol @op
12521252 <+> parenthesized (commaSeparated opdef)
12531253 where
12541254 opdef =
12551255 [ "FUNCTION" <+> "=" <+> renderSQL fun
12561256 , "RIGHTARG" <+> "=" <+> renderSQL x ]
12571257
1258−createUnaryOpR
1259− :: ( Has sch schemas schema
1258+createRightOp
1259+ :: forall op fun sch schemas schema x y.
1260+ ( Has sch schemas schema
12601261 , Has fun schema ('Function '[x] ('Returns y))
12611262 , KnownSymbol op )
1262− => Alias op
1263− -> Alias fun
1263+ => Alias fun
12641264 -> TypeExpression schemas x
12651265 -> Definition schemas
1266− (Alter sch (Create op ('Operator ('UnaryOpR x y)) schema) schemas)
1267−createUnaryOpR op fun x = UnsafeDefinition $
1268− "CREATE" <+> "OPERATOR" <+> renderSQL op
1266+ (Alter sch (Create op ('Operator ('RightOp x y)) schema) schemas)
1267+createRightOp fun x = UnsafeDefinition $
1268+ "CREATE" <+> "OPERATOR" <+> renderSymbol @op
12691269 <+> parenthesized (commaSeparated opdef)
12701270 where
12711271 opdef =