@@ -45,7 +45,7 @@ import Prelude ()
4545import Prelude.Compat
4646
4747-- | Response Header objects. You should never need to construct one directly.
48−-- Instead, use 'addHeader'.
48+-- Instead, use 'addOptionalHeader.
4949data Headers ls a = Headers { getResponse :: a
5050 -- ^ The underlying value of a 'Headers'
5151 , getHeadersHList :: HList ls
@@ -110,17 +110,17 @@ instance OVERLAPPABLE_ ( KnownSymbol h, GetHeaders (HList rest), ToHttpApiData v
110110-- We need all these fundeps to save type inference
111111class AddHeader h v orig new
112112 | h v orig -> new, new -> h, new -> v, new -> orig where
113− addHeader' :: Header h v -> orig -> new -- ^ N.B.: The same header can't be added multiple times
113+ addOptionalHeader :: Header h v -> orig -> new -- ^ N.B.: The same header can't be added multiple times
114114
115115
116116instance OVERLAPPING_ ( KnownSymbol h, ToHttpApiData v )
117117 => AddHeader h v (Headers (fst ': rest) a) (Headers (Header h v ': fst ': rest) a) where
118− addHeader' hdr (Headers resp heads) = Headers resp (HCons hdr heads)
118+ addOptionalHeader hdr (Headers resp heads) = Headers resp (HCons hdr heads)
119119
120120instance OVERLAPPABLE_ ( KnownSymbol h, ToHttpApiData v
121121 , new ~ (Headers '[Header h v] a) )
122122 => AddHeader h v a new where
123− addHeader' hdr resp = Headers resp (HCons hdr HNil)
123+ addOptionalHeader hdr resp = Headers resp (HCons hdr HNil)
124124
125125-- | @addHeader@ adds a header to a response. Note that it changes the type of
126126-- the value in the following ways:
@@ -143,7 +143,7 @@ instance OVERLAPPABLE_ ( KnownSymbol h, ToHttpApiData v
143143-- the type can be inferred from the API type, in other cases you may find
144144-- yourself needing to add annotations.
145145addHeader :: AddHeader h v orig new => v -> orig -> new
146−addHeader = addHeader' . Header
146+addHeader = addOptionalHeader . Header
147147
148148-- | Deliberately do not add a header to a value.
149149--
@@ -151,7 +151,7 @@ addHeader = addHeader' . Header
151151-- >>> getHeaders example1
152152-- []
153153noHeader :: AddHeader h v orig new => orig -> new
154−noHeader = addHeader' MissingHeader
154+noHeader = addOptionalHeader MissingHeader
155155
156156-- $setup
157157-- >>> import Servant.API