This commit is contained in:
Sönke Hahn 2017-05-19 13:38:45 -04:00
parent 72a5ec61ba
commit 9cd47d0ebf
2 changed files with 8 additions and 3 deletions

View file

@ -28,7 +28,7 @@ type RoutingApplication =
Request -- ^ the request, the field 'pathInfo' may be modified by url routing Request -- ^ the request, the field 'pathInfo' may be modified by url routing
-> (RouteResult Response -> IO ResponseReceived) -> IO ResponseReceived -> (RouteResult Response -> IO ResponseReceived) -> IO ResponseReceived
-- | The result of matching against a path in the route tree. -- | The result of running an endpoint handler. On success this will contains an @a@.
data RouteResult a = data RouteResult a =
Fail ServantErr -- ^ Keep trying other paths. The @ServantErr@ Fail ServantErr -- ^ Keep trying other paths. The @ServantErr@
-- should only be 404, 405 or 406. -- should only be 404, 405 or 406.

View file

@ -89,8 +89,13 @@ runServerCombinator (CI i) = i
-- the endpoint handler will not be called. -- the endpoint handler will not be called.
-- --
-- >>> :set -XTypeFamilies -- >>> :set -XTypeFamilies
-- >>> :set -XTypeOperators
-- >>> :set -XFlexibleInstances
-- >>> :set -XMultiParamTypeClasses
-- >>> :set -Wno-missing-methods
-- >>> import Text.Read
-- >>> import Data.String.Conversions
-- >>> :{ -- >>> :{
-- import Text.Read
-- data MyCaptureCombinator -- data MyCaptureCombinator
-- instance HasServer api context => HasServer (MyCaptureCombinator :> api) context where -- instance HasServer api context => HasServer (MyCaptureCombinator :> api) context where
-- type ServerT (MyCaptureCombinator :> api) m = Int -> ServerT api m -- type ServerT (MyCaptureCombinator :> api) m = Int -> ServerT api m
@ -175,7 +180,7 @@ makeAuthCombinator = inner
-- | 'makeCombinator' allows you to write combinators that have access to the whole request -- | 'makeCombinator' allows you to write combinators that have access to the whole request
-- (including the request body) while providing an additional argument to the endpoint handler. -- (including the request body) while providing an additional argument to the endpoint handler.
-- This includes writing combinators that allow you to stream the request body. Here's a simple -- This includes writing combinators that allow you to stream the request body. Here's a simple
-- example for that using a very simple stream implementation 'Source': -- example for that using a very simple stream implementation @Source@:
-- --
-- >>> import Data.ByteString -- >>> import Data.ByteString
-- >>> :{ -- >>> :{