Skip to content

Commit

Permalink
Merge pull request #1042 from yesodweb/add_getsYesod_function
Browse files Browse the repository at this point in the history
Added getsYesod
  • Loading branch information
andrewthad committed Jul 23, 2015
2 parents 81c996f + c4d154b commit 4865702
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions yesod-core/Yesod/Core/Handler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module Yesod.Core.Handler
HandlerT
-- ** Read information from handler
, getYesod
, getsYesod
, getUrlRender
, getUrlRenderParams
, getCurrentRoute
Expand Down Expand Up @@ -291,6 +292,11 @@ askHandlerEnv = liftHandlerT $ HandlerT $ return . handlerEnv
getYesod :: MonadHandler m => m (HandlerSite m)
getYesod = rheSite `liftM` askHandlerEnv

-- | Get a specific component of the master site application argument.
-- Analogous to the 'gets' function for operating on 'StateT'.
getsYesod :: MonadHandler m => (HandlerSite m -> a) -> m a
getsYesod f = (f . rheSite) `liftM` askHandlerEnv

-- | Get the URL rendering function.
getUrlRender :: MonadHandler m => m (Route (HandlerSite m) -> Text)
getUrlRender = do
Expand Down

0 comments on commit 4865702

Please sign in to comment.