@@ -122,144 +122,148 @@ type family Elem (a :: *) (ls::[*]) :: Constraint where
122 Elem a (a ': list) = ()
122 Elem a (a ': list) = ()
123 Elem a (b ': list) = Elem a list
123 Elem a (b ': list) = Elem a list
125−class HasForeignType a where
125+class HasForeignType lang a where
126− typeFor :: Proxy a -> ForeignType
126+ typeFor :: Proxy lang -> Proxy a -> ForeignType
128−class HasForeign (layout :: *) where
128+class HasForeign lang (layout :: *) where
129 type Foreign layout :: *
129 type Foreign layout :: *
130− foreignFor :: Proxy layout -> Req -> Foreign layout
130+ foreignFor :: Proxy lang -> Proxy layout -> Req -> Foreign layout
132−instance (HasForeign a, HasForeign b)
132+instance (HasForeign lang a, HasForeign lang b)
133− => HasForeign (a :<|> b) where
133+ => HasForeign lang (a :<|> b) where
134 type Foreign (a :<|> b) = Foreign a :<|> Foreign b
134 type Foreign (a :<|> b) = Foreign a :<|> Foreign b
136− foreignFor Proxy req =
136+ foreignFor lang Proxy req =
137− foreignFor (Proxy :: Proxy a) req
137+ foreignFor lang (Proxy :: Proxy a) req
138− :<|> foreignFor (Proxy :: Proxy b) req
138+ :<|> foreignFor lang (Proxy :: Proxy b) req
140−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
140+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
141− => HasForeign (Capture sym a :> sublayout) where
141+ => HasForeign lang (Capture sym a :> sublayout) where
142 type Foreign (Capture sym a :> sublayout) = Foreign sublayout
142 type Foreign (Capture sym a :> sublayout) = Foreign sublayout
144− foreignFor Proxy req =
144+ foreignFor lang Proxy req =
145− foreignFor (Proxy :: Proxy sublayout) $
145+ foreignFor lang (Proxy :: Proxy sublayout) $
146 req & reqUrl.path <>~ [Segment (Cap arg)]
146 req & reqUrl.path <>~ [Segment (Cap arg)]
147 & funcName %~ (++ ["by", str])
147 & funcName %~ (++ ["by", str])
150 str = pack . symbolVal $ (Proxy :: Proxy sym)
150 str = pack . symbolVal $ (Proxy :: Proxy sym)
151− arg = (str, typeFor (Proxy :: Proxy a))
151+ arg = (str, typeFor lang (Proxy :: Proxy a))
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
154 type Foreign (Delete list a) = Req
155 type Foreign (Delete list a) = Req
156− foreignFor Proxy req =
157+ foreignFor lang Proxy req =
157 req & funcName %~ ("delete" :)
158 req & funcName %~ ("delete" :)
158 & reqMethod .~ "DELETE"
159 & reqMethod .~ "DELETE"
159 & reqReturnType .~ retType
160 & reqReturnType .~ retType
161− retType = typeFor (Proxy :: Proxy a)
162+ retType = typeFor lang (Proxy :: Proxy a)
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
164 type Foreign (Get list a) = Req
166 type Foreign (Get list a) = Req
166− foreignFor Proxy req =
168+ foreignFor lang Proxy req =
167 req & funcName %~ ("get" :)
169 req & funcName %~ ("get" :)
168 & reqMethod .~ "GET"
170 & reqMethod .~ "GET"
169 & reqReturnType .~ retType
171 & reqReturnType .~ retType
171− retType = typeFor (Proxy :: Proxy a)
173+ retType = typeFor lang (Proxy :: Proxy a)
173−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
175+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
174− => HasForeign (Header sym a :> sublayout) where
176+ => HasForeign lang (Header sym a :> sublayout) where
175 type Foreign (Header sym a :> sublayout) = Foreign sublayout
177 type Foreign (Header sym a :> sublayout) = Foreign sublayout
177− foreignFor Proxy req =
179+ foreignFor lang Proxy req =
178− foreignFor subP $ req
180+ foreignFor lang subP $ req
179 & reqHeaders <>~ [HeaderArg arg]
181 & reqHeaders <>~ [HeaderArg arg]
182 hname = pack . symbolVal $ (Proxy :: Proxy sym)
184 hname = pack . symbolVal $ (Proxy :: Proxy sym)
183− arg = (hname, typeFor (Proxy :: Proxy a))
185+ arg = (hname, typeFor lang (Proxy :: Proxy a))
184 subP = Proxy :: Proxy sublayout
186 subP = Proxy :: Proxy sublayout
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
187 type Foreign (Post list a) = Req
190 type Foreign (Post list a) = Req
189− foreignFor Proxy req =
192+ foreignFor lang Proxy req =
190 req & funcName %~ ("post" :)
193 req & funcName %~ ("post" :)
191 & reqMethod .~ "POST"
194 & reqMethod .~ "POST"
192 & reqReturnType .~ retType
195 & reqReturnType .~ retType
194− retType = typeFor (Proxy :: Proxy a)
197+ retType = typeFor lang (Proxy :: Proxy a)
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
197 type Foreign (Put list a) = Req
201 type Foreign (Put list a) = Req
199− foreignFor Proxy req =
203+ foreignFor lang Proxy req =
200 req & funcName %~ ("put" :)
204 req & funcName %~ ("put" :)
201 & reqMethod .~ "PUT"
205 & reqMethod .~ "PUT"
202 & reqReturnType .~ retType
206 & reqReturnType .~ retType
204− retType = typeFor (Proxy :: Proxy a)
208+ retType = typeFor lang (Proxy :: Proxy a)
206−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
210+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
207− => HasForeign (QueryParam sym a :> sublayout) where
211+ => HasForeign lang (QueryParam sym a :> sublayout) where
208 type Foreign (QueryParam sym a :> sublayout) = Foreign sublayout
212 type Foreign (QueryParam sym a :> sublayout) = Foreign sublayout
210− foreignFor Proxy req =
214+ foreignFor lang Proxy req =
211− foreignFor (Proxy :: Proxy sublayout) $
215+ foreignFor lang (Proxy :: Proxy sublayout) $
212 req & reqUrl.queryStr <>~ [QueryArg arg Normal]
216 req & reqUrl.queryStr <>~ [QueryArg arg Normal]
215 str = pack . symbolVal $ (Proxy :: Proxy sym)
219 str = pack . symbolVal $ (Proxy :: Proxy sym)
216− arg = (str, typeFor (Proxy :: Proxy a))
220+ arg = (str, typeFor lang (Proxy :: Proxy a))
218−instance (KnownSymbol sym, HasForeignType a, HasForeign sublayout)
222+instance (KnownSymbol sym, HasForeignType lang a, HasForeign lang sublayout)
219− => HasForeign (QueryParams sym a :> sublayout) where
223+ => HasForeign lang (QueryParams sym a :> sublayout) where
220 type Foreign (QueryParams sym a :> sublayout) = Foreign sublayout
224 type Foreign (QueryParams sym a :> sublayout) = Foreign sublayout
222− foreignFor Proxy req =
226+ foreignFor lang Proxy req =
223− foreignFor (Proxy :: Proxy sublayout) $
227+ foreignFor lang (Proxy :: Proxy sublayout) $
224 req & reqUrl.queryStr <>~ [QueryArg arg List]
228 req & reqUrl.queryStr <>~ [QueryArg arg List]
227 str = pack . symbolVal $ (Proxy :: Proxy sym)
231 str = pack . symbolVal $ (Proxy :: Proxy sym)
228− arg = (str, typeFor (Proxy :: Proxy a))
232+ arg = (str, typeFor lang (Proxy :: Proxy a))
230−instance (KnownSymbol sym, HasForeignType a, a ~ Bool, HasForeign sublayout)
234+instance (KnownSymbol sym, HasForeignType lang a, a ~ Bool, HasForeign lang sublayout)
231− => HasForeign (QueryFlag sym :> sublayout) where
235+ => HasForeign lang (QueryFlag sym :> sublayout) where
232 type Foreign (QueryFlag sym :> sublayout) = Foreign sublayout
236 type Foreign (QueryFlag sym :> sublayout) = Foreign sublayout
234− foreignFor Proxy req =
238+ foreignFor lang Proxy req =
235− foreignFor (Proxy :: Proxy sublayout) $
239+ foreignFor lang (Proxy :: Proxy sublayout) $
236 req & reqUrl.queryStr <>~ [QueryArg arg Flag]
240 req & reqUrl.queryStr <>~ [QueryArg arg Flag]
239 str = pack . symbolVal $ (Proxy :: Proxy sym)
243 str = pack . symbolVal $ (Proxy :: Proxy sym)
240− arg = (str, typeFor (Proxy :: Proxy a))
244+ arg = (str, typeFor lang (Proxy :: Proxy a))
242−instance HasForeign Raw where
246+instance HasForeign lang Raw where
243 type Foreign Raw = Method -> Req
247 type Foreign Raw = Method -> Req
245− foreignFor Proxy req method =
249+ foreignFor _ Proxy req method =
246 req & funcName %~ ((toLower method) :)
250 req & funcName %~ ((toLower method) :)
247 & reqMethod .~ method
251 & reqMethod .~ method
249−instance (Elem JSON list, HasForeignType a, HasForeign sublayout)
253+instance (Elem JSON list, HasForeignType lang a, HasForeign lang sublayout)
250− => HasForeign (ReqBody list a :> sublayout) where
254+ => HasForeign lang (ReqBody list a :> sublayout) where
251 type Foreign (ReqBody list a :> sublayout) = Foreign sublayout
255 type Foreign (ReqBody list a :> sublayout) = Foreign sublayout
253− foreignFor Proxy req =
257+ foreignFor lang Proxy req =
254− foreignFor (Proxy :: Proxy sublayout) $
258+ foreignFor lang (Proxy :: Proxy sublayout) $
255− req & reqBody .~ (Just $ typeFor (Proxy :: Proxy a))
259+ req & reqBody .~ (Just $ typeFor lang (Proxy :: Proxy a))
257−instance (KnownSymbol path, HasForeign sublayout)
261+instance (KnownSymbol path, HasForeign lang sublayout)
258− => HasForeign (path :> sublayout) where
262+ => HasForeign lang (path :> sublayout) where
259 type Foreign (path :> sublayout) = Foreign sublayout
263 type Foreign (path :> sublayout) = Foreign sublayout
261− foreignFor Proxy req =
265+ foreignFor lang Proxy req =
262− foreignFor (Proxy :: Proxy sublayout) $
266+ foreignFor lang (Proxy :: Proxy sublayout) $
263 req & reqUrl.path <>~ [Segment (Static str)]
267 req & reqUrl.path <>~ [Segment (Static str)]
264 & funcName %~ (++ [str])
268 & funcName %~ (++ [str])
@@ -267,26 +271,26 @@ instance (KnownSymbol path, HasForeign sublayout)
267 str = Data.Text.map (\c -> if c == '.' then '_' else c)
271 str = Data.Text.map (\c -> if c == '.' then '_' else c)
268 . pack . symbolVal $ (Proxy :: Proxy path)
272 . pack . symbolVal $ (Proxy :: Proxy path)
270−instance HasForeign sublayout => HasForeign (RemoteHost :> sublayout) where
274+instance HasForeign lang sublayout => HasForeign lang (RemoteHost :> sublayout) where
271 type Foreign (RemoteHost :> sublayout) = Foreign sublayout
275 type Foreign (RemoteHost :> sublayout) = Foreign sublayout
273− foreignFor Proxy req =
277+ foreignFor lang Proxy req =
274− foreignFor (Proxy :: Proxy sublayout) req
278+ foreignFor lang (Proxy :: Proxy sublayout) req
276−instance HasForeign sublayout => HasForeign (IsSecure :> sublayout) where
280+instance HasForeign lang sublayout => HasForeign lang (IsSecure :> sublayout) where
277 type Foreign (IsSecure :> sublayout) = Foreign sublayout
281 type Foreign (IsSecure :> sublayout) = Foreign sublayout
279− foreignFor Proxy req =
283+ foreignFor lang Proxy req =
280− foreignFor (Proxy :: Proxy sublayout) req
284+ foreignFor lang (Proxy :: Proxy sublayout) req
282−instance HasForeign sublayout => HasForeign (Vault :> sublayout) where
286+instance HasForeign lang sublayout => HasForeign lang (Vault :> sublayout) where
283 type Foreign (Vault :> sublayout) = Foreign sublayout
287 type Foreign (Vault :> sublayout) = Foreign sublayout
285− foreignFor Proxy req =
289+ foreignFor lang Proxy req =
286− foreignFor (Proxy :: Proxy sublayout) req
290+ foreignFor lang (Proxy :: Proxy sublayout) req
288−instance HasForeign sublayout => HasForeign (HttpVersion :> sublayout) where
292+instance HasForeign lang sublayout => HasForeign lang (HttpVersion :> sublayout) where
289 type Foreign (HttpVersion :> sublayout) = Foreign sublayout
293 type Foreign (HttpVersion :> sublayout) = Foreign sublayout
291− foreignFor Proxy req =
295+ foreignFor lang Proxy req =
292− foreignFor (Proxy :: Proxy sublayout) req
296+ foreignFor lang (Proxy :: Proxy sublayout) req