@@ -1,6 +1,7 @@
1{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
1{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
2{-# LANGUAGE
2{-# LANGUAGE
3− DataKinds
4+ , DataKinds
4 , DeriveGeneric
5 , DeriveGeneric
5 , DeriveDataTypeable
6 , DeriveDataTypeable
6 , FlexibleContexts
7 , FlexibleContexts
@@ -269,8 +270,8 @@ refer to the out-of-line data values.
270class (PGTyped (BaseType ty), KnownNat n)
271class (PGTyped (BaseType ty), KnownNat n)
271 => HasParameter (n :: Nat) params ty | n params -> ty where
272 => HasParameter (n :: Nat) params ty | n params -> ty where
272− param :: proxy n -> Expression params tables grouping ty
273+ param :: Expression params tables grouping ty
273− param _ = UnsafeExpression $ parenthesized $
274+ param = UnsafeExpression $ parenthesized $
274 "$" <> renderNat (Proxy @n) <+> "::"
275 "$" <> renderNat (Proxy @n) <+> "::"
275 <+> renderTypeExpression (pgtype @(BaseType ty))
276 <+> renderTypeExpression (pgtype @(BaseType ty))
276instance {-# OVERLAPPING #-} PGTyped (BaseType ty1)
277instance {-# OVERLAPPING #-} PGTyped (BaseType ty1)
@@ -1099,22 +1100,22 @@ bigserial = UnsafeTypeExpression "bigserial"
1099text :: TypeExpression ('Required ('Null 'PGtext))
1100text :: TypeExpression ('Required ('Null 'PGtext))
1100text = UnsafeTypeExpression "text"
1101text = UnsafeTypeExpression "text"
1102− :: KnownNat n
1103+ :: (KnownNat n, 1 <= n)
1103 => proxy n
1104 => proxy n
1104 -> TypeExpression ('Required ('Null ('PGchar n)))
1105 -> TypeExpression ('Required ('Null ('PGchar n)))
1105char p = UnsafeTypeExpression $ "char(" <> renderNat p <> ")"
1106char p = UnsafeTypeExpression $ "char(" <> renderNat p <> ")"
1106character
1107character
1107− :: KnownNat n
1108+ :: (KnownNat n, 1 <= n)
1108 => proxy n
1109 => proxy n
1109 -> TypeExpression ('Required ('Null ('PGchar n)))
1110 -> TypeExpression ('Required ('Null ('PGchar n)))
1110character p = UnsafeTypeExpression $ "character(" <> renderNat p <> ")"
1111character p = UnsafeTypeExpression $ "character(" <> renderNat p <> ")"
1112− :: KnownNat n
1113+ :: (KnownNat n, 1 <= n)
1113 => proxy n
1114 => proxy n
1114 -> TypeExpression ('Required ('Null ('PGvarchar n)))
1115 -> TypeExpression ('Required ('Null ('PGvarchar n)))
1115varchar p = UnsafeTypeExpression $ "varchar(" <> renderNat p <> ")"
1116varchar p = UnsafeTypeExpression $ "varchar(" <> renderNat p <> ")"
1116characterVarying
1117characterVarying
1117− :: KnownNat n
1118+ :: (KnownNat n, 1 <= n)
1118 => proxy n
1119 => proxy n
1119 -> TypeExpression ('Required ('Null ('PGvarchar n)))
1120 -> TypeExpression ('Required ('Null ('PGvarchar n)))
1120characterVarying p = UnsafeTypeExpression $
1121characterVarying p = UnsafeTypeExpression $
@@ -1161,8 +1162,10 @@ instance PGTyped 'PGnumeric where pgtype = numeric
1161instance PGTyped 'PGfloat4 where pgtype = float4
1162instance PGTyped 'PGfloat4 where pgtype = float4
1162instance PGTyped 'PGfloat8 where pgtype = float8
1163instance PGTyped 'PGfloat8 where pgtype = float8
1163instance PGTyped 'PGtext where pgtype = text
1164instance PGTyped 'PGtext where pgtype = text
1165+instance (KnownNat n, 1 <= n)
1164−instance KnownNat n => PGTyped ('PGchar n) where pgtype = char (Proxy @n)
1166+ => PGTyped ('PGchar n) where pgtype = char (Proxy @n)
1167+instance (KnownNat n, 1 <= n)
1165−instance KnownNat n => PGTyped ('PGvarchar n) where pgtype = varchar (Proxy @n)
1168+ => PGTyped ('PGvarchar n) where pgtype = varchar (Proxy @n)
1166instance PGTyped 'PGbytea where pgtype = bytea
1169instance PGTyped 'PGbytea where pgtype = bytea
1167instance PGTyped 'PGtimestamp where pgtype = timestamp
1170instance PGTyped 'PGtimestamp where pgtype = timestamp
1168instance PGTyped 'PGtimestamptz where pgtype = timestampWithTimeZone
1171instance PGTyped 'PGtimestamptz where pgtype = timestampWithTimeZone