git.iko.soy/typeable/servant
on master help sign in
Merge pull request #362 from kosmikus/ks-cleanup
2ae5041Andres Löh
servant-server/src/Servant/Server/Internal/RoutingApplication.hs+7−7
@@ -98,10 +98,10 @@ toApplication ra request respond = do
98--
98--
99-- There are two reasons:
99-- There are two reasons:
100--
100--
101−-- 1. Currently, the order in which we perform checks coincides
101+-- 1. In a straight-forward implementation, the order in which we
102−-- with the error we will generate. This is because during checks,
102+-- perform checks will determine the error we generate. This is
103−-- once an error occurs, we do not perform any subsequent checks,
103+-- because once an error occurs, we would abort and not perform
104−-- but rather return this error.
104+-- any subsequent checks, but rather return the current error.
105--
105--
106-- This is not a necessity: we could continue doing other checks,
106-- This is not a necessity: we could continue doing other checks,
107-- and choose the preferred error. However, that would in general
107-- and choose the preferred error. However, that would in general
@@ -159,7 +159,7 @@ data Delayed :: * -> * where
159 -> Delayed c
159 -> Delayed c
160
160
161instance Functor Delayed where
161instance Functor Delayed where
162− fmap f (Delayed a b c g) = Delayed a b c ((fmap.fmap.fmap) f g)
162+ fmap f (Delayed a b c g) = Delayed a b c ((fmap . fmap . fmap) f g)
163
163
164-- | Add a capture to the end of the capture block.
164-- | Add a capture to the end of the capture block.
165addCapture :: Delayed (a -> b)
165addCapture :: Delayed (a -> b)
@@ -240,9 +240,9 @@ runAction :: Delayed (ExceptT ServantErr IO a)
240 -> IO r
240 -> IO r
241runAction action respond k = runDelayed action >>= go >>= respond
241runAction action respond k = runDelayed action >>= go >>= respond
242 where
242 where
243− go (Fail e) = return $ Fail e
243+ go (Fail e) = return $ Fail e
244 go (FailFatal e) = return $ FailFatal e
244 go (FailFatal e) = return $ FailFatal e
245− go (Route a) = do
245+ go (Route a) = do
246 e <- runExceptT a
246 e <- runExceptT a
247 case e of
247 case e of
248 Left err -> return . Route $ responseServantErr err
248 Left err -> return . Route $ responseServantErr err
servant/src/Servant/API/Verbs.hs+27−27
@@ -34,15 +34,15 @@ data Verb (method :: k1) (statusCode :: Nat) (contentTypes :: [*]) a
34-- the relevant information is summarily presented here.
34-- the relevant information is summarily presented here.
35
35
36-- | 'GET' with 200 status code.
36-- | 'GET' with 200 status code.
37−type Get contentTypes a = Verb 'GET 200 contentTypes a
37+type Get = Verb 'GET 200
38-- | 'POST' with 200 status code.
38-- | 'POST' with 200 status code.
39−type Post contentTypes a = Verb 'POST 200 contentTypes a
39+type Post = Verb 'POST 200
40-- | 'PUT' with 200 status code.
40-- | 'PUT' with 200 status code.
41−type Put contentTypes a = Verb 'PUT 200 contentTypes a
41+type Put = Verb 'PUT 200
42-- | 'DELETE' with 200 status code.
42-- | 'DELETE' with 200 status code.
43−type Delete contentTypes a = Verb 'DELETE 200 contentTypes a
43+type Delete = Verb 'DELETE 200
44-- | 'PATCH' with 200 status code.
44-- | 'PATCH' with 200 status code.
45−type Patch contentTypes a = Verb 'PATCH 200 contentTypes a
45+type Patch = Verb 'PATCH 200
46
46
47-- * Other responses
47-- * Other responses
48
48
@@ -58,7 +58,7 @@ type Patch contentTypes a = Verb 'PATCH 200 contentTypes a
58
58
59-- | 'POST' with 201 status code.
59-- | 'POST' with 201 status code.
60--
60--
61−type PostCreated contentTypes a = Verb 'POST 201 contentTypes a
61+type PostCreated = Verb 'POST 201
62
62
63
63
64-- ** 202 Accepted
64-- ** 202 Accepted
@@ -69,15 +69,15 @@ type PostCreated contentTypes a = Verb 'POST 201 contentTypes a
69-- estimate of when the processing will be finished.
69-- estimate of when the processing will be finished.
70
70
71-- | 'GET' with 202 status code.
71-- | 'GET' with 202 status code.
72−type GetAccepted contentTypes a = Verb 'GET 202 contentTypes a
72+type GetAccepted = Verb 'GET 202
73-- | 'POST' with 202 status code.
73-- | 'POST' with 202 status code.
74−type PostAccepted contentTypes a = Verb 'POST 202 contentTypes a
74+type PostAccepted = Verb 'POST 202
75-- | 'DELETE' with 202 status code.
75-- | 'DELETE' with 202 status code.
76−type DeleteAccepted contentTypes a = Verb 'DELETE 202 contentTypes a
76+type DeleteAccepted = Verb 'DELETE 202
77-- | 'PATCH' with 202 status code.
77-- | 'PATCH' with 202 status code.
78−type PatchAccepted contentTypes a = Verb 'PATCH 202 contentTypes a
78+type PatchAccepted = Verb 'PATCH 202
79-- | 'PUT' with 202 status code.
79-- | 'PUT' with 202 status code.
80−type PutAccepted contentTypes a = Verb 'PUT 202 contentTypes a
80+type PutAccepted = Verb 'PUT 202
81
81
82
82
83-- ** 203 Non-Authoritative Information
83-- ** 203 Non-Authoritative Information
@@ -86,15 +86,15 @@ type PutAccepted contentTypes a = Verb 'PUT 202 contentTypes a
86-- information may come from a third-party.
86-- information may come from a third-party.
87
87
88-- | 'GET' with 203 status code.
88-- | 'GET' with 203 status code.
89−type GetNonAuthoritative contentTypes a = Verb 'GET 203 contentTypes a
89+type GetNonAuthoritative = Verb 'GET 203
90-- | 'POST' with 203 status code.
90-- | 'POST' with 203 status code.
91−type PostNonAuthoritative contentTypes a = Verb 'POST 203 contentTypes a
91+type PostNonAuthoritative = Verb 'POST 203
92-- | 'DELETE' with 203 status code.
92-- | 'DELETE' with 203 status code.
93−type DeleteNonAuthoritative contentTypes a = Verb 'DELETE 203 contentTypes a
93+type DeleteNonAuthoritative = Verb 'DELETE 203
94-- | 'PATCH' with 203 status code.
94-- | 'PATCH' with 203 status code.
95−type PatchNonAuthoritative contentTypes a = Verb 'PATCH 203 contentTypes a
95+type PatchNonAuthoritative = Verb 'PATCH 203
96-- | 'PUT' with 203 status code.
96-- | 'PUT' with 203 status code.
97−type PutNonAuthoritative contentTypes a = Verb 'PUT 203 contentTypes a
97+type PutNonAuthoritative = Verb 'PUT 203
98
98
99
99
100-- ** 204 No Content
100-- ** 204 No Content
@@ -105,15 +105,15 @@ type PutNonAuthoritative contentTypes a = Verb 'PUT 203 contentTypes a
105-- If the document view should be reset, use @205 Reset Content@.
105-- If the document view should be reset, use @205 Reset Content@.
106
106
107-- | 'GET' with 204 status code.
107-- | 'GET' with 204 status code.
108−type GetNoContent contentTypes noContent = Verb 'GET 204 contentTypes noContent
108+type GetNoContent = Verb 'GET 204
109-- | 'POST' with 204 status code.
109-- | 'POST' with 204 status code.
110−type PostNoContent contentTypes noContent = Verb 'POST 204 contentTypes noContent
110+type PostNoContent = Verb 'POST 204
111-- | 'DELETE' with 204 status code.
111-- | 'DELETE' with 204 status code.
112−type DeleteNoContent contentTypes noContent = Verb 'DELETE 204 contentTypes noContent
112+type DeleteNoContent = Verb 'DELETE 204
113-- | 'PATCH' with 204 status code.
113-- | 'PATCH' with 204 status code.
114−type PatchNoContent contentTypes noContent = Verb 'PATCH 204 contentTypes noContent
114+type PatchNoContent = Verb 'PATCH 204
115-- | 'PUT' with 204 status code.
115-- | 'PUT' with 204 status code.
116−type PutNoContent contentTypes noContent = Verb 'PUT 204 contentTypes noContent
116+type PutNoContent = Verb 'PUT 204
117
117
118
118
119-- ** 205 Reset Content
119-- ** 205 Reset Content
@@ -124,15 +124,15 @@ type PutNoContent contentTypes noContent = Verb 'PUT 204 contentTypes noContent
124-- If the document view should not be reset, use @204 No Content@.
124-- If the document view should not be reset, use @204 No Content@.
125
125
126-- | 'GET' with 205 status code.
126-- | 'GET' with 205 status code.
127−type GetResetContent contentTypes noContent = Verb 'GET 205 contentTypes noContent
127+type GetResetContent = Verb 'GET 205
128-- | 'POST' with 205 status code.
128-- | 'POST' with 205 status code.
129−type PostResetContent contentTypes noContent = Verb 'POST 205 contentTypes noContent
129+type PostResetContent = Verb 'POST 205
130-- | 'DELETE' with 205 status code.
130-- | 'DELETE' with 205 status code.
131−type DeleteResetContent contentTypes noContent = Verb 'DELETE 205 contentTypes noContent
131+type DeleteResetContent = Verb 'DELETE 205
132-- | 'PATCH' with 205 status code.
132-- | 'PATCH' with 205 status code.
133−type PatchResetContent contentTypes noContent = Verb 'PATCH 205 contentTypes noContent
133+type PatchResetContent = Verb 'PATCH 205
134-- | 'PUT' with 205 status code.
134-- | 'PUT' with 205 status code.
135−type PutResetContent contentTypes noContent = Verb 'PUT 205 contentTypes noContent
135+type PutResetContent = Verb 'PUT 205
136
136
137
137
138-- ** 206 Partial Content
138-- ** 206 Partial Content
@@ -144,7 +144,7 @@ type PutResetContent contentTypes noContent = Verb 'PUT 205 contentTypes noConte
144-- RFC7233 Section 4.1>
144-- RFC7233 Section 4.1>
145
145
146-- | 'GET' with 206 status code.
146-- | 'GET' with 206 status code.
147−type GetPartialContent contentTypes noContent = Verb 'GET 206 contentTypes noContent
147+type GetPartialContent = Verb 'GET 206
148
148
149
149
150class ReflectMethod a where
150class ReflectMethod a where