Skip to content

Commit 05256a4

Browse files
committed
Fix whitespace violations in Haskell sources
find . -name "*hs" | xargs fix-whitespace
1 parent dfd942b commit 05256a4

21 files changed

+365
-366
lines changed

Network/Browser.hs

Lines changed: 76 additions & 77 deletions
Large diffs are not rendered by default.

Network/BufferType.hs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
--
1919
-- This module provides definitions for the standard buffer types that the
2020
-- package supports, i.e., for @String@ and @ByteString@ (strict and lazy.)
21-
--
21+
--
2222
-----------------------------------------------------------------------------
2323
module Network.BufferType
24-
(
24+
(
2525
BufferType(..)
2626

2727
, BufferOp(..)
@@ -44,7 +44,7 @@ import Network.HTTP.Utils ( crlf, lf )
4444
-- that the library requires to operate over data embedded in HTTP
4545
-- requests and responses. That is, we use explicit dictionaries
4646
-- for the operations, but overload the name of the dicts themselves.
47-
--
47+
--
4848
class BufferType bufType where
4949
bufferOps :: BufferOp bufType
5050

@@ -57,7 +57,7 @@ instance BufferType Strict.ByteString where
5757
instance BufferType String where
5858
bufferOps = stringBufferOp
5959

60-
-- | @BufferOp@ encodes the I/O operations of the underlying buffer over
60+
-- | @BufferOp@ encodes the I/O operations of the underlying buffer over
6161
-- a Handle in an (explicit) dictionary type. May not be needed, but gives
6262
-- us flexibility in explicit overriding and wrapping up of these methods.
6363
--
@@ -67,7 +67,7 @@ instance BufferType String where
6767
--
6868
-- We supply three default @BufferOp@ values, for @String@ along with the
6969
-- strict and lazy versions of @ByteString@. To add others, provide @BufferOp@
70-
-- definitions for
70+
-- definitions for
7171
data BufferOp a
7272
= BufferOp
7373
{ buf_hGet :: Handle -> Int -> IO a
@@ -92,8 +92,8 @@ instance Eq (BufferOp a) where
9292
-- | @strictBufferOp@ is the 'BufferOp' definition over @ByteString@s,
9393
-- the non-lazy kind.
9494
strictBufferOp :: BufferOp Strict.ByteString
95-
strictBufferOp =
96-
BufferOp
95+
strictBufferOp =
96+
BufferOp
9797
{ buf_hGet = Strict.hGet
9898
, buf_hGetContents = Strict.hGetContents
9999
, buf_hPut = Strict.hPut
@@ -108,7 +108,7 @@ strictBufferOp =
108108
, buf_empty = Strict.empty
109109
, buf_isLineTerm = \ b -> Strict.length b == 2 && p_crlf == b ||
110110
Strict.length b == 1 && p_lf == b
111-
, buf_isEmpty = Strict.null
111+
, buf_isEmpty = Strict.null
112112
}
113113
where
114114
p_crlf = Strict.pack crlf
@@ -117,8 +117,8 @@ strictBufferOp =
117117
-- | @lazyBufferOp@ is the 'BufferOp' definition over @ByteString@s,
118118
-- the non-strict kind.
119119
lazyBufferOp :: BufferOp Lazy.ByteString
120-
lazyBufferOp =
121-
BufferOp
120+
lazyBufferOp =
121+
BufferOp
122122
{ buf_hGet = Lazy.hGet
123123
, buf_hGetContents = Lazy.hGetContents
124124
, buf_hPut = Lazy.hPut
@@ -133,7 +133,7 @@ lazyBufferOp =
133133
, buf_empty = Lazy.empty
134134
, buf_isLineTerm = \ b -> Lazy.length b == 2 && p_crlf == b ||
135135
Lazy.length b == 1 && p_lf == b
136-
, buf_isEmpty = Lazy.null
136+
, buf_isEmpty = Lazy.null
137137
}
138138
where
139139
p_crlf = Lazy.pack crlf
@@ -143,7 +143,7 @@ lazyBufferOp =
143143
-- It is defined in terms of @strictBufferOp@ operations,
144144
-- unpacking/converting to @String@ when needed.
145145
stringBufferOp :: BufferOp String
146-
stringBufferOp =BufferOp
146+
stringBufferOp =BufferOp
147147
{ buf_hGet = \ h n -> buf_hGet strictBufferOp h n >>= return . Strict.unpack
148148
, buf_hGetContents = \ h -> buf_hGetContents strictBufferOp h >>= return . Strict.unpack
149149
, buf_hPut = \ h s -> buf_hPut strictBufferOp h (Strict.pack s)
@@ -154,11 +154,11 @@ stringBufferOp =BufferOp
154154
, buf_toStr = id
155155
, buf_snoc = \ a x -> a ++ [toEnum (fromIntegral x)]
156156
, buf_splitAt = splitAt
157-
, buf_span = \ p a ->
157+
, buf_span = \ p a ->
158158
case Strict.span p (Strict.pack a) of
159159
(x,y) -> (Strict.unpack x, Strict.unpack y)
160160
, buf_empty = []
161161
, buf_isLineTerm = \ b -> b == crlf || b == lf
162-
, buf_isEmpty = null
162+
, buf_isEmpty = null
163163
}
164164

Network/HTTP.hs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- Module : Network.HTTP
44
-- Copyright : See LICENSE file
55
-- License : BSD
6-
--
6+
--
77
-- Maintainer : Ganesh Sittampalam <[email protected]>
88
-- Stability : experimental
99
-- Portability : non-portable (not tested)
@@ -27,31 +27,31 @@
2727
-- namespace, letting you either use the default implementation here
2828
-- by importing @Network.HTTP@ or, for more specific uses, selectively
2929
-- import the modules in @Network.HTTP.*@. To wit, more than one kind of
30-
-- representation of the bulk data that flows across a HTTP connection is
30+
-- representation of the bulk data that flows across a HTTP connection is
3131
-- supported. (see "Network.HTTP.HandleStream".)
32-
--
32+
--
3333
-- /NOTE:/ The 'Request' send actions will normalize the @Request@ prior to transmission.
3434
-- Normalization such as having the request path be in the expected form and, possibly,
3535
-- introduce a default @Host:@ header if one isn't already present.
3636
-- Normalization also takes the @"user:pass\@"@ portion out of the the URI,
3737
-- if it was supplied, and converts it into @Authorization: Basic$ header.
38-
-- If you do not
38+
-- If you do not
3939
-- want the requests tampered with, but sent as-is, please import and use the
4040
-- the "Network.HTTP.HandleStream" or "Network.HTTP.Stream" modules instead. They
41-
-- export the same functions, but leaves construction and any normalization of
41+
-- export the same functions, but leaves construction and any normalization of
4242
-- @Request@s to the user.
4343
--
4444
-- /NOTE:/ This package only supports HTTP; it does not support HTTPS.
4545
-- Attempts to use HTTPS result in an error.
4646
-----------------------------------------------------------------------------
47-
module Network.HTTP
47+
module Network.HTTP
4848
( module Network.HTTP.Base
4949
, module Network.HTTP.Headers
5050

51-
{- the functionality that the implementation modules,
52-
Network.HTTP.HandleStream and Network.HTTP.Stream,
53-
exposes:
54-
-}
51+
{- the functionality that the implementation modules,
52+
Network.HTTP.HandleStream and Network.HTTP.Stream,
53+
exposes:
54+
-}
5555
, simpleHTTP -- :: Request -> IO (Result Response)
5656
, simpleHTTP_ -- :: Stream s => s -> Request -> IO (Result Response)
5757
, sendHTTP -- :: Stream s => s -> Request -> IO (Result Response)
@@ -60,12 +60,12 @@ module Network.HTTP
6060
, respondHTTP -- :: Stream s => s -> Response -> IO ()
6161

6262
, module Network.TCP
63-
63+
6464
, getRequest -- :: String -> Request_String
6565
, headRequest -- :: String -> Request_String
6666
, postRequest -- :: String -> Request_String
6767
, postRequestWithBody -- :: String -> String -> String -> Request_String
68-
68+
6969
, getResponseBody -- :: Result (Request ty) -> IO ty
7070
, getResponseCode -- :: Result (Request ty) -> IO ResponseCode
7171
) where
@@ -109,10 +109,10 @@ simpleHTTP r = do
109109
c <- openStream (host auth) (fromMaybe 80 (port auth))
110110
let norm_r = normalizeRequest defaultNormalizeRequestOptions{normDoClose=True} r
111111
simpleHTTP_ c norm_r
112-
112+
113113
-- | Identical to 'simpleHTTP', but acting on an already opened stream.
114114
simpleHTTP_ :: HStream ty => HandleStream ty -> Request ty -> IO (Result (Response ty))
115-
simpleHTTP_ s r = do
115+
simpleHTTP_ s r = do
116116
let norm_r = normalizeRequest defaultNormalizeRequestOptions{normDoClose=True} r
117117
S.sendHTTP s norm_r
118118

@@ -121,7 +121,7 @@ simpleHTTP_ s r = do
121121
-- closed upon receiving the response.
122122
sendHTTP :: HStream ty => HandleStream ty -> Request ty -> IO (Result (Response ty))
123123
sendHTTP conn rq = do
124-
let norm_r = normalizeRequest defaultNormalizeRequestOptions rq
124+
let norm_r = normalizeRequest defaultNormalizeRequestOptions rq
125125
S.sendHTTP conn norm_r
126126

127127
-- | @sendHTTP_notify hStream httpRequest action@ behaves like 'sendHTTP', but
@@ -134,7 +134,7 @@ sendHTTP_notify :: HStream ty
134134
-> IO ()
135135
-> IO (Result (Response ty))
136136
sendHTTP_notify conn rq onSendComplete = do
137-
let norm_r = normalizeRequest defaultNormalizeRequestOptions rq
137+
let norm_r = normalizeRequest defaultNormalizeRequestOptions rq
138138
S.sendHTTP_notify conn norm_r onSendComplete
139139

140140
-- | @receiveHTTP hStream@ reads a 'Request' from the 'HandleStream' @hStream@
@@ -154,7 +154,7 @@ respondHTTP conn rsp = S.respondHTTP conn rsp
154154
getRequest
155155
:: String -- ^URL to fetch
156156
-> Request_String -- ^The constructed request
157-
getRequest urlString =
157+
getRequest urlString =
158158
case parseURI urlString of
159159
Nothing -> error ("getRequest: Not a valid URL - " ++ urlString)
160160
Just u -> mkRequest GET u
@@ -165,7 +165,7 @@ getRequest urlString =
165165
headRequest
166166
:: String -- ^URL to fetch
167167
-> Request_String -- ^The constructed request
168-
headRequest urlString =
168+
headRequest urlString =
169169
case parseURI urlString of
170170
Nothing -> error ("headRequest: Not a valid URL - " ++ urlString)
171171
Just u -> mkRequest HEAD u
@@ -176,7 +176,7 @@ headRequest urlString =
176176
postRequest
177177
:: String -- ^URL to POST to
178178
-> Request_String -- ^The constructed request
179-
postRequest urlString =
179+
postRequest urlString =
180180
case parseURI urlString of
181181
Nothing -> error ("postRequest: Not a valid URL - " ++ urlString)
182182
Just u -> mkRequest POST u
@@ -193,7 +193,7 @@ postRequestWithBody
193193
-> String -- ^Content-Type of body
194194
-> String -- ^The body of the request
195195
-> Request_String -- ^The constructed request
196-
postRequestWithBody urlString typ body =
196+
postRequestWithBody urlString typ body =
197197
case parseURI urlString of
198198
Nothing -> error ("postRequestWithBody: Not a valid URL - " ++ urlString)
199199
Just u -> setRequestBody (mkRequest POST u) (typ, body)
@@ -222,29 +222,29 @@ getResponseCode (Right r) = return (rspCode r)
222222
-- - comm timeouts
223223
-- - MIME & entity stuff (happening in separate module)
224224
-- - support \"*\" uri-request-string for OPTIONS request method
225-
--
226-
--
225+
--
226+
--
227227
-- * Header notes:
228228
--
229229
-- [@Host@]
230230
-- Required by HTTP\/1.1, if not supplied as part
231231
-- of a request a default Host value is extracted
232232
-- from the request-uri.
233-
--
234-
-- [@Connection@]
233+
--
234+
-- [@Connection@]
235235
-- If this header is present in any request or
236236
-- response, and it's value is "close", then
237-
-- the current request\/response is the last
237+
-- the current request\/response is the last
238238
-- to be allowed on that connection.
239-
--
239+
--
240240
-- [@Expect@]
241241
-- Should a request contain a body, an Expect
242242
-- header will be added to the request. The added
243243
-- header has the value \"100-continue\". After
244244
-- a 417 \"Expectation Failed\" response the request
245245
-- is attempted again without this added Expect
246246
-- header.
247-
--
247+
--
248248
-- [@TransferEncoding,ContentLength,...@]
249249
-- if request is inconsistent with any of these
250250
-- header values then you may not receive any response
@@ -257,7 +257,7 @@ getResponseCode (Right r) = return (rspCode r)
257257
-- [@1xx@] \"100 Continue\" will cause any unsent request body to be sent.
258258
-- \"101 Upgrade\" will be returned.
259259
-- Other 1xx responses are ignored.
260-
--
260+
--
261261
-- [@417@] The reason for this code is \"Expectation failed\", indicating
262262
-- that the server did not like the Expect \"100-continue\" header
263263
-- added to a request. Receipt of 417 will induce another

Network/HTTP/Auth.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
-- Module : Network.HTTP.Auth
55
-- Copyright : See LICENSE file
66
-- License : BSD
7-
--
7+
--
88
-- Maintainer : Ganesh Sittampalam <[email protected]>
99
-- Stability : experimental
1010
-- Portability : non-portable (not tested)
1111
--
1212
-- Representing HTTP Auth values in Haskell.
1313
-- Right now, it contains mostly functionality needed by 'Network.Browser'.
14-
--
14+
--
1515
-----------------------------------------------------------------------------
1616
module Network.HTTP.Auth
1717
( Authority(..)
@@ -38,7 +38,7 @@ import Data.Word ( Word8 )
3838

3939
-- | @Authority@ specifies the HTTP Authentication method to use for
4040
-- a given domain/realm; @Basic@ or @Digest@.
41-
data Authority
41+
data Authority
4242
= AuthBasic { auRealm :: String
4343
, auUsername :: String
4444
, auPassword :: String
@@ -55,7 +55,7 @@ data Authority
5555
}
5656

5757

58-
data Challenge
58+
data Challenge
5959
= ChalBasic { chRealm :: String }
6060
| ChalDigest { chRealm :: String
6161
, chDomain :: [URI]
@@ -74,13 +74,13 @@ instance Show Algorithm where
7474
show AlgMD5 = "md5"
7575
show AlgMD5sess = "md5-sess"
7676

77-
-- |
77+
-- |
7878
data Qop = QopAuth | QopAuthInt
7979
deriving(Eq,Show)
8080

8181
-- | @withAuthority auth req@ generates a credentials value from the @auth@ 'Authority',
8282
-- in the context of the given request.
83-
--
83+
--
8484
-- If a client nonce was to be used then this function might need to be of type ... -> BrowserAction String
8585
withAuthority :: Authority -> Request ty -> String
8686
withAuthority a rq = case a of
@@ -104,7 +104,7 @@ withAuthority a rq = case a of
104104

105105
a1, a2 :: String
106106
a1 = auUsername a ++ ":" ++ auRealm a ++ ":" ++ auPassword a
107-
107+
108108
{-
109109
If the "qop" directive's value is "auth" or is unspecified, then A2
110110
is:
@@ -135,7 +135,7 @@ kd a b = md5 (a ++ ":" ++ b)
135135

136136

137137

138-
-- | @headerToChallenge base www_auth@ tries to convert the @WWW-Authenticate@ header
138+
-- | @headerToChallenge base www_auth@ tries to convert the @WWW-Authenticate@ header
139139
-- @www_auth@ into a 'Challenge' value.
140140
headerToChallenge :: URI -> Header -> Maybe Challenge
141141
headerToChallenge baseURI (Header _ str) =
@@ -173,12 +173,12 @@ headerToChallenge baseURI (Header _ str) =
173173
-- with Maybe monad
174174
do { r <- lookup "realm" params
175175
; n <- lookup "nonce" params
176-
; return $
176+
; return $
177177
ChalDigest { chRealm = r
178-
, chDomain = (annotateURIs
178+
, chDomain = (annotateURIs
179179
$ map parseURI
180-
$ words
181-
$ fromMaybe []
180+
$ words
181+
$ fromMaybe []
182182
$ lookup "domain" params)
183183
, chNonce = n
184184
, chOpaque = lookup "opaque" params

0 commit comments

Comments
 (0)