stop the module import cycle

This commit is contained in:
Andrew Martin 2015-06-05 13:20:03 -04:00
parent 92aa58dee5
commit b88295cf05
5 changed files with 25 additions and 22 deletions

View File

@ -11,9 +11,9 @@ import Yesod.Routes.Class
import qualified Network.Wai as W
import Yesod.Core.Types
import Yesod.Core.Content
import Yesod.Core.Handler (stripHandlerT)
import Yesod.Core.Class.Yesod
import Yesod.Core.Class.Handler
import Yesod.Core.Internal.Run
-- | This class is automatically instantiated when you use the template haskell
-- mkYesod function. You should never need to deal with it directly.
@ -31,7 +31,8 @@ instance YesodSubDispatch WaiSubsite master where
WaiSubsite app = ysreGetSub $ yreSite $ ysreParentEnv
-- | A helper function for creating YesodSubDispatch instances, used by the
-- internal generated code.
-- internal generated code. This function has been exported since 1.4.11.
-- It promotes a subsite handler to a wai application.
subHelper :: Monad m -- NOTE: This is incredibly similar in type signature to yesodRunner, should probably be pointed out/explained.
=> HandlerT child (HandlerT parent m) TypedContent
-> YesodSubRunnerEnv child parent (HandlerT parent m)

View File

@ -30,7 +30,7 @@ module Yesod.Core.Dispatch
, defaultMiddlewaresNoLogging
-- * WAI subsites
, WaiSubsite (..)
, subHelper
, module YCCD
) where
import Prelude hiding (exp)
@ -70,7 +70,7 @@ import Control.Monad (when)
import qualified Paths_yesod_core
import Data.Version (showVersion)
import qualified System.Random.MWC as MWC
import Yesod.Core.Class.Dispatch (subHelper)
import Yesod.Core.Class.Dispatch as YCCD (subHelper)
-- | Convert the given argument into a WAI application, executable with any WAI
-- handler. This function will provide no middlewares; if you want commonly

View File

@ -218,7 +218,6 @@ import Data.Conduit (Source, transPipe, Flush (Flush), yield, Producer
)
import qualified Yesod.Core.TypeCache as Cache
import qualified Data.Word8 as W8
import Yesod.Core.Internal.Run (stripHandlerT)
get :: MonadHandler m => m GHState
get = liftHandlerT $ HandlerT $ I.readIORef . handlerState
@ -1240,3 +1239,22 @@ sendChunkLazyText = sendChunk
-- Since 1.2.0
sendChunkHtml :: Monad m => Html -> Producer m (Flush Builder)
sendChunkHtml = sendChunk
-- | Converts a child handler to a parent handler
--
-- Exported since 1.4.11
stripHandlerT :: HandlerT child (HandlerT parent m) a
-> (parent -> child)
-> (Route child -> Route parent)
-> Maybe (Route child)
-> HandlerT parent m a
stripHandlerT (HandlerT f) getSub toMaster newRoute = HandlerT $ \hd -> do
let env = handlerEnv hd
($ hd) $ unHandlerT $ f hd
{ handlerEnv = env
{ rheSite = getSub $ rheSite env
, rheRoute = newRoute
, rheRender = \url params -> rheRender env (toMaster url) params
}
, handlerToParent = toMaster
}

View File

@ -320,19 +320,3 @@ resolveApproot master req =
ApprootStatic t -> t
ApprootMaster f -> f master
ApprootRequest f -> f master req
stripHandlerT :: HandlerT child (HandlerT parent m) a
-> (parent -> child)
-> (Route child -> Route parent)
-> Maybe (Route child)
-> HandlerT parent m a
stripHandlerT (HandlerT f) getSub toMaster newRoute = HandlerT $ \hd -> do
let env = handlerEnv hd
($ hd) $ unHandlerT $ f hd
{ handlerEnv = env
{ rheSite = getSub $ rheSite env
, rheRoute = newRoute
, rheRender = \url params -> rheRender env (toMaster url) params
}
, handlerToParent = toMaster
}

View File

@ -1,5 +1,5 @@
name: yesod-core
version: 1.4.10
version: 1.4.11
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>