packages feed

wai-routes 0.3.3 → 0.3.4

raw patch · 5 files changed

+20/−13 lines, 5 files

Files

README.md view
@@ -1,4 +1,4 @@-Wai Routes (wai-routes-0.3.3)+Wai Routes (wai-routes-0.3.4) ==============================  [![Build Status](https://travis-ci.org/ajnsit/wai-routes.png)](https://travis-ci.org/ajnsit/wai-routes)@@ -79,4 +79,5 @@ * 0.3.1 : Removed internal 'App' synonym which only muddied the types. Added common content types for convenience. * 0.3.2 : Added HandlerM Monad which makes it easier to build Handlers * 0.3.3 : Better exports from the Network.Wai.Middleware.Routes module+* 0.3.4 : Added 'liftResourceT' to lift a ResourceT into HandlerM 
examples/Example.hs view
@@ -37,7 +37,7 @@ /user/#Int    UserR:     /              UserRootR   GET     /delete        UserDeleteR GET POST-/skip        SkipR             GET+/skip/*[Text] SkipR             GET |]  @@ -63,7 +63,7 @@                  ,("links"                   ,[["home",  showRoute HomeR]                    ,["users", showRoute UsersR]-                   ,["skip",  showRoute SkipR]+                   ,["skip",  showRoute $ SkipR []]                    ]                   )                  ] :: [(Text, [[Text]])] )@@ -117,8 +117,8 @@   where err = ["DELETE","not implemented"]::[Text]  -- Demonstrate skipping routes-getSkipR :: Handler MyRoute-getSkipR = runHandlerM next+getSkipR :: [Text] -> Handler MyRoute+getSkipR _ = runHandlerM next  -- Initial database initdb :: [User]@@ -130,14 +130,14 @@ -- A new middleware to catch all skipped routes data MySkippedRoute = MySkippedRoute --- Make MyRoute Routable+-- Catch all 'skipped` routes mkRoute "MySkippedRoute" [parseRoutes|-/skip         SkippedR          GET+/skip/*[Text]  SkippedR  GET |] -getSkippedR :: Handler MySkippedRoute-getSkippedR = runHandlerM $ return $ jsonOut err-  where err = ["SKIPPED","skipped route"]::[Text]+getSkippedR :: [Text] -> Handler MySkippedRoute+getSkippedR rest = runHandlerM $ return $ jsonOut err+  where err = ["SKIPPED ROUTE: "] ++ rest  -- The application that uses our route -- NOTE: We use the Route Monad to simplify routing
src/Network/Wai/Middleware/Routes.hs view
@@ -51,6 +51,7 @@     -- * HandlerM Monad makes it easy to build a handler     , HandlerM()     , runHandlerM            -- | Run a HandlerM to get a Handler+    , liftResourceT          -- | Lift a ResourceT into HandlerM     , request                -- | Access the request data     , master                 -- | Access the master datatype     , next                   -- | Run the next application in the stack
src/Network/Wai/Middleware/Routes/Handler.hs view
@@ -13,6 +13,7 @@ module Network.Wai.Middleware.Routes.Handler     ( HandlerM()             -- | A Monad that makes it easier to build a Handler     , runHandlerM            -- | Run a HandlerM to get a Handler+    , liftResourceT          -- | Lift a ResourceT into HandlerM     , request                -- | Access the request data     , master                 -- | Access the master datatype     , next                   -- | Run the next application in the stack@@ -28,6 +29,10 @@ -- | The HandlerM Monad newtype HandlerM master a = H { extractH :: ReaderT (HandlerState master) (ResourceT IO) a }     deriving (Monad, MonadIO, Functor, MonadReader (HandlerState master))++-- | Lift a ResourceT into HandlerM+liftResourceT :: ResourceT IO a -> HandlerM master a+liftResourceT = H . lift  -- | The state kept in a HandlerM Monad data HandlerState master = HandlerState
wai-routes.cabal view
@@ -1,5 +1,5 @@ Name:                wai-routes-Version:             0.3.3+Version:             0.3.4 Synopsis:            Typesafe URLs for Wai applications. Homepage:            https://github.com/ajnsit/wai-routes License:             MIT@@ -63,8 +63,8 @@  source-repository this   type:     git-  location: http://github.com/ajnsit/wai-routes/tree/v0.3.3-  tag:      v0.3.3+  location: http://github.com/ajnsit/wai-routes/tree/v0.3.4+  tag:      v0.3.4  Library   hs-source-dirs:    src