@@ -144,9 +144,14 @@ instance {-# OVERLAPPABLE #-}
144144 ) => HasInp (Verb method status cts' (Headers ls a)) where
145145 type Inp (Verb method status cts' (Headers ls a)) = ()
146146 type Out (Verb method status cts' (Headers ls a)) = Either Text (Headers ls a)
147− inpToReq _ _ = defReqIO { respHeadersIO = OnlyHeaders (Set.fromList (buildHeaderKeysTo (Proxy :: Proxy ls)))}
147+ inpToReq _ _ = defReqIO { respHeadersIO =
148+ OnlyHeaders (Set.fromList
149+ (buildHeaderKeysTo
150+ (Proxy :: Proxy ls)))
151+ }
148152
149153
154+------------------------------------------------------------------------------
150155instance {-# OVERLAPPABLE #-}
151156 HasInp (Verb method status cts' (Headers ls a))
152157 => HasClient (Verb method status cts' (Headers ls a)) t m where
@@ -154,47 +159,87 @@ instance {-# OVERLAPPABLE #-}
154159 Event t (ToTuple (Inp (Verb method status cts' (Headers ls a)))) ->
155160 m (Event t (Out (Verb method status cts' (Headers ls a))))
156161
162+
163+------------------------------------------------------------------------------
157164instance {-# OVERLAPPING #-}
158165 (BuildHeadersTo ls,
159− BuildHeaderKeysTo ls) => HasInp (Verb method status cts' (Headers ls NoContent)) where
166+ BuildHeaderKeysTo ls
167+ ) => HasInp (Verb method status cts' (Headers ls NoContent)) where
160168 type Inp (Verb method status cts' (Headers ls NoContent)) = ()
161− type Out (Verb method status cts' (Headers ls NoContent)) = Either Text (Headers ls NoContent)
162− inpToReq _ _ = defReqIO { respHeadersIO = OnlyHeaders (Set.fromList (buildHeaderKeysTo (Proxy :: Proxy ls)))}
169+ type Out (Verb method status cts' (Headers ls NoContent)) =
170+ Either Text (Headers ls NoContent)
171+ inpToReq _ _ = defReqIO { respHeadersIO =
172+ OnlyHeaders (Set.fromList
173+ (buildHeaderKeysTo
174+ (Proxy :: Proxy ls)))
175+ }
163176
177+
178+------------------------------------------------------------------------------
164179instance {-# OVERLAPPING #-}
165180 (BuildHeadersTo ls,
166181 BuildHeaderKeysTo ls,
167− SupportsServantReflex t m) => HasClient (Verb method status cts' (Headers ls NoContent)) t m where
182+ SupportsServantReflex t m
183+ ) => HasClient (Verb method status cts' (Headers ls NoContent)) t m where
168184 type Client (Verb method status cts' (Headers ls NoContent)) t m =
169185 Event t (ToTuple (Inp (Verb method status cts' (Headers ls NoContent)))) ->
170186 m (Event t (Out (Verb method status cts' (Headers ls NoContent))))
171187
172188
173−toHeaders :: BuildHeadersTo ls => ReqResult tag a -> ReqResult tag (Headers ls a)
189+------------------------------------------------------------------------------
190+toHeaders
191+ :: BuildHeadersTo ls
192+ => ReqResult tag a
193+ -> ReqResult tag (Headers ls a)
174194toHeaders r =
175195 let toBS = E.encodeUtf8
176196 hdrs = maybe []
177197 (\xhr -> fmap (\(h,v) -> (mk (toBS h), toBS v))
178198 (Map.toList $ _xhrResponse_headers xhr))
179199 (response r)
180− in ffor r $ \a -> Headers {getResponse = a ,getHeadersHList = buildHeadersTo hdrs}
200+ in ffor r $ \a -> Headers {getResponse = a
201+ ,getHeadersHList = buildHeadersTo hdrs
202+ }
203+
181204
205+------------------------------------------------------------------------------
182206class BuildHeaderKeysTo hs where
183207 buildHeaderKeysTo :: Proxy hs -> [T.Text]
184208
209+
210+------------------------------------------------------------------------------
185211instance {-# OVERLAPPABLE #-} BuildHeaderKeysTo '[]
186212 where buildHeaderKeysTo _ = []
187213
214+
215+------------------------------------------------------------------------------
188216instance {-# OVERLAPPABLE #-} (BuildHeaderKeysTo xs, KnownSymbol h)
189217 => BuildHeaderKeysTo ((Header h v) ': xs) where
190− buildHeaderKeysTo _ = T.pack (symbolVal (Proxy :: Proxy h)) : buildHeaderKeysTo (Proxy :: Proxy xs)
218+ buildHeaderKeysTo _ =
219+ T.pack (symbolVal (Proxy :: Proxy h)) :
220+ buildHeaderKeysTo (Proxy :: Proxy xs)
191221
192222
193−instance (KnownSymbol sym, ToHttpApiData a, HasInp sublayout) => HasInp (Header sym a :> sublayout) where
223+------------------------------------------------------------------------------
224+instance (KnownSymbol sym,
225+ ToHttpApiData a,
226+ HasInp sublayout
227+ ) => HasInp (Header sym a :> sublayout) where
194228 type Inp (Header sym a :> sublayout) = (Maybe a, Inp sublayout)
195229 type Out (Header sym a :> sublayout) = Out sublayout
196− inpToReq _ (h, vs) = (addHeaderIO hname h) (inpToReq (Proxy :: Proxy sublayout) vs)
230+ inpToReq _ (h, vs) =
231+ (addHeaderIO hname h) (inpToReq (Proxy :: Proxy sublayout) vs)
197232 where hname = T.pack $ symbolVal (Proxy :: Proxy sym)
198233
199−instance (KnownSymbol sym, ToHttpApiData a, HasClient sublayout t m) => HasClient (Header sym a :> sublayout) t m where
200− type Client (Header sym a :> sublayout) t m = Event t (ToTuple (Inp (Header sym a :> sublayout))) -> m (Event t (Out (Header sym a :> sublayout)))
234+
235+------------------------------------------------------------------------------
236+instance (KnownSymbol sym,
237+ ToHttpApiData a,
238+ HasClient sublayout t m
239+ ) => HasClient (Header sym a :> sublayout) t m where
240+ type Client (Header sym a :> sublayout) t m =
241+ Event t (ToTuple (Inp (Header sym a :> sublayout)))
242+ -> m (Event t (Out (Header sym a :> sublayout)))
243+
244+
245+------------------------------------------------------------------------------