git.iko.soy/typeable/servant
on master help sign in
Reformatting + clarification comment
commitb84095ee5a34097a35ac277fb84d750089c29aa8 authorGaël Deest <gael.deest@tweag.io> dateWed 23 Mar 2022, 12:49 (5 years ago) parent04ba7e7
1 file changed+5−1
servant/src/Servant/API/ResponseHeaders.hs+5−1
servant/src/Servant/API/ResponseHeaders.hs+5−1
@@ -183,7 +183,11 @@ instance (AddHeader h v old new) => AddHeader h v (Union '[old]) (Union '[new])
183183 SOP.Z $ SOP.I $ addOptionalHeader hdr $ SOP.unI $ SOP.unZ $ resp
184184
185185instance
186− (AddHeader h v old new, AddHeader h v (Union oldrest) (Union newrest), oldrest ~ (a ': as), newrest ~ (b ': bs))
186+ ( AddHeader h v old new, AddHeader h v (Union oldrest) (Union newrest)
187+ -- This ensures that the remainder of the response list is _not_ empty
188+ -- It is necessary to prevent the two instances for union types from
189+ -- overlapping.
190+ , oldrest ~ (a ': as), newrest ~ (b ': bs))
187191 => AddHeader h v (Union (old ': (a ': as))) (Union (new ': (b ': bs))) where
188192 addOptionalHeader hdr resp = case resp of
189193 SOP.Z (SOP.I rHead) -> SOP.Z $ SOP.I $ addOptionalHeader hdr rHead