on master help sign in
Added some typeable instances
78dcb2cMichael Snoyman
Network/Wai.hs+5
@@ -1,5 +1,6 @@
1{-# LANGUAGE Rank2Types #-}
1{-# LANGUAGE Rank2Types #-}
2{-# LANGUAGE ExistentialQuantification #-}
2{-# LANGUAGE ExistentialQuantification #-}
3+{-# LANGUAGE DeriveDataTypeable #-}
3{-|
4{-|
4
5
5This module defines a generic web application interface. It is a common
6This module defines a generic web application interface. It is a common
@@ -74,6 +75,7 @@ import qualified Data.ByteString.Char8 as B8
74import qualified Data.ByteString.Lazy as L
75import qualified Data.ByteString.Lazy as L
75import Data.Char (toLower)
76import Data.Char (toLower)
76import Data.String (IsString (..))
77import Data.String (IsString (..))
78+import Data.Typeable (Typeable)
77
79
78-- | HTTP request method. Since the HTTP protocol allows arbitrary request
80-- | HTTP request method. Since the HTTP protocol allows arbitrary request
79-- methods, we leave this open as a 'B.ByteString'. Please note the request
81-- methods, we leave this open as a 'B.ByteString'. Please note the request
@@ -257,6 +259,7 @@ data Request = Request
257 -- | The client\'s host information.
259 -- | The client\'s host information.
258 , remoteHost :: B.ByteString
260 , remoteHost :: B.ByteString
259 }
261 }
262+ deriving Typeable
260
263
261-- | The response body returned to the server from the application. We provide
264-- | The response body returned to the server from the application. We provide
262-- three separate constructors as optimizations:
265-- three separate constructors as optimizations:
@@ -274,6 +277,7 @@ data Request = Request
274data ResponseBody = ResponseFile FilePath
277data ResponseBody = ResponseFile FilePath
275 | ResponseEnumerator Enumerator
278 | ResponseEnumerator Enumerator
276 | ResponseLBS L.ByteString
279 | ResponseLBS L.ByteString
280+ deriving Typeable
277
281
278data Response = Response
282data Response = Response
279 { status :: Status
283 { status :: Status
@@ -284,6 +288,7 @@ data Response = Response
284 -- whatever means it wishes. If 'Right', it will call the 'Enumerator'.
288 -- whatever means it wishes. If 'Right', it will call the 'Enumerator'.
285 , responseBody :: ResponseBody
289 , responseBody :: ResponseBody
286 }
290 }
291+ deriving Typeable
287
292
288type Application = Request -> IO Response
293type Application = Request -> IO Response
289
294
wai.cabal+1−1
@@ -1,5 +1,5 @@
1Name: wai
1Name: wai
2−Version: 0.2.0
2+Version: 0.2.1
3Synopsis: Web Application Interface.
3Synopsis: Web Application Interface.
4Description: Provides a common protocol for communication between web aplications and web servers.
4Description: Provides a common protocol for communication between web aplications and web servers.
5License: BSD3
5License: BSD3