module Yesod.Core.Unsafe (runFakeHandler, fakeHandlerGetLogger) where
import Yesod.Core.Internal.Run (runFakeHandler)
import Yesod.Core.Types
import Yesod.Core.Class.Yesod
import Control.Monad.IO.Class (MonadIO)
fakeHandlerGetLogger :: (Yesod site, MonadIO m)
=> (site -> Logger)
-> site
-> HandlerFor site a
-> m a
fakeHandlerGetLogger :: forall site (m :: * -> *) a.
(Yesod site, MonadIO m) =>
(site -> Logger) -> site -> HandlerFor site a -> m a
fakeHandlerGetLogger site -> Logger
getLogger site
app HandlerFor site a
f =
forall site (m :: * -> *) a.
(Yesod site, MonadIO m) =>
SessionMap
-> (site -> Logger)
-> site
-> HandlerFor site a
-> m (Either ErrorResponse a)
runFakeHandler forall a. Monoid a => a
mempty site -> Logger
getLogger site
app HandlerFor site a
f
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (forall a. HasCallStack => [Char] -> a
error forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Char]
"runFakeHandler issue: " forall a. Monoid a => a -> a -> a
`mappend`) forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Show a => a -> [Char]
show)
forall (m :: * -> *) a. Monad m => a -> m a
return