@@ -8,7 +8,7 @@ Stability: experimental
88Squeal expressions are the atoms used to build statements.
99-}
1010
11−{-# OPTIONS_GHC -fno-warn-redundant-constraints -fno-warn-unticked-promoted-constructors #-}
11+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
1212{-# LANGUAGE
1313 AllowAmbiguousTypes
1414 , ConstraintKinds
@@ -917,35 +917,6 @@ comments lifted directly from this page.
917917Table 9.44: json and jsonb operators
918918-----------------------------------------}
919919
920−type PGjsonKey key = key `In` '[ 'PGint2, 'PGint4, 'PGtext ]
921−
922−type PGjson_ json = json `In` '[ 'PGjson, 'PGjsonb ]
923−
924−type Placeholder k = 'Text "(_::" :<>: 'ShowType k :<>: 'Text ")"
925−type ErrArrayOf arr ty = arr :<>: 'Text " " :<>: ty
926−type ErrPGfixarrayOf t = ErrArrayOf ('ShowType 'PGfixarray :<>: 'Text " " :<>: Placeholder Nat) t
927−type ErrPGvararrayOf t = ErrArrayOf ('ShowType 'PGvararray) t
928−
929−type family PGarray name arr :: Constraint where
930− PGarray name ('PGvararray x) = ()
931− PGarray name ('PGfixarray n x) = ()
932− PGarray name val = TypeError
933− ('Text name :<>: 'Text ": Unsatisfied PGarrayOf constraint. Expected either: "
934− :$$: 'Text " • " :<>: ErrPGvararrayOf (Placeholder PGType)
935− :$$: 'Text " • " :<>: ErrPGfixarrayOf (Placeholder PGType)
936− :$$: 'Text "But got: " :<>: 'ShowType val)
937−
938−type family PGarrayOf name arr ty :: Constraint where
939− PGarrayOf name ('PGvararray x) ty = x ~ ty
940− PGarrayOf name ('PGfixarray n x) ty = x ~ ty
941− PGarrayOf name val ty = TypeError
942− ( 'Text name :<>: 'Text "Unsatisfied PGarrayOf constraint. Expected either: "
943− :$$: 'Text " • " :<>: ErrPGvararrayOf ( 'ShowType ty )
944− :$$: 'Text " • " :<>: ErrPGfixarrayOf ( 'ShowType ty )
945− :$$: 'Text "But got: " :<>: 'ShowType val)
946−
947−type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
948−
949920-- | Get JSON value (object field or array element) at a key.
950921(.->)
951922 :: (PGjson_ json, PGjsonKey key)
@@ -964,7 +935,7 @@ type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
964935
965936-- | Get JSON value at a specified path.
966937(.#>)
967− :: (PGjson_ json, IsPGtextArray "(.#>)" path)
938+ :: (PGjson_ json, PGtextArray "(.#>)" path)
968939 => Expression schema relations grouping params (nullity json)
969940 -> Expression schema relations grouping params (nullity path)
970941 -> Expression schema relations grouping params ('Null json)
@@ -972,7 +943,7 @@ type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
972943
973944-- | Get JSON value at a specified path as text.
974945(.#>>)
975− :: (PGjson_ json, IsPGtextArray "(.#>>)" path)
946+ :: (PGjson_ json, PGtextArray "(.#>>)" path)
976947 => Expression schema relations grouping params (nullity json)
977948 -> Expression schema relations grouping params (nullity path)
978949 -> Expression schema relations grouping params ('Null 'PGtext)
@@ -1046,7 +1017,7 @@ type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
10461017-- | Delete the field or element with specified path (for JSON arrays, negative
10471018-- integers count from the end)
10481019(#-.)
1049− :: IsPGtextArray "(#-.)" arrayty
1020+ :: PGtextArray "(#-.)" arrayty
10501021 => Expression schema relations grouping params (nullity 'PGjsonb)
10511022 -> Expression schema relations grouping params (nullity arrayty)
10521023 -> Expression schema relations grouping params (nullity 'PGjsonb)
@@ -1110,14 +1081,6 @@ jsonbBuildArray
11101081 -> Expression schema relations grouping params (nullity 'PGjsonb)
11111082jsonbBuildArray = unsafeVariadicFunction "jsonb_build_array"
11121083
1113−type family PGobjectpairs name x :: Constraint where
1114− PGobjectpairs name ('NotNull 'PGtext : nullity arg : xs) = PGobjectpairs name xs
1115− PGobjectpairs name '[] = ()
1116− PGobjectpairs name (x:xs) = TypeError
1117− ( 'Text name :<>: 'Text ": Incorrect argument list:"
1118− :$$: 'Text "Expected alternating list of keys and values."
1119− :$$: 'Text "But got " :<>: 'ShowType (x:xs))
1120−
11211084-- | Builds a possibly-heterogeneously-typed JSON object out of a variadic
11221085-- argument list. The elements of the argument list must alternate between text
11231086-- and values.