@@ -8,7 +8,7 @@ Stability: experimental
8Squeal expressions are the atoms used to build statements.
8Squeal expressions are the atoms used to build statements.
11−{-# OPTIONS_GHC -fno-warn-redundant-constraints -fno-warn-unticked-promoted-constructors #-}
11+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
12{-# LANGUAGE
12{-# LANGUAGE
13 AllowAmbiguousTypes
13 AllowAmbiguousTypes
14 , ConstraintKinds
14 , ConstraintKinds
@@ -917,35 +917,6 @@ comments lifted directly from this page.
917Table 9.44: json and jsonb operators
917Table 9.44: json and jsonb operators
918-----------------------------------------}
918-----------------------------------------}
920−type PGjsonKey key = key `In` '[ 'PGint2, 'PGint4, 'PGtext ]
922−type PGjson_ json = json `In` '[ 'PGjson, 'PGjsonb ]
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
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)
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)
947−type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
949-- | Get JSON value (object field or array element) at a key.
920-- | Get JSON value (object field or array element) at a key.
951 :: (PGjson_ json, PGjsonKey key)
922 :: (PGjson_ json, PGjsonKey key)
@@ -964,7 +935,7 @@ type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
965-- | Get JSON value at a specified path.
936-- | Get JSON value at a specified path.
967− :: (PGjson_ json, IsPGtextArray "(.#>)" path)
938+ :: (PGjson_ json, PGtextArray "(.#>)" path)
968 => Expression schema relations grouping params (nullity json)
939 => Expression schema relations grouping params (nullity json)
969 -> Expression schema relations grouping params (nullity path)
940 -> Expression schema relations grouping params (nullity path)
970 -> Expression schema relations grouping params ('Null json)
941 -> Expression schema relations grouping params ('Null json)
@@ -972,7 +943,7 @@ type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
973-- | Get JSON value at a specified path as text.
944-- | Get JSON value at a specified path as text.
975− :: (PGjson_ json, IsPGtextArray "(.#>>)" path)
946+ :: (PGjson_ json, PGtextArray "(.#>>)" path)
976 => Expression schema relations grouping params (nullity json)
947 => Expression schema relations grouping params (nullity json)
977 -> Expression schema relations grouping params (nullity path)
948 -> Expression schema relations grouping params (nullity path)
978 -> Expression schema relations grouping params ('Null 'PGtext)
949 -> Expression schema relations grouping params ('Null 'PGtext)
@@ -1046,7 +1017,7 @@ type IsPGtextArray name arr = PGarrayOf name arr 'PGtext
1046-- | Delete the field or element with specified path (for JSON arrays, negative
1017-- | Delete the field or element with specified path (for JSON arrays, negative
1047-- integers count from the end)
1018-- integers count from the end)
1049− :: IsPGtextArray "(#-.)" arrayty
1020+ :: PGtextArray "(#-.)" arrayty
1050 => Expression schema relations grouping params (nullity 'PGjsonb)
1021 => Expression schema relations grouping params (nullity 'PGjsonb)
1051 -> Expression schema relations grouping params (nullity arrayty)
1022 -> Expression schema relations grouping params (nullity arrayty)
1052 -> Expression schema relations grouping params (nullity 'PGjsonb)
1023 -> Expression schema relations grouping params (nullity 'PGjsonb)
@@ -1110,14 +1081,6 @@ jsonbBuildArray
1110 -> Expression schema relations grouping params (nullity 'PGjsonb)
1081 -> Expression schema relations grouping params (nullity 'PGjsonb)
1111jsonbBuildArray = unsafeVariadicFunction "jsonb_build_array"
1082jsonbBuildArray = unsafeVariadicFunction "jsonb_build_array"
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))
1121-- | Builds a possibly-heterogeneously-typed JSON object out of a variadic
1084-- | Builds a possibly-heterogeneously-typed JSON object out of a variadic
1122-- argument list. The elements of the argument list must alternate between text
1085-- argument list. The elements of the argument list must alternate between text
1123-- and values.
1086-- and values.