@@ -1,6 +1,7 @@
11{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
22{-# LANGUAGE
3− DataKinds
3+ AllowAmbiguousTypes
4+ , DataKinds
45 , DeriveGeneric
56 , DeriveDataTypeable
67 , FlexibleContexts
@@ -269,8 +270,8 @@ refer to the out-of-line data values.
269270-}
270271class (PGTyped (BaseType ty), KnownNat n)
271272 => HasParameter (n :: Nat) params ty | n params -> ty where
272− param :: proxy n -> Expression params tables grouping ty
273− param _ = UnsafeExpression $ parenthesized $
273+ param :: Expression params tables grouping ty
274+ param = UnsafeExpression $ parenthesized $
274275 "$" <> renderNat (Proxy @n) <+> "::"
275276 <+> renderTypeExpression (pgtype @(BaseType ty))
276277instance {-# OVERLAPPING #-} PGTyped (BaseType ty1)
@@ -1099,22 +1100,22 @@ bigserial = UnsafeTypeExpression "bigserial"
10991100text :: TypeExpression ('Required ('Null 'PGtext))
11001101text = UnsafeTypeExpression "text"
11011102char
1102− :: KnownNat n
1103+ :: (KnownNat n, 1 <= n)
11031104 => proxy n
11041105 -> TypeExpression ('Required ('Null ('PGchar n)))
11051106char p = UnsafeTypeExpression $ "char(" <> renderNat p <> ")"
11061107character
1107− :: KnownNat n
1108+ :: (KnownNat n, 1 <= n)
11081109 => proxy n
11091110 -> TypeExpression ('Required ('Null ('PGchar n)))
11101111character p = UnsafeTypeExpression $ "character(" <> renderNat p <> ")"
11111112varchar
1112− :: KnownNat n
1113+ :: (KnownNat n, 1 <= n)
11131114 => proxy n
11141115 -> TypeExpression ('Required ('Null ('PGvarchar n)))
11151116varchar p = UnsafeTypeExpression $ "varchar(" <> renderNat p <> ")"
11161117characterVarying
1117− :: KnownNat n
1118+ :: (KnownNat n, 1 <= n)
11181119 => proxy n
11191120 -> TypeExpression ('Required ('Null ('PGvarchar n)))
11201121characterVarying p = UnsafeTypeExpression $
@@ -1161,8 +1162,10 @@ instance PGTyped 'PGnumeric where pgtype = numeric
11611162instance PGTyped 'PGfloat4 where pgtype = float4
11621163instance PGTyped 'PGfloat8 where pgtype = float8
11631164instance PGTyped 'PGtext where pgtype = text
1164−instance KnownNat n => PGTyped ('PGchar n) where pgtype = char (Proxy @n)
1165−instance KnownNat n => PGTyped ('PGvarchar n) where pgtype = varchar (Proxy @n)
1165+instance (KnownNat n, 1 <= n)
1166+ => PGTyped ('PGchar n) where pgtype = char (Proxy @n)
1167+instance (KnownNat n, 1 <= n)
1168+ => PGTyped ('PGvarchar n) where pgtype = varchar (Proxy @n)
11661169instance PGTyped 'PGbytea where pgtype = bytea
11671170instance PGTyped 'PGtimestamp where pgtype = timestamp
11681171instance PGTyped 'PGtimestamptz where pgtype = timestampWithTimeZone