@@ -122,144 +122,148 @@ type family Elem (a :: *) (ls::[*]) :: Constraint where
122122 Elem a (a ': list) = ()
123123 Elem a (b ': list) = Elem a list
124124
125−class HasForeignType a where
126− typeFor :: Proxy a -> ForeignType
125+class HasForeignType lang a where
126+ typeFor :: Proxy lang -> Proxy a -> ForeignType
127127
128−class HasForeign (layout :: *) where
128+class HasForeign lang (layout :: *) where
129129 type Foreign layout :: *
130− foreignFor :: Proxy layout -> Req -> Foreign layout
130+ foreignFor :: Proxy lang -> Proxy layout -> Req -> Foreign layout
131131
132−instance (HasForeign a, HasForeign b)
133− => HasForeign (a :<|> b) where
132+instance (HasForeign lang a, HasForeign lang b)
133+ => HasForeign lang (a :<|> b) where
134134 type Foreign (a :<|> b) = Foreign a :<|> Foreign b
135135
136− foreignFor Proxy req =
137− foreignFor (Proxy :: Proxy a) req
138− :<|> foreignFor (Proxy :: Proxy b) req
136+ foreignFor lang Proxy req =
137+ foreignFor lang (Proxy :: Proxy a) req
138+ :<|> foreignFor lang (Proxy :: Proxy b) req
139139
140−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
141− => HasForeign (Capture sym a :> sublayout) where
140+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
141+ => HasForeign lang (Capture sym a :> sublayout) where
142142 type Foreign (Capture sym a :> sublayout) = Foreign sublayout
143143
144− foreignFor Proxy req =
145− foreignFor (Proxy :: Proxy sublayout) $
144+ foreignFor lang Proxy req =
145+ foreignFor lang (Proxy :: Proxy sublayout) $
146146 req & reqUrl.path <>~ [Segment (Cap arg)]
147147 & funcName %~ (++ ["by", str])
148148
149149 where
150150 str = pack . symbolVal $ (Proxy :: Proxy sym)
151− arg = (str, typeFor (Proxy :: Proxy a))
151+ arg = (str, typeFor lang (Proxy :: Proxy a))
152152
153−instance (Elem JSON list, HasForeignType a) => HasForeign (Delete list a) where
153+instance (Elem JSON list, HasForeignType lang a)
154+ => HasForeign lang (Delete list a) where
154155 type Foreign (Delete list a) = Req
155156
156− foreignFor Proxy req =
157+ foreignFor lang Proxy req =
157158 req & funcName %~ ("delete" :)
158159 & reqMethod .~ "DELETE"
159160 & reqReturnType .~ retType
160161 where
161− retType = typeFor (Proxy :: Proxy a)
162+ retType = typeFor lang (Proxy :: Proxy a)
162163
163−instance (Elem JSON list, HasForeignType a) => HasForeign (Get list a) where
164+instance (Elem JSON list, HasForeignType lang a)
165+ => HasForeign lang (Get list a) where
164166 type Foreign (Get list a) = Req
165167
166− foreignFor Proxy req =
168+ foreignFor lang Proxy req =
167169 req & funcName %~ ("get" :)
168170 & reqMethod .~ "GET"
169171 & reqReturnType .~ retType
170172 where
171− retType = typeFor (Proxy :: Proxy a)
173+ retType = typeFor lang (Proxy :: Proxy a)
172174
173−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
174− => HasForeign (Header sym a :> sublayout) where
175+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
176+ => HasForeign lang (Header sym a :> sublayout) where
175177 type Foreign (Header sym a :> sublayout) = Foreign sublayout
176178
177− foreignFor Proxy req =
178− foreignFor subP $ req
179+ foreignFor lang Proxy req =
180+ foreignFor lang subP $ req
179181 & reqHeaders <>~ [HeaderArg arg]
180182
181183 where
182184 hname = pack . symbolVal $ (Proxy :: Proxy sym)
183− arg = (hname, typeFor (Proxy :: Proxy a))
185+ arg = (hname, typeFor lang (Proxy :: Proxy a))
184186 subP = Proxy :: Proxy sublayout
185187
186−instance (Elem JSON list, HasForeignType a) => HasForeign (Post list a) where
188+instance (Elem JSON list, HasForeignType lang a)
189+ => HasForeign lang (Post list a) where
187190 type Foreign (Post list a) = Req
188191
189− foreignFor Proxy req =
192+ foreignFor lang Proxy req =
190193 req & funcName %~ ("post" :)
191194 & reqMethod .~ "POST"
192195 & reqReturnType .~ retType
193196 where
194− retType = typeFor (Proxy :: Proxy a)
197+ retType = typeFor lang (Proxy :: Proxy a)
195198
196−instance (Elem JSON list, HasForeignType a) => HasForeign (Put list a) where
199+instance (Elem JSON list, HasForeignType lang a)
200+ => HasForeign lang (Put list a) where
197201 type Foreign (Put list a) = Req
198202
199− foreignFor Proxy req =
203+ foreignFor lang Proxy req =
200204 req & funcName %~ ("put" :)
201205 & reqMethod .~ "PUT"
202206 & reqReturnType .~ retType
203207 where
204− retType = typeFor (Proxy :: Proxy a)
208+ retType = typeFor lang (Proxy :: Proxy a)
205209
206−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
207− => HasForeign (QueryParam sym a :> sublayout) where
210+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
211+ => HasForeign lang (QueryParam sym a :> sublayout) where
208212 type Foreign (QueryParam sym a :> sublayout) = Foreign sublayout
209213
210− foreignFor Proxy req =
211− foreignFor (Proxy :: Proxy sublayout) $
214+ foreignFor lang Proxy req =
215+ foreignFor lang (Proxy :: Proxy sublayout) $
212216 req & reqUrl.queryStr <>~ [QueryArg arg Normal]
213217
214218 where
215219 str = pack . symbolVal $ (Proxy :: Proxy sym)
216− arg = (str, typeFor (Proxy :: Proxy a))
220+ arg = (str, typeFor lang (Proxy :: Proxy a))
217221
218−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
219− => HasForeign (QueryParams sym a :> sublayout) where
222+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
223+ => HasForeign lang (QueryParams sym a :> sublayout) where
220224 type Foreign (QueryParams sym a :> sublayout) = Foreign sublayout
221225
222− foreignFor Proxy req =
223− foreignFor (Proxy :: Proxy sublayout) $
226+ foreignFor lang Proxy req =
227+ foreignFor lang (Proxy :: Proxy sublayout) $
224228 req & reqUrl.queryStr <>~ [QueryArg arg List]
225229
226230 where
227231 str = pack . symbolVal $ (Proxy :: Proxy sym)
228− arg = (str, typeFor (Proxy :: Proxy a))
232+ arg = (str, typeFor lang (Proxy :: Proxy a))
229233
230−instance (KnownSymbol sym, HasForeignType a, a ~ Bool, HasForeign sublayout)
231− => HasForeign (QueryFlag sym :> sublayout) where
234+instance (KnownSymbol sym, HasForeignType lang a, a ~ Bool, HasForeign lang sublayout)
235+ => HasForeign lang (QueryFlag sym :> sublayout) where
232236 type Foreign (QueryFlag sym :> sublayout) = Foreign sublayout
233237
234− foreignFor Proxy req =
235− foreignFor (Proxy :: Proxy sublayout) $
238+ foreignFor lang Proxy req =
239+ foreignFor lang (Proxy :: Proxy sublayout) $
236240 req & reqUrl.queryStr <>~ [QueryArg arg Flag]
237241
238242 where
239243 str = pack . symbolVal $ (Proxy :: Proxy sym)
240− arg = (str, typeFor (Proxy :: Proxy a))
244+ arg = (str, typeFor lang (Proxy :: Proxy a))
241245
242−instance HasForeign Raw where
246+instance HasForeign lang Raw where
243247 type Foreign Raw = Method -> Req
244248
245− foreignFor Proxy req method =
249+ foreignFor _ Proxy req method =
246250 req & funcName %~ ((toLower method) :)
247251 & reqMethod .~ method
248252
249−instance (Elem JSON list, HasForeignType a, HasForeign sublayout)
250− => HasForeign (ReqBody list a :> sublayout) where
253+instance (Elem JSON list, HasForeignType lang a, HasForeign lang sublayout)
254+ => HasForeign lang (ReqBody list a :> sublayout) where
251255 type Foreign (ReqBody list a :> sublayout) = Foreign sublayout
252256
253− foreignFor Proxy req =
254− foreignFor (Proxy :: Proxy sublayout) $
255− req & reqBody .~ (Just $ typeFor (Proxy :: Proxy a))
257+ foreignFor lang Proxy req =
258+ foreignFor lang (Proxy :: Proxy sublayout) $
259+ req & reqBody .~ (Just $ typeFor lang (Proxy :: Proxy a))
256260
257−instance (KnownSymbol path, HasForeign sublayout)
258− => HasForeign (path :> sublayout) where
261+instance (KnownSymbol path, HasForeign lang sublayout)
262+ => HasForeign lang (path :> sublayout) where
259263 type Foreign (path :> sublayout) = Foreign sublayout
260264
261− foreignFor Proxy req =
262− foreignFor (Proxy :: Proxy sublayout) $
265+ foreignFor lang Proxy req =
266+ foreignFor lang (Proxy :: Proxy sublayout) $
263267 req & reqUrl.path <>~ [Segment (Static str)]
264268 & funcName %~ (++ [str])
265269
@@ -267,26 +271,26 @@ instance (KnownSymbol path, HasForeign sublayout)
267271 str = Data.Text.map (\c -> if c == '.' then '_' else c)
268272 . pack . symbolVal $ (Proxy :: Proxy path)
269273
270−instance HasForeign sublayout => HasForeign (RemoteHost :> sublayout) where
274+instance HasForeign lang sublayout => HasForeign lang (RemoteHost :> sublayout) where
271275 type Foreign (RemoteHost :> sublayout) = Foreign sublayout
272276
273− foreignFor Proxy req =
274− foreignFor (Proxy :: Proxy sublayout) req
277+ foreignFor lang Proxy req =
278+ foreignFor lang (Proxy :: Proxy sublayout) req
275279
276−instance HasForeign sublayout => HasForeign (IsSecure :> sublayout) where
280+instance HasForeign lang sublayout => HasForeign lang (IsSecure :> sublayout) where
277281 type Foreign (IsSecure :> sublayout) = Foreign sublayout
278282
279− foreignFor Proxy req =
280− foreignFor (Proxy :: Proxy sublayout) req
283+ foreignFor lang Proxy req =
284+ foreignFor lang (Proxy :: Proxy sublayout) req
281285
282−instance HasForeign sublayout => HasForeign (Vault :> sublayout) where
286+instance HasForeign lang sublayout => HasForeign lang (Vault :> sublayout) where
283287 type Foreign (Vault :> sublayout) = Foreign sublayout
284288
285− foreignFor Proxy req =
286− foreignFor (Proxy :: Proxy sublayout) req
289+ foreignFor lang Proxy req =
290+ foreignFor lang (Proxy :: Proxy sublayout) req
287291
288−instance HasForeign sublayout => HasForeign (HttpVersion :> sublayout) where
292+instance HasForeign lang sublayout => HasForeign lang (HttpVersion :> sublayout) where
289293 type Foreign (HttpVersion :> sublayout) = Foreign sublayout
290294
291− foreignFor Proxy req =
292− foreignFor (Proxy :: Proxy sublayout) req
295+ foreignFor lang Proxy req =
296+ foreignFor lang (Proxy :: Proxy sublayout) req