@@ -1,5 +1,6 @@
11{-# LANGUAGE
22 DataKinds
3+ , FlexibleContexts
34 , FlexibleInstances
45 , GADTs
56 , MultiParamTypeClasses
@@ -44,14 +45,15 @@ param5 = UnsafeExpression "$5"
4445
4546class HasField ident xs x where
4647 fieldName :: Proxy ident -> Proxy xs -> Proxy x -> ByteString
47−instance KnownSymbol name => HasField '[name] ((name ':= x) ': xs) x where
48− fieldName _ _ _ = Char8.pack (symbolVal (Proxy @name))
49−instance HasField ident xs x => HasField ident (y ': xs) x where
50− fieldName _ _ _ = fieldName (Proxy @ident) (Proxy @xs) (Proxy @x)
51−instance (KnownSymbol name, HasField names xs x)
52− => HasField (name ': names) ((name ':= xs) ': xss) x where
48+instance KnownSymbol name
49+ => HasField '[name] ((name ':= x) ': xs) x where
5350 fieldName _ _ _ = Char8.pack (symbolVal (Proxy @name))
54− <> "." <> fieldName (Proxy @names) (Proxy @xs) (Proxy @x)
51+instance HasField ident (x ': xs) y => HasField ident (x' ': x ': xs) y where
52+ fieldName _ _ _ = fieldName (Proxy @ident) (Proxy @(x ': xs)) (Proxy @y)
53+instance (KnownSymbol name, HasField (name' ': names) xs x)
54+ => HasField (name ': name' ': names) ((name ':= xs) ': xss) x where
55+ fieldName _ _ _ = Char8.pack (symbolVal (Proxy @name))
56+ <> "." <> fieldName (Proxy @(name' ': names)) (Proxy @xs) (Proxy @x)
5557
5658column_
5759 :: forall ident xs x ps
@@ -69,9 +71,9 @@ unalias (AS obj) = obj
6971
7072column
7173 :: forall ident xs x ps
72− . HasField ident xs x
74+ . HasField '[ident] xs x
7375 => Aliased (Expression ps xs) (ident ':= x)
74−column = AS $ column_ (Proxy @ident)
76+column = AS $ column_ (Proxy @'[ident])
7577
7678renderAliased
7779 :: KnownSymbol name
@@ -90,10 +92,10 @@ instance KnownSymbol name => AllAliased '[name ':= x] where
9092 renderAllAliased render
9193 (aliased :& RNil :: Rec (Aliased obj) '[name ':= x]) =
9294 renderAliased render aliased
93−instance (KnownSymbol name, AllAliased xs)
94− => AllAliased ((name ':= x) ': xs) where
95+instance (KnownSymbol name, AllAliased (x' ': xs))
96+ => AllAliased ((name ':= x) ': (x' ': xs)) where
9597 renderAllAliased render
96− (x :& xs :: Rec (Aliased obj) ((name ':= x) ': xs)) =
98+ (x :& xs :: Rec (Aliased obj) ((name ':= x) ': (x' : xs))) =
9799 renderAliased render x <> ", " <> renderAllAliased render xs
98100
99101instance IsString (Expression ps xs 'PGText) where