@@ -38,7 +38,7 @@ import Network.Wai (Application, Request, Response,
38 requestMethod, responseLBS,
38 requestMethod, responseLBS,
39 strictRequestBody)
39 strictRequestBody)
40import Servant.API ((:<|>) (..), (:>), Capture,
40import Servant.API ((:<|>) (..), (:>), Capture,
41− Canonicalize, Delete, Get, Header,
41+ Delete, Get, Header,
42 MatrixFlag, MatrixParam, MatrixParams,
42 MatrixFlag, MatrixParam, MatrixParams,
43 Patch, Post, Put, QueryFlag,
43 Patch, Post, Put, QueryFlag,
44 QueryParam, QueryParams, Raw,
44 QueryParam, QueryParams, Raw,
@@ -46,9 +46,12 @@ import Servant.API ((:<|>) (..), (:>), Capture,
46import Servant.API.ContentTypes (AcceptHeader (..),
46import Servant.API.ContentTypes (AcceptHeader (..),
47 AllCTRender (..),
47 AllCTRender (..),
48 AllCTUnrender (..))
48 AllCTUnrender (..))
49−import Servant.API.ResponseHeaders (Headers, getResponse, getHeaders)
49+import Servant.API.ResponseHeaders (Headers, getResponse, GetHeaders,
50import Servant.Common.Text (FromText, fromText)
51import Servant.Common.Text (FromText, fromText)
53+import Servant.Server.Internal.ServantErr
52data ReqBodyState = Uncalled
55data ReqBodyState = Uncalled
53 | Called !B.ByteString
56 | Called !B.ByteString
54 | Done !B.ByteString
57 | Done !B.ByteString
@@ -174,13 +177,11 @@ processedPathInfo r =
174 where pinfo = parsePathInfo r
177 where pinfo = parsePathInfo r
176class HasServer layout where
179class HasServer layout where
177− type ServerT' layout (m :: * -> *) :: *
180+ type ServerT layout (m :: * -> *) :: *
179− route :: Proxy layout -> Server' layout -> RoutingApplication
182+ route :: Proxy layout -> Server layout -> RoutingApplication
181−type Server layout = Server' (Canonicalize layout)
182−type Server' layout = ServerT' layout (EitherT (Int, String) IO)
184+type Server layout = ServerT layout (EitherT ServantErr IO)
183−type ServerT layout m = ServerT' (Canonicalize layout) m
185-- * Instances
186-- * Instances
@@ -197,7 +198,7 @@ type ServerT layout m = ServerT' (Canonicalize layout) m
197-- > postBook book = ...
198-- > postBook book = ...
198instance (HasServer a, HasServer b) => HasServer (a :<|> b) where
199instance (HasServer a, HasServer b) => HasServer (a :<|> b) where
200− type ServerT' (a :<|> b) m = ServerT' a m :<|> ServerT' b m
201+ type ServerT (a :<|> b) m = ServerT a m :<|> ServerT b m
202 route Proxy (a :<|> b) request respond =
203 route Proxy (a :<|> b) request respond =
203 route pa a request $ \mResponse ->
204 route pa a request $ \mResponse ->
@@ -231,8 +232,8 @@ captured _ = fromText
231instance (KnownSymbol capture, FromText a, HasServer sublayout)
232instance (KnownSymbol capture, FromText a, HasServer sublayout)
232 => HasServer (Capture capture a :> sublayout) where
233 => HasServer (Capture capture a :> sublayout) where
234− type ServerT' (Capture capture a :> sublayout) m =
235+ type ServerT (Capture capture a :> sublayout) m =
235− a -> ServerT' sublayout m
236+ a -> ServerT sublayout m
237 route Proxy subserver request respond = case processedPathInfo request of
238 route Proxy subserver request respond = case processedPathInfo request of
238 (first : rest)
239 (first : rest)
@@ -259,16 +260,14 @@ instance (KnownSymbol capture, FromText a, HasServer sublayout)
259-- are not met.
260-- are not met.
260instance HasServer Delete where
261instance HasServer Delete where
262− type ServerT' Delete m = m ()
263+ type ServerT Delete m = m ()
264 route Proxy action request respond
265 route Proxy action request respond
265 | pathIsEmpty request && requestMethod request == methodDelete = do
266 | pathIsEmpty request && requestMethod request == methodDelete = do
266 e <- runEitherT action
267 e <- runEitherT action
267 respond $ succeedWith $ case e of
268 respond $ succeedWith $ case e of
269− responseLBS status204 [] ""
269+ Right () -> responseLBS status204 [] ""
270− Left (status, message) ->
270+ Left err -> responseServantErr err
271− responseLBS (mkStatus status (cs message)) [] (cs message)
272 | pathIsEmpty request && requestMethod request /= methodDelete =
271 | pathIsEmpty request && requestMethod request /= methodDelete =
273 respond $ failWith WrongMethod
272 respond $ failWith WrongMethod
274 | otherwise = respond $ failWith NotFound
273 | otherwise = respond $ failWith NotFound
@@ -292,7 +291,7 @@ instance
293 ( AllCTRender ctypes a ) => HasServer (Get ctypes a) where
292 ( AllCTRender ctypes a ) => HasServer (Get ctypes a) where
295− type ServerT' (Get ctypes a) m = m a
294+ type ServerT (Get ctypes a) m = m a
297 route Proxy action request respond
296 route Proxy action request respond
298 | pathIsEmpty request && requestMethod request == methodGet = do
297 | pathIsEmpty request && requestMethod request == methodGet = do
@@ -304,8 +303,7 @@ instance
304 Nothing -> failWith UnsupportedMediaType
303 Nothing -> failWith UnsupportedMediaType
305 Just (contentT, body) -> succeedWith $
304 Just (contentT, body) -> succeedWith $
306 responseLBS ok200 [ ("Content-Type" , cs contentT)] body
305 responseLBS ok200 [ ("Content-Type" , cs contentT)] body
307− Left (status, message) -> succeedWith $
306+ Left err -> succeedWith $ responseServantErr err
308− responseLBS (mkStatus status (cs message)) [] (cs message)
309 | pathIsEmpty request && requestMethod request /= methodGet =
307 | pathIsEmpty request && requestMethod request /= methodGet =
310 respond $ failWith WrongMethod
308 respond $ failWith WrongMethod
311 | otherwise = respond $ failWith NotFound
309 | otherwise = respond $ failWith NotFound
@@ -317,15 +315,14 @@ instance
318 HasServer (Get ctypes ()) where
316 HasServer (Get ctypes ()) where
320− type ServerT' (Get ctypes ()) m = m ()
318+ type ServerT (Get ctypes ()) m = m ()
322 route Proxy action request respond
320 route Proxy action request respond
323 | pathIsEmpty request && requestMethod request == methodGet = do
321 | pathIsEmpty request && requestMethod request == methodGet = do
324 e <- runEitherT action
322 e <- runEitherT action
325 respond . succeedWith $ case e of
323 respond . succeedWith $ case e of
326 Right () -> responseLBS noContent204 [] ""
324 Right () -> responseLBS noContent204 [] ""
327− Left (status, message) ->
325+ Left err -> responseServantErr err
328− responseLBS (mkStatus status (cs message)) [] (cs message)
329 | pathIsEmpty request && requestMethod request /= methodGet =
326 | pathIsEmpty request && requestMethod request /= methodGet =
330 respond $ failWith WrongMethod
327 respond $ failWith WrongMethod
331 | otherwise = respond $ failWith NotFound
328 | otherwise = respond $ failWith NotFound
@@ -335,9 +332,10 @@ instance
335#if MIN_VERSION_base(4,8,0)
332#if MIN_VERSION_base(4,8,0)
336 {-# OVERLAPPING #-}
333 {-# OVERLAPPING #-}
335+ ( GetHeaders (Headers h v), AllCTRender ctypes v
338− ( AllCTRender ctypes v ) => HasServer (Get ctypes (Headers h v)) where
336+ ) => HasServer (Get ctypes (Headers h v)) where
340− type ServerT' (Get ctypes (Headers h v)) m = m (Headers h v)
338+ type ServerT (Get ctypes (Headers h v)) m = m (Headers h v)
342 route Proxy action request respond
340 route Proxy action request respond
343 | pathIsEmpty request && requestMethod request == methodGet = do
341 | pathIsEmpty request && requestMethod request == methodGet = do
@@ -350,8 +348,7 @@ instance
350 Nothing -> failWith UnsupportedMediaType
348 Nothing -> failWith UnsupportedMediaType
351 Just (contentT, body) -> succeedWith $
349 Just (contentT, body) -> succeedWith $
352 responseLBS ok200 ( ("Content-Type" , cs contentT) : headers) body
350 responseLBS ok200 ( ("Content-Type" , cs contentT) : headers) body
353− Left (status, message) -> succeedWith $
351+ Left err -> succeedWith $ responseServantErr err
354− responseLBS (mkStatus status (cs message)) [] (cs message)
355 | pathIsEmpty request && requestMethod request /= methodGet =
352 | pathIsEmpty request && requestMethod request /= methodGet =
356 respond $ failWith WrongMethod
353 respond $ failWith WrongMethod
357 | otherwise = respond $ failWith NotFound
354 | otherwise = respond $ failWith NotFound
@@ -379,8 +376,8 @@ instance
379instance (KnownSymbol sym, FromText a, HasServer sublayout)
376instance (KnownSymbol sym, FromText a, HasServer sublayout)
380 => HasServer (Header sym a :> sublayout) where
377 => HasServer (Header sym a :> sublayout) where
382− type ServerT' (Header sym a :> sublayout) m =
379+ type ServerT (Header sym a :> sublayout) m =
383− Maybe a -> ServerT' sublayout m
380+ Maybe a -> ServerT sublayout m
385 route Proxy subserver request respond = do
382 route Proxy subserver request respond = do
386 let mheader = fromText . decodeUtf8 =<< lookup str (requestHeaders request)
383 let mheader = fromText . decodeUtf8 =<< lookup str (requestHeaders request)
@@ -408,7 +405,7 @@ instance
408 ( AllCTRender ctypes a
405 ( AllCTRender ctypes a
409 ) => HasServer (Post ctypes a) where
406 ) => HasServer (Post ctypes a) where
411− type ServerT' (Post ctypes a) m = m a
408+ type ServerT (Post ctypes a) m = m a
413 route Proxy action request respond
410 route Proxy action request respond
414 | pathIsEmpty request && requestMethod request == methodPost = do
411 | pathIsEmpty request && requestMethod request == methodPost = do
@@ -420,8 +417,7 @@ instance
420 Nothing -> failWith UnsupportedMediaType
417 Nothing -> failWith UnsupportedMediaType
421 Just (contentT, body) -> succeedWith $
418 Just (contentT, body) -> succeedWith $
422 responseLBS status201 [ ("Content-Type" , cs contentT)] body
419 responseLBS status201 [ ("Content-Type" , cs contentT)] body
423− Left (status, message) -> succeedWith $
420+ Left err -> succeedWith $ responseServantErr err
424− responseLBS (mkStatus status (cs message)) [] (cs message)
425 | pathIsEmpty request && requestMethod request /= methodPost =
421 | pathIsEmpty request && requestMethod request /= methodPost =
426 respond $ failWith WrongMethod
422 respond $ failWith WrongMethod
427 | otherwise = respond $ failWith NotFound
423 | otherwise = respond $ failWith NotFound
@@ -432,15 +428,14 @@ instance
433 HasServer (Post ctypes ()) where
429 HasServer (Post ctypes ()) where
435− type ServerT' (Post ctypes ()) m = m ()
431+ type ServerT (Post ctypes ()) m = m ()
437 route Proxy action request respond
433 route Proxy action request respond
438 | pathIsEmpty request && requestMethod request == methodPost = do
434 | pathIsEmpty request && requestMethod request == methodPost = do
439 e <- runEitherT action
435 e <- runEitherT action
440 respond . succeedWith $ case e of
436 respond . succeedWith $ case e of
441 Right () -> responseLBS noContent204 [] ""
437 Right () -> responseLBS noContent204 [] ""
442− Left (status, message) ->
438+ Left err -> responseServantErr err
443− responseLBS (mkStatus status (cs message)) [] (cs message)
444 | pathIsEmpty request && requestMethod request /= methodPost =
439 | pathIsEmpty request && requestMethod request /= methodPost =
445 respond $ failWith WrongMethod
440 respond $ failWith WrongMethod
446 | otherwise = respond $ failWith NotFound
441 | otherwise = respond $ failWith NotFound
@@ -450,9 +445,10 @@ instance
450#if MIN_VERSION_base(4,8,0)
445#if MIN_VERSION_base(4,8,0)
451 {-# OVERLAPPING #-}
446 {-# OVERLAPPING #-}
448+ ( GetHeaders (Headers h v), AllCTRender ctypes v
453− ( AllCTRender ctypes v ) => HasServer (Post ctypes (Headers h v)) where
449+ ) => HasServer (Post ctypes (Headers h v)) where
455− type ServerT' (Post ctypes (Headers h v)) m = m (Headers h v)
451+ type ServerT (Post ctypes (Headers h v)) m = m (Headers h v)
457 route Proxy action request respond
453 route Proxy action request respond
458 | pathIsEmpty request && requestMethod request == methodPost = do
454 | pathIsEmpty request && requestMethod request == methodPost = do
@@ -465,8 +461,7 @@ instance
465 Nothing -> failWith UnsupportedMediaType
461 Nothing -> failWith UnsupportedMediaType
466 Just (contentT, body) -> succeedWith $
462 Just (contentT, body) -> succeedWith $
467 responseLBS status201 ( ("Content-Type" , cs contentT) : headers) body
463 responseLBS status201 ( ("Content-Type" , cs contentT) : headers) body
468− Left (status, message) -> succeedWith $
464+ Left err -> succeedWith $ responseServantErr err
469− responseLBS (mkStatus status (cs message)) [] (cs message)
470 | pathIsEmpty request && requestMethod request /= methodPost =
465 | pathIsEmpty request && requestMethod request /= methodPost =
471 respond $ failWith WrongMethod
466 respond $ failWith WrongMethod
472 | otherwise = respond $ failWith NotFound
467 | otherwise = respond $ failWith NotFound
@@ -490,7 +485,7 @@ instance
491 ( AllCTRender ctypes a) => HasServer (Put ctypes a) where
486 ( AllCTRender ctypes a) => HasServer (Put ctypes a) where
493− type ServerT' (Put ctypes a) m = m a
488+ type ServerT (Put ctypes a) m = m a
495 route Proxy action request respond
490 route Proxy action request respond
496 | pathIsEmpty request && requestMethod request == methodPut = do
491 | pathIsEmpty request && requestMethod request == methodPut = do
@@ -502,8 +497,7 @@ instance
502 Nothing -> failWith UnsupportedMediaType
497 Nothing -> failWith UnsupportedMediaType
503 Just (contentT, body) -> succeedWith $
498 Just (contentT, body) -> succeedWith $
504 responseLBS status200 [ ("Content-Type" , cs contentT)] body
499 responseLBS status200 [ ("Content-Type" , cs contentT)] body
505− Left (status, message) -> succeedWith $
500+ Left err -> succeedWith $ responseServantErr err
506− responseLBS (mkStatus status (cs message)) [] (cs message)
507 | pathIsEmpty request && requestMethod request /= methodPut =
501 | pathIsEmpty request && requestMethod request /= methodPut =
508 respond $ failWith WrongMethod
502 respond $ failWith WrongMethod
509 | otherwise = respond $ failWith NotFound
503 | otherwise = respond $ failWith NotFound
@@ -514,15 +508,14 @@ instance
515 HasServer (Put ctypes ()) where
509 HasServer (Put ctypes ()) where
517− type ServerT' (Put ctypes ()) m = m ()
511+ type ServerT (Put ctypes ()) m = m ()
519 route Proxy action request respond
513 route Proxy action request respond
520 | pathIsEmpty request && requestMethod request == methodPut = do
514 | pathIsEmpty request && requestMethod request == methodPut = do
521 e <- runEitherT action
515 e <- runEitherT action
522 respond . succeedWith $ case e of
516 respond . succeedWith $ case e of
523 Right () -> responseLBS noContent204 [] ""
517 Right () -> responseLBS noContent204 [] ""
524− Left (status, message) ->
518+ Left err -> responseServantErr err
525− responseLBS (mkStatus status (cs message)) [] (cs message)
526 | pathIsEmpty request && requestMethod request /= methodPut =
519 | pathIsEmpty request && requestMethod request /= methodPut =
527 respond $ failWith WrongMethod
520 respond $ failWith WrongMethod
528 | otherwise = respond $ failWith NotFound
521 | otherwise = respond $ failWith NotFound
@@ -532,9 +525,10 @@ instance
532#if MIN_VERSION_base(4,8,0)
525#if MIN_VERSION_base(4,8,0)
533 {-# OVERLAPPING #-}
526 {-# OVERLAPPING #-}
528+ ( GetHeaders (Headers h v), AllCTRender ctypes v
535− ( AllCTRender ctypes v ) => HasServer (Put ctypes (Headers h v)) where
529+ ) => HasServer (Put ctypes (Headers h v)) where
537− type ServerT' (Put ctypes (Headers h v)) m = m (Headers h v)
531+ type ServerT (Put ctypes (Headers h v)) m = m (Headers h v)
539 route Proxy action request respond
533 route Proxy action request respond
540 | pathIsEmpty request && requestMethod request == methodPut = do
534 | pathIsEmpty request && requestMethod request == methodPut = do
@@ -547,8 +541,7 @@ instance
547 Nothing -> failWith UnsupportedMediaType
541 Nothing -> failWith UnsupportedMediaType
548 Just (contentT, body) -> succeedWith $
542 Just (contentT, body) -> succeedWith $
549 responseLBS status200 ( ("Content-Type" , cs contentT) : headers) body
543 responseLBS status200 ( ("Content-Type" , cs contentT) : headers) body
550− Left (status, message) -> succeedWith $
544+ Left err -> succeedWith $ responseServantErr err
551− responseLBS (mkStatus status (cs message)) [] (cs message)
552 | pathIsEmpty request && requestMethod request /= methodPut =
545 | pathIsEmpty request && requestMethod request /= methodPut =
553 respond $ failWith WrongMethod
546 respond $ failWith WrongMethod
554 | otherwise = respond $ failWith NotFound
547 | otherwise = respond $ failWith NotFound
@@ -570,7 +563,7 @@ instance
571 ( AllCTRender ctypes a) => HasServer (Patch ctypes a) where
564 ( AllCTRender ctypes a) => HasServer (Patch ctypes a) where
573− type ServerT' (Patch ctypes a) m = m a
566+ type ServerT (Patch ctypes a) m = m a
575 route Proxy action request respond
568 route Proxy action request respond
576 | pathIsEmpty request && requestMethod request == methodPatch = do
569 | pathIsEmpty request && requestMethod request == methodPatch = do
@@ -582,8 +575,7 @@ instance
582 Nothing -> failWith UnsupportedMediaType
575 Nothing -> failWith UnsupportedMediaType
583 Just (contentT, body) -> succeedWith $
576 Just (contentT, body) -> succeedWith $
584 responseLBS status200 [ ("Content-Type" , cs contentT)] body
577 responseLBS status200 [ ("Content-Type" , cs contentT)] body
585− Left (status, message) -> succeedWith $
578+ Left err -> succeedWith $ responseServantErr err
586− responseLBS (mkStatus status (cs message)) [] (cs message)
587 | pathIsEmpty request && requestMethod request /= methodPatch =
579 | pathIsEmpty request && requestMethod request /= methodPatch =
588 respond $ failWith WrongMethod
580 respond $ failWith WrongMethod
589 | otherwise = respond $ failWith NotFound
581 | otherwise = respond $ failWith NotFound
@@ -594,15 +586,14 @@ instance
595 HasServer (Patch ctypes ()) where
587 HasServer (Patch ctypes ()) where
597− type ServerT' (Patch ctypes ()) m = m ()
589+ type ServerT (Patch ctypes ()) m = m ()
599 route Proxy action request respond
591 route Proxy action request respond
600 | pathIsEmpty request && requestMethod request == methodPatch = do
592 | pathIsEmpty request && requestMethod request == methodPatch = do
601 e <- runEitherT action
593 e <- runEitherT action
602 respond . succeedWith $ case e of
594 respond . succeedWith $ case e of
603 Right () -> responseLBS noContent204 [] ""
595 Right () -> responseLBS noContent204 [] ""
604− Left (status, message) ->
596+ Left err -> responseServantErr err
605− responseLBS (mkStatus status (cs message)) [] (cs message)
606 | pathIsEmpty request && requestMethod request /= methodPatch =
597 | pathIsEmpty request && requestMethod request /= methodPatch =
607 respond $ failWith WrongMethod
598 respond $ failWith WrongMethod
608 | otherwise = respond $ failWith NotFound
599 | otherwise = respond $ failWith NotFound
@@ -612,9 +603,10 @@ instance
612#if MIN_VERSION_base(4,8,0)
603#if MIN_VERSION_base(4,8,0)
613 {-# OVERLAPPING #-}
604 {-# OVERLAPPING #-}
606+ ( GetHeaders (Headers h v), AllCTRender ctypes v
615− ( AllCTRender ctypes v ) => HasServer (Patch ctypes (Headers h v)) where
607+ ) => HasServer (Patch ctypes (Headers h v)) where
617− type ServerT' (Patch ctypes (Headers h v)) m = m (Headers h v)
609+ type ServerT (Patch ctypes (Headers h v)) m = m (Headers h v)
619 route Proxy action request respond
611 route Proxy action request respond
620 | pathIsEmpty request && requestMethod request == methodPatch = do
612 | pathIsEmpty request && requestMethod request == methodPatch = do
@@ -627,8 +619,7 @@ instance
627 Nothing -> failWith UnsupportedMediaType
619 Nothing -> failWith UnsupportedMediaType
628 Just (contentT, body) -> succeedWith $
620 Just (contentT, body) -> succeedWith $
629 responseLBS status200 ( ("Content-Type" , cs contentT) : headers) body
621 responseLBS status200 ( ("Content-Type" , cs contentT) : headers) body
630− Left (status, message) -> succeedWith $
622+ Left err -> succeedWith $ responseServantErr err
631− responseLBS (mkStatus status (cs message)) [] (cs message)
632 | pathIsEmpty request && requestMethod request /= methodPatch =
623 | pathIsEmpty request && requestMethod request /= methodPatch =
633 respond $ failWith WrongMethod
624 respond $ failWith WrongMethod
634 | otherwise = respond $ failWith NotFound
625 | otherwise = respond $ failWith NotFound
@@ -657,8 +648,8 @@ instance
657instance (KnownSymbol sym, FromText a, HasServer sublayout)
648instance (KnownSymbol sym, FromText a, HasServer sublayout)
658 => HasServer (QueryParam sym a :> sublayout) where
649 => HasServer (QueryParam sym a :> sublayout) where
660− type ServerT' (QueryParam sym a :> sublayout) m =
651+ type ServerT (QueryParam sym a :> sublayout) m =
661− Maybe a -> ServerT' sublayout m
652+ Maybe a -> ServerT sublayout m
663 route Proxy subserver request respond = do
654 route Proxy subserver request respond = do
664 let querytext = parseQueryText $ rawQueryString request
655 let querytext = parseQueryText $ rawQueryString request
@@ -695,8 +686,8 @@ instance (KnownSymbol sym, FromText a, HasServer sublayout)
695instance (KnownSymbol sym, FromText a, HasServer sublayout)
686instance (KnownSymbol sym, FromText a, HasServer sublayout)
696 => HasServer (QueryParams sym a :> sublayout) where
687 => HasServer (QueryParams sym a :> sublayout) where
698− type ServerT' (QueryParams sym a :> sublayout) m =
689+ type ServerT (QueryParams sym a :> sublayout) m =
699− [a] -> ServerT' sublayout m
690+ [a] -> ServerT sublayout m
701 route Proxy subserver request respond = do
692 route Proxy subserver request respond = do
702 let querytext = parseQueryText $ rawQueryString request
693 let querytext = parseQueryText $ rawQueryString request
@@ -728,8 +719,8 @@ instance (KnownSymbol sym, FromText a, HasServer sublayout)
728instance (KnownSymbol sym, HasServer sublayout)
719instance (KnownSymbol sym, HasServer sublayout)
729 => HasServer (QueryFlag sym :> sublayout) where
720 => HasServer (QueryFlag sym :> sublayout) where
731− type ServerT' (QueryFlag sym :> sublayout) m =
722+ type ServerT (QueryFlag sym :> sublayout) m =
732− Bool -> ServerT' sublayout m
723+ Bool -> ServerT sublayout m
734 route Proxy subserver request respond = do
725 route Proxy subserver request respond = do
735 let querytext = parseQueryText $ rawQueryString request
726 let querytext = parseQueryText $ rawQueryString request
@@ -771,8 +762,8 @@ parseMatrixText = parseQueryText
771instance (KnownSymbol sym, FromText a, HasServer sublayout)
762instance (KnownSymbol sym, FromText a, HasServer sublayout)
772 => HasServer (MatrixParam sym a :> sublayout) where
763 => HasServer (MatrixParam sym a :> sublayout) where
774− type ServerT' (MatrixParam sym a :> sublayout) m =
765+ type ServerT (MatrixParam sym a :> sublayout) m =
775− Maybe a -> ServerT' sublayout m
766+ Maybe a -> ServerT sublayout m
777 route Proxy subserver request respond = case parsePathInfo request of
768 route Proxy subserver request respond = case parsePathInfo request of
778 (first : _)
769 (first : _)
@@ -809,8 +800,8 @@ instance (KnownSymbol sym, FromText a, HasServer sublayout)
809instance (KnownSymbol sym, FromText a, HasServer sublayout)
800instance (KnownSymbol sym, FromText a, HasServer sublayout)
810 => HasServer (MatrixParams sym a :> sublayout) where
801 => HasServer (MatrixParams sym a :> sublayout) where
812− type ServerT' (MatrixParams sym a :> sublayout) m =
803+ type ServerT (MatrixParams sym a :> sublayout) m =
813− [a] -> ServerT' sublayout m
804+ [a] -> ServerT sublayout m
815 route Proxy subserver request respond = case parsePathInfo request of
806 route Proxy subserver request respond = case parsePathInfo request of
816 (first : _)
807 (first : _)
@@ -843,8 +834,8 @@ instance (KnownSymbol sym, FromText a, HasServer sublayout)
843instance (KnownSymbol sym, HasServer sublayout)
834instance (KnownSymbol sym, HasServer sublayout)
844 => HasServer (MatrixFlag sym :> sublayout) where
835 => HasServer (MatrixFlag sym :> sublayout) where
846− type ServerT' (MatrixFlag sym :> sublayout) m =
837+ type ServerT (MatrixFlag sym :> sublayout) m =
847− Bool -> ServerT' sublayout m
838+ Bool -> ServerT sublayout m
849 route Proxy subserver request respond = case parsePathInfo request of
840 route Proxy subserver request respond = case parsePathInfo request of
850 (first : _)
841 (first : _)
@@ -872,7 +863,7 @@ instance (KnownSymbol sym, HasServer sublayout)
872-- > server = serveDirectory "/var/www/images"
863-- > server = serveDirectory "/var/www/images"
873instance HasServer Raw where
864instance HasServer Raw where
875− type ServerT' Raw m = Application
866+ type ServerT Raw m = Application
877 route Proxy rawApplication request respond =
868 route Proxy rawApplication request respond =
878 rawApplication request (respond . succeedWith)
869 rawApplication request (respond . succeedWith)
@@ -900,8 +891,8 @@ instance HasServer Raw where
900instance ( AllCTUnrender list a, HasServer sublayout
891instance ( AllCTUnrender list a, HasServer sublayout
901 ) => HasServer (ReqBody list a :> sublayout) where
892 ) => HasServer (ReqBody list a :> sublayout) where
903− type ServerT' (ReqBody list a :> sublayout) m =
894+ type ServerT (ReqBody list a :> sublayout) m =
904− a -> ServerT' sublayout m
895+ a -> ServerT sublayout m
906 route Proxy subserver request respond = do
897 route Proxy subserver request respond = do
907 -- See HTTP RFC 2616, section 7.2.1
898 -- See HTTP RFC 2616, section 7.2.1
@@ -921,7 +912,7 @@ instance ( AllCTUnrender list a, HasServer sublayout
921-- pass the rest of the request path to @sublayout@.
912-- pass the rest of the request path to @sublayout@.
922instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout) where
913instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout) where
924− type ServerT' (path :> sublayout) m = ServerT' sublayout m
915+ type ServerT (path :> sublayout) m = ServerT sublayout m
926 route Proxy subserver request respond = case processedPathInfo request of
917 route Proxy subserver request respond = case processedPathInfo request of
927 (first : rest)
918 (first : rest)