    {-# LANGUAGE DeriveFunctor #-}
    {-# LANGUAGE DeriveGeneric #-}
    {-# LANGUAGE FlexibleInstances #-}
    {-# LANGUAGE GADTs #-}
    {-# LANGUAGE GeneralizedNewtypeDeriving #-}
    {-# LANGUAGE MultiParamTypeClasses #-}
    {-# LANGUAGE RankNTypes #-}
    {-# LANGUAGE TypeFamilies #-}
    {-# LANGUAGE TypeOperators #-}
    {-# LANGUAGE UndecidableInstances #-}

    module Yesod.Core.Types where

    import Data.Aeson (ToJSON)
    import qualified Data.ByteString.Builder            as BB
    import           Control.Arrow                      (first)
    import           Control.Exception                  (Exception)
    import           Control.Monad                      (ap)
    import           Control.Monad.IO.Class             (MonadIO (liftIO))
    import           Control.Monad.Logger               (LogLevel, LogSource,
                                                         MonadLogger (..))
    import           Control.Monad.Primitive            (PrimMonad (..))
    import           Control.Monad.Trans.Resource       (MonadResource (..), InternalState, runInternalState, MonadThrow (..), ResourceT)
    import           Data.ByteString                    (ByteString)
    import qualified Data.ByteString.Lazy               as L
    import           Data.CaseInsensitive               (CI)
    import           Data.Conduit                       (Flush, ConduitT)
    import           Data.IORef                         (IORef, modifyIORef')
    import           Data.Map                           (Map, unionWith)
    import qualified Data.Map                           as Map
    import           Data.Monoid                        (Endo (..), Last (..))
    import           Data.Serialize                     (Serialize (..),
                                                         putByteString)
    import           Data.String                        (IsString (fromString))
    import           Data.Text                          (Text)
    import qualified Data.Text                          as T
    import qualified Data.Text.Lazy.Builder             as TBuilder
    import           Data.Time                          (UTCTime)
    import           GHC.Generics                       (Generic)
    import           Language.Haskell.TH.Syntax         (Loc)
    import qualified Network.HTTP.Types                 as H
    import           Network.Wai                        (FilePart,
                                                         RequestBodyLength)
    import qualified Network.Wai                        as W
    import qualified Network.Wai.Parse                  as NWP
    import           System.Log.FastLogger              (LogStr, LoggerSet, toLogStr, pushLogStr)
    import           Network.Wai.Logger                 (DateCacheGetter)
    import           Text.Blaze.Html                    (Html, toHtml)
    import           Text.Hamlet                        (HtmlUrl)
    import           Text.Julius                        (JavascriptUrl)
    import           Web.Cookie                         (SetCookie)
    import           Yesod.Core.Internal.Util           (getTime, putTime)
    import           Yesod.Routes.Class                 (RenderRoute (..), ParseRoute (..))
    import           Control.Monad.Reader               (MonadReader (..))
    import Control.DeepSeq (NFData (rnf))
    import Yesod.Core.TypeCache (TypeMap, KeyedTypeMap)
    import Control.Monad.Logger (MonadLoggerIO (..))
    import UnliftIO (MonadUnliftIO (..), SomeException)

    -- Sessions
    type SessionMap = Map Text ByteString

    type SaveSession = SessionMap -- ^ The session contents after running the handler
                    -> IO [Header]

    newtype SessionBackend = SessionBackend
        { SessionBackend -> Request -> IO (SessionMap, SaveSession)
    sbLoadSession :: W.Request
                        -> IO (SessionMap, SaveSession) -- ^ Return the session data and a function to save the session
        }

    data SessionCookie = SessionCookie !(Either UTCTime ByteString) !ByteString !SessionMap
        deriving (Int -> SessionCookie -> ShowS
    [SessionCookie] -> ShowS
    SessionCookie -> String
    (Int -> SessionCookie -> ShowS)
    -> (SessionCookie -> String)
    -> ([SessionCookie] -> ShowS)
    -> Show SessionCookie
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SessionCookie -> ShowS
    showsPrec :: Int -> SessionCookie -> ShowS
    $cshow :: SessionCookie -> String
    show :: SessionCookie -> String
    $cshowList :: [SessionCookie] -> ShowS
    showList :: [SessionCookie] -> ShowS
    Show, ReadPrec [SessionCookie]
    ReadPrec SessionCookie
    Int -> ReadS SessionCookie
    ReadS [SessionCookie]
    (Int -> ReadS SessionCookie)
    -> ReadS [SessionCookie]
    -> ReadPrec SessionCookie
    -> ReadPrec [SessionCookie]
    -> Read SessionCookie
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS SessionCookie
    readsPrec :: Int -> ReadS SessionCookie
    $creadList :: ReadS [SessionCookie]
    readList :: ReadS [SessionCookie]
    $creadPrec :: ReadPrec SessionCookie
    readPrec :: ReadPrec SessionCookie
    $creadListPrec :: ReadPrec [SessionCookie]
    readListPrec :: ReadPrec [SessionCookie]
    Read)
    instance Serialize SessionCookie where
        put :: Putter SessionCookie
    put (SessionCookie Either UTCTime ByteString
    a ByteString
    b SessionMap
    c) = do
            (UTCTime -> PutM ())
    -> (ByteString -> PutM ()) -> Either UTCTime ByteString -> PutM ()
    forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
    either UTCTime -> PutM ()
    putTime ByteString -> PutM ()
    putByteString Either UTCTime ByteString
    a
            ByteString -> PutM ()
    forall t. Serialize t => Putter t
    put ByteString
    b
            Putter [(String, ByteString)]
    forall t. Serialize t => Putter t
    put (((Text, ByteString) -> (String, ByteString))
    -> [(Text, ByteString)] -> [(String, ByteString)]
    forall a b. (a -> b) -> [a] -> [b]
    map ((Text -> String) -> (Text, ByteString) -> (String, ByteString)
    forall b c d. (b -> c) -> (b, d) -> (c, d)
    forall (a :: * -> * -> *) b c d.
    Arrow a =>
    a b c -> a (b, d) (c, d)
    first Text -> String
    T.unpack) ([(Text, ByteString)] -> [(String, ByteString)])
    -> [(Text, ByteString)] -> [(String, ByteString)]
    forall a b. (a -> b) -> a -> b
    $ SessionMap -> [(Text, ByteString)]
    forall k a. Map k a -> [(k, a)]
    Map.toList SessionMap
    c)

        get :: Get SessionCookie
    get = do
            a <- Get UTCTime
    getTime
            b <- get
            c <- map (first T.pack) <$> get
            return $ SessionCookie (Left a) b (Map.fromList c)

    data ClientSessionDateCache =
      ClientSessionDateCache {
        ClientSessionDateCache -> UTCTime
    csdcNow               :: !UTCTime
      , ClientSessionDateCache -> UTCTime
    csdcExpires           :: !UTCTime
      , ClientSessionDateCache -> ByteString
    csdcExpiresSerialized :: !ByteString
      } deriving (ClientSessionDateCache -> ClientSessionDateCache -> Bool
    (ClientSessionDateCache -> ClientSessionDateCache -> Bool)
    -> (ClientSessionDateCache -> ClientSessionDateCache -> Bool)
    -> Eq ClientSessionDateCache
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ClientSessionDateCache -> ClientSessionDateCache -> Bool
    == :: ClientSessionDateCache -> ClientSessionDateCache -> Bool
    $c/= :: ClientSessionDateCache -> ClientSessionDateCache -> Bool
    /= :: ClientSessionDateCache -> ClientSessionDateCache -> Bool
    Eq, Int -> ClientSessionDateCache -> ShowS
    [ClientSessionDateCache] -> ShowS
    ClientSessionDateCache -> String
    (Int -> ClientSessionDateCache -> ShowS)
    -> (ClientSessionDateCache -> String)
    -> ([ClientSessionDateCache] -> ShowS)
    -> Show ClientSessionDateCache
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ClientSessionDateCache -> ShowS
    showsPrec :: Int -> ClientSessionDateCache -> ShowS
    $cshow :: ClientSessionDateCache -> String
    show :: ClientSessionDateCache -> String
    $cshowList :: [ClientSessionDateCache] -> ShowS
    showList :: [ClientSessionDateCache] -> ShowS
    Show)

    -- | The parsed request information. This type augments the standard WAI
    -- 'W.Request' with additional information.
    data YesodRequest = YesodRequest
        { YesodRequest -> [(Text, Text)]
    reqGetParams  :: ![(Text, Text)]
          -- ^ Same as 'W.queryString', but decoded to @Text@.
        , YesodRequest -> [(Text, Text)]
    reqCookies    :: ![(Text, Text)]
        , YesodRequest -> Request
    reqWaiRequest :: !W.Request
        , YesodRequest -> [Text]
    reqLangs      :: ![Text]
          -- ^ Languages which the client supports. This is an ordered list by preference.
        , YesodRequest -> Maybe Text
    reqToken      :: !(Maybe Text)
          -- ^ A random, session-specific token used to prevent CSRF attacks.
        , YesodRequest -> SessionMap
    reqSession    :: !SessionMap
          -- ^ Initial session sent from the client.
          --
          -- Since 1.2.0
        , YesodRequest -> [ByteString]
    reqAccept     :: ![ContentType]
          -- ^ An ordered list of the accepted content types.
          --
          -- Since 1.2.0
        }

    -- | An augmented WAI 'W.Response'. This can either be a standard @Response@,
    -- or a higher-level data structure which Yesod will turn into a @Response@.
    data YesodResponse
        = YRWai !W.Response
        | YRWaiApp !W.Application
        | YRPlain !H.Status ![Header] !ContentType !Content !SessionMap

    -- | A tuple containing both the POST parameters and submitted files.
    type RequestBodyContents =
        ( [(Text, Text)]
        , [(Text, FileInfo)]
        )

    data FileInfo = FileInfo
        { FileInfo -> Text
    fileName        :: !Text
        , FileInfo -> Text
    fileContentType :: !Text
        , FileInfo -> ConduitT () ByteString (ResourceT IO) ()
    fileSourceRaw   :: !(ConduitT () ByteString (ResourceT IO) ())
        , FileInfo -> String -> IO ()
    fileMove        :: !(FilePath -> IO ())
        }

    data FileUpload = FileUploadMemory !(NWP.BackEnd L.ByteString)
                    | FileUploadDisk !(InternalState -> NWP.BackEnd FilePath)
                    | FileUploadSource !(NWP.BackEnd (ConduitT () ByteString (ResourceT IO) ()))

    -- | How to determine the root of the application for constructing URLs.
    --
    -- Note that future versions of Yesod may add new constructors without bumping
    -- the major version number. As a result, you should /not/ pattern match on
    -- @Approot@ values.
    data Approot master = ApprootRelative -- ^ No application root.
                        | ApprootStatic !Text
                        | ApprootMaster !(master -> Text)
                        | ApprootRequest !(master -> W.Request -> Text)

    type ResolvedApproot = Text

    data AuthResult = Authorized | AuthenticationRequired | Unauthorized !Text
        deriving (AuthResult -> AuthResult -> Bool
    (AuthResult -> AuthResult -> Bool)
    -> (AuthResult -> AuthResult -> Bool) -> Eq AuthResult
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: AuthResult -> AuthResult -> Bool
    == :: AuthResult -> AuthResult -> Bool
    $c/= :: AuthResult -> AuthResult -> Bool
    /= :: AuthResult -> AuthResult -> Bool
    Eq, Int -> AuthResult -> ShowS
    [AuthResult] -> ShowS
    AuthResult -> String
    (Int -> AuthResult -> ShowS)
    -> (AuthResult -> String)
    -> ([AuthResult] -> ShowS)
    -> Show AuthResult
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> AuthResult -> ShowS
    showsPrec :: Int -> AuthResult -> ShowS
    $cshow :: AuthResult -> String
    show :: AuthResult -> String
    $cshowList :: [AuthResult] -> ShowS
    showList :: [AuthResult] -> ShowS
    Show, ReadPrec [AuthResult]
    ReadPrec AuthResult
    Int -> ReadS AuthResult
    ReadS [AuthResult]
    (Int -> ReadS AuthResult)
    -> ReadS [AuthResult]
    -> ReadPrec AuthResult
    -> ReadPrec [AuthResult]
    -> Read AuthResult
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS AuthResult
    readsPrec :: Int -> ReadS AuthResult
    $creadList :: ReadS [AuthResult]
    readList :: ReadS [AuthResult]
    $creadPrec :: ReadPrec AuthResult
    readPrec :: ReadPrec AuthResult
    $creadListPrec :: ReadPrec [AuthResult]
    readListPrec :: ReadPrec [AuthResult]
    Read)

    data ScriptLoadPosition master
        = BottomOfBody
        | BottomOfHeadBlocking
        | BottomOfHeadAsync !(BottomOfHeadAsync master)

    type BottomOfHeadAsync master
           = [Text] -- ^ urls to load asynchronously
          -> Maybe (HtmlUrl (Route master)) -- ^ widget of js to run on async completion
          -> HtmlUrl (Route master) -- ^ widget to insert at the bottom of <head>

    type Texts = [Text]

    -- | Wrap up a normal WAI application as a Yesod subsite. Ignore parent site's middleware and isAuthorized.
    newtype WaiSubsite = WaiSubsite { WaiSubsite -> Application
    runWaiSubsite :: W.Application }

    -- | Like 'WaiSubsite', but applies parent site's middleware and isAuthorized.
    --
    -- @since 1.4.34
    newtype WaiSubsiteWithAuth = WaiSubsiteWithAuth { WaiSubsiteWithAuth -> Application
    runWaiSubsiteWithAuth :: W.Application }

    data RunHandlerEnv child site = RunHandlerEnv
        { forall child site.
    RunHandlerEnv child site -> Route site -> [(Text, Text)] -> Text
    rheRender   :: !(Route site -> [(Text, Text)] -> Text)
        , forall child site. RunHandlerEnv child site -> Maybe (Route child)
    rheRoute    :: !(Maybe (Route child))
        , forall child site.
    RunHandlerEnv child site -> Route child -> Route site
    rheRouteToMaster :: !(Route child -> Route site)
        , forall child site. RunHandlerEnv child site -> site
    rheSite     :: !site
        , forall child site. RunHandlerEnv child site -> child
    rheChild    :: !child
        , forall child site.
    RunHandlerEnv child site -> RequestBodyLength -> FileUpload
    rheUpload   :: !(RequestBodyLength -> FileUpload)
        , forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog      :: !(Loc -> LogSource -> LogLevel -> LogStr -> IO ())
        , forall child site.
    RunHandlerEnv child site -> ErrorResponse -> YesodApp
    rheOnError  :: !(ErrorResponse -> YesodApp)
          -- ^ How to respond when an error is thrown internally.
          --
          -- Since 1.2.0
        , forall child site. RunHandlerEnv child site -> Text
    rheMaxExpires :: !Text

          -- | @since 1.6.24.0
          --   catch function for rendering 500 pages on exceptions.
          --   by default this is catch from unliftio (rethrows all async exceptions).
        , forall child site.
    RunHandlerEnv child site
    -> forall a (m :: * -> *).
       MonadUnliftIO m =>
       m a -> (SomeException -> m a) -> m a
    rheCatchHandlerExceptions :: !(forall a m . MonadUnliftIO m =>  m a -> (SomeException -> m a) -> m a)
        }

    data HandlerData child site = HandlerData
        { forall child site. HandlerData child site -> YesodRequest
    handlerRequest  :: !YesodRequest
        , forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv      :: !(RunHandlerEnv child site)
        , forall child site. HandlerData child site -> IORef GHState
    handlerState    :: !(IORef GHState)
        , forall child site. HandlerData child site -> InternalState
    handlerResource :: !InternalState
        }

    data YesodRunnerEnv site = YesodRunnerEnv
        { forall site. YesodRunnerEnv site -> Logger
    yreLogger         :: !Logger
        , forall site. YesodRunnerEnv site -> site
    yreSite           :: !site
        , forall site. YesodRunnerEnv site -> Maybe SessionBackend
    yreSessionBackend :: !(Maybe SessionBackend)
        , forall site. YesodRunnerEnv site -> IO Int
    yreGen            :: !(IO Int)
        -- ^ Generate a random number uniformly distributed in the full
        -- range of 'Int'.
        --
        -- Note: Before 1.6.20, the default value generates pseudo-random
        -- number in an unspecified range. The range size may not be a power
        -- of 2. Since 1.6.20, the default value uses a secure entropy source
        -- and generates in the full range of 'Int'.
        , forall site. YesodRunnerEnv site -> IO Text
    yreGetMaxExpires  :: !(IO Text)
        }

    data YesodSubRunnerEnv sub parent = YesodSubRunnerEnv
        { forall sub parent.
    YesodSubRunnerEnv sub parent -> ParentRunner parent
    ysreParentRunner  :: !(ParentRunner parent)
        , forall sub parent. YesodSubRunnerEnv sub parent -> parent -> sub
    ysreGetSub        :: !(parent -> sub)
        , forall sub parent.
    YesodSubRunnerEnv sub parent -> Route sub -> Route parent
    ysreToParentRoute :: !(Route sub -> Route parent)
        , forall sub parent.
    YesodSubRunnerEnv sub parent -> YesodRunnerEnv parent
    ysreParentEnv     :: !(YesodRunnerEnv parent) -- FIXME maybe get rid of this and remove YesodRunnerEnv in ParentRunner?
        }

    type ParentRunner parent
        = HandlerFor parent TypedContent
       -> YesodRunnerEnv parent
       -> Maybe (Route parent)
       -> W.Application

    -- | A generic handler monad, which can have a different subsite and master
    -- site. We define a newtype for better error message.
    newtype HandlerFor site a = HandlerFor
        { forall site a. HandlerFor site a -> HandlerData site site -> IO a
    unHandlerFor :: HandlerData site site -> IO a
        }
        deriving (forall a b. (a -> b) -> HandlerFor site a -> HandlerFor site b)
    -> (forall a b. a -> HandlerFor site b -> HandlerFor site a)
    -> Functor (HandlerFor site)
    forall a b. a -> HandlerFor site b -> HandlerFor site a
    forall a b. (a -> b) -> HandlerFor site a -> HandlerFor site b
    forall site a b. a -> HandlerFor site b -> HandlerFor site a
    forall site a b. (a -> b) -> HandlerFor site a -> HandlerFor site b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall site a b. (a -> b) -> HandlerFor site a -> HandlerFor site b
    fmap :: forall a b. (a -> b) -> HandlerFor site a -> HandlerFor site b
    $c<$ :: forall site a b. a -> HandlerFor site b -> HandlerFor site a
    <$ :: forall a b. a -> HandlerFor site b -> HandlerFor site a
    Functor

    data GHState = GHState
        { GHState -> SessionMap
    ghsSession :: !SessionMap
        , GHState -> Maybe RequestBodyContents
    ghsRBC     :: !(Maybe RequestBodyContents)
        , GHState -> Int
    ghsIdent   :: !Int
        , GHState -> TypeMap
    ghsCache   :: !TypeMap
        , GHState -> KeyedTypeMap
    ghsCacheBy :: !KeyedTypeMap
        , GHState -> Endo [Header]
    ghsHeaders :: !(Endo [Header])
        }

    -- | An extension of the basic WAI 'W.Application' datatype to provide extra
    -- features needed by Yesod. Users should never need to use this directly, as
    -- the 'HandlerFor' monad and template haskell code should hide it away.
    type YesodApp = YesodRequest -> ResourceT IO YesodResponse

    -- | A generic widget, allowing specification of both the subsite and master
    -- site datatypes. While this is simply a @WriterT@, we define a newtype for
    -- better error messages.
    newtype WidgetFor site a = WidgetFor
        { forall site a. WidgetFor site a -> WidgetData site -> IO a
    unWidgetFor :: WidgetData site -> IO a
        }
        deriving (forall a b. (a -> b) -> WidgetFor site a -> WidgetFor site b)
    -> (forall a b. a -> WidgetFor site b -> WidgetFor site a)
    -> Functor (WidgetFor site)
    forall a b. a -> WidgetFor site b -> WidgetFor site a
    forall a b. (a -> b) -> WidgetFor site a -> WidgetFor site b
    forall site a b. a -> WidgetFor site b -> WidgetFor site a
    forall site a b. (a -> b) -> WidgetFor site a -> WidgetFor site b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall site a b. (a -> b) -> WidgetFor site a -> WidgetFor site b
    fmap :: forall a b. (a -> b) -> WidgetFor site a -> WidgetFor site b
    $c<$ :: forall site a b. a -> WidgetFor site b -> WidgetFor site a
    <$ :: forall a b. a -> WidgetFor site b -> WidgetFor site a
    Functor

    data WidgetData site = WidgetData
      { forall site. WidgetData site -> IORef (GWData (Route site))
    wdRef :: {-# UNPACK #-} !(IORef (GWData (Route site)))
      , forall site. WidgetData site -> HandlerData site site
    wdHandler :: {-# UNPACK #-} !(HandlerData site site)
      }

    instance a ~ () => Monoid (WidgetFor site a) where
        mempty :: WidgetFor site a
    mempty = a -> WidgetFor site a
    forall a. a -> WidgetFor site a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()
    instance a ~ () => Semigroup (WidgetFor site a) where
        WidgetFor site a
    x <> :: WidgetFor site a -> WidgetFor site a -> WidgetFor site a
    <> WidgetFor site a
    y = WidgetFor site a
    x WidgetFor site a -> WidgetFor site a -> WidgetFor site a
    forall a b.
    WidgetFor site a -> WidgetFor site b -> WidgetFor site b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >> WidgetFor site a
    y

    -- | A 'String' can be trivially promoted to a widget.
    --
    -- For example, in a yesod-scaffold site you could use:
    --
    -- @getHomeR = do defaultLayout "Widget text"@
    instance a ~ () => IsString (WidgetFor site a) where
        fromString :: String -> WidgetFor site a
    fromString = Html -> WidgetFor site a
    Html -> WidgetFor site ()
    forall {site}. Html -> WidgetFor site ()
    toWidget (Html -> WidgetFor site a)
    -> (String -> Html) -> String -> WidgetFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Text -> Html
    forall a. ToMarkup a => a -> Html
    toHtml (Text -> Html) -> (String -> Text) -> String -> Html
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Text
    T.pack
          where toWidget :: Html -> WidgetFor site ()
    toWidget Html
    x = GWData (Route site) -> WidgetFor site ()
    forall site. GWData (Route site) -> WidgetFor site ()
    tellWidget GWData (Route site)
    forall a. Monoid a => a
    mempty { gwdBody = Body (const x) }

    tellWidget :: GWData (Route site) -> WidgetFor site ()
    tellWidget :: forall site. GWData (Route site) -> WidgetFor site ()
    tellWidget GWData (Route site)
    d = (WidgetData site -> IO ()) -> WidgetFor site ()
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO ()) -> WidgetFor site ())
    -> (WidgetData site -> IO ()) -> WidgetFor site ()
    forall a b. (a -> b) -> a -> b
    $ \WidgetData site
    wd -> IORef (GWData (Route site))
    -> (GWData (Route site) -> GWData (Route site)) -> IO ()
    forall a. IORef a -> (a -> a) -> IO ()
    modifyIORef' (WidgetData site -> IORef (GWData (Route site))
    forall site. WidgetData site -> IORef (GWData (Route site))
    wdRef WidgetData site
    wd) (GWData (Route site) -> GWData (Route site) -> GWData (Route site)
    forall a. Semigroup a => a -> a -> a
    <> GWData (Route site)
    d)

    type RY master = Route master -> [(Text, Text)] -> Text

    -- | Newtype wrapper allowing injection of arbitrary content into CSS.
    --
    -- Usage:
    --
    -- > toWidget $ CssBuilder "p { color: red }"
    --
    -- Since: 1.1.3
    newtype CssBuilder = CssBuilder { CssBuilder -> Builder
    unCssBuilder :: TBuilder.Builder }

    -- | Content for a web page. By providing this datatype, we can easily create
    -- generic site templates, which would have the type signature:
    --
    -- > PageContent url -> HtmlUrl url
    data PageContent url = PageContent
        { forall url. PageContent url -> Html
    pageTitle       :: !Html
        , forall url. PageContent url -> Maybe Text
    pageDescription :: !(Maybe Text)
        , forall url. PageContent url -> HtmlUrl url
    pageHead        :: !(HtmlUrl url)
        , forall url. PageContent url -> HtmlUrl url
    pageBody        :: !(HtmlUrl url)
        }

    data Content = ContentBuilder !BB.Builder !(Maybe Int) -- ^ The content and optional content length.
                 | ContentSource !(ConduitT () (Flush BB.Builder) (ResourceT IO) ())
                 | ContentFile !FilePath !(Maybe FilePart)
                 | ContentDontEvaluate !Content

    data TypedContent = TypedContent !ContentType !Content

    type RepHtml = Html
    {-# DEPRECATED RepHtml "Please use Html instead" #-}
    newtype RepJson = RepJson Content
    newtype RepPlain = RepPlain Content
    newtype RepXml = RepXml Content

    type ContentType = ByteString -- FIXME Text?

    -- | Wrapper around types so that Handlers can return a domain type, even when
    -- the data will eventually be encoded as JSON.
    -- Example usage in a type signature:
    --
    -- > postSignupR :: Handler (JSONResponse CreateUserResponse)
    --
    -- And in the implementation:
    --
    -- > return $ JSONResponse $ CreateUserResponse userId
    --
    -- @since 1.6.14
    data JSONResponse a where
        JSONResponse :: ToJSON a => a -> JSONResponse a

    -- | Prevents a response body from being fully evaluated before sending the
    -- request.
    --
    -- Since 1.1.0
    newtype DontFullyEvaluate a = DontFullyEvaluate { forall a. DontFullyEvaluate a -> a
    unDontFullyEvaluate :: a }

    -- | Responses to indicate some form of an error occurred.
    data ErrorResponse =
          NotFound
            -- ^ The requested resource was not found.
            -- Examples of when this occurs include when an incorrect URL is used, or @yesod-persistent@'s 'get404' doesn't find a value.
            -- HTTP status: 404.
        | InternalError !Text
            -- ^ Some sort of unexpected exception.
            -- If your application uses `throwIO` or `error` to throw an exception, this is the form it would take.
            -- HTTP status: 500.
        | InvalidArgs ![Text]
            -- ^ Indicates some sort of invalid or missing argument, like a missing query parameter or malformed JSON body.
            -- Examples Yesod functions that send this include 'requireCheckJsonBody' and @Yesod.Auth.GoogleEmail2@.
            -- HTTP status: 400.
        | NotAuthenticated
            -- ^ Indicates the user is not logged in.
            -- This is thrown when 'isAuthorized' returns 'AuthenticationRequired'.
            -- HTTP code: 401.
        | PermissionDenied !Text
            -- ^ Indicates the user doesn't have permission to access the requested resource.
            -- This is thrown when 'isAuthorized' returns 'Unauthorized'.
            -- HTTP code: 403.
        | BadMethod !H.Method
            -- ^ Indicates the URL would have been valid if used with a different HTTP method (e.g. a GET was used, but only POST is handled.)
            -- HTTP code: 405.
        deriving (Int -> ErrorResponse -> ShowS
    [ErrorResponse] -> ShowS
    ErrorResponse -> String
    (Int -> ErrorResponse -> ShowS)
    -> (ErrorResponse -> String)
    -> ([ErrorResponse] -> ShowS)
    -> Show ErrorResponse
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> ErrorResponse -> ShowS
    showsPrec :: Int -> ErrorResponse -> ShowS
    $cshow :: ErrorResponse -> String
    show :: ErrorResponse -> String
    $cshowList :: [ErrorResponse] -> ShowS
    showList :: [ErrorResponse] -> ShowS
    Show, ErrorResponse -> ErrorResponse -> Bool
    (ErrorResponse -> ErrorResponse -> Bool)
    -> (ErrorResponse -> ErrorResponse -> Bool) -> Eq ErrorResponse
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ErrorResponse -> ErrorResponse -> Bool
    == :: ErrorResponse -> ErrorResponse -> Bool
    $c/= :: ErrorResponse -> ErrorResponse -> Bool
    /= :: ErrorResponse -> ErrorResponse -> Bool
    Eq, (forall x. ErrorResponse -> Rep ErrorResponse x)
    -> (forall x. Rep ErrorResponse x -> ErrorResponse)
    -> Generic ErrorResponse
    forall x. Rep ErrorResponse x -> ErrorResponse
    forall x. ErrorResponse -> Rep ErrorResponse x
    forall a.
    (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
    $cfrom :: forall x. ErrorResponse -> Rep ErrorResponse x
    from :: forall x. ErrorResponse -> Rep ErrorResponse x
    $cto :: forall x. Rep ErrorResponse x -> ErrorResponse
    to :: forall x. Rep ErrorResponse x -> ErrorResponse
    Generic)
    instance NFData ErrorResponse

    ----- header stuff
    -- | Headers to be added to a 'Result'.
    data Header =
          AddCookie !SetCookie
        | DeleteCookie !ByteString !ByteString
        -- ^ name and path
        | Header !(CI ByteString) !ByteString
        -- ^ key and value
        deriving (Header -> Header -> Bool
    (Header -> Header -> Bool)
    -> (Header -> Header -> Bool) -> Eq Header
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Header -> Header -> Bool
    == :: Header -> Header -> Bool
    $c/= :: Header -> Header -> Bool
    /= :: Header -> Header -> Bool
    Eq, Int -> Header -> ShowS
    [Header] -> ShowS
    Header -> String
    (Int -> Header -> ShowS)
    -> (Header -> String) -> ([Header] -> ShowS) -> Show Header
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Header -> ShowS
    showsPrec :: Int -> Header -> ShowS
    $cshow :: Header -> String
    show :: Header -> String
    $cshowList :: [Header] -> ShowS
    showList :: [Header] -> ShowS
    Show)

    -- FIXME In the next major version bump, let's just add strictness annotations
    -- to Header (and probably everywhere else). We can also add strictness
    -- annotations to SetCookie in the cookie package.
    instance NFData Header where
        rnf :: Header -> ()
    rnf (AddCookie SetCookie
    x) = SetCookie -> ()
    forall a. NFData a => a -> ()
    rnf SetCookie
    x
        rnf (DeleteCookie ByteString
    x ByteString
    y) = ByteString
    x ByteString -> () -> ()
    forall a b. a -> b -> b
    `seq` ByteString
    y ByteString -> () -> ()
    forall a b. a -> b -> b
    `seq` ()
        rnf (Header CI ByteString
    x ByteString
    y) = CI ByteString
    x CI ByteString -> () -> ()
    forall a b. a -> b -> b
    `seq` ByteString
    y ByteString -> () -> ()
    forall a b. a -> b -> b
    `seq` ()

    data Location url = Local !url | Remote !Text
        deriving (Int -> Location url -> ShowS
    [Location url] -> ShowS
    Location url -> String
    (Int -> Location url -> ShowS)
    -> (Location url -> String)
    -> ([Location url] -> ShowS)
    -> Show (Location url)
    forall url. Show url => Int -> Location url -> ShowS
    forall url. Show url => [Location url] -> ShowS
    forall url. Show url => Location url -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall url. Show url => Int -> Location url -> ShowS
    showsPrec :: Int -> Location url -> ShowS
    $cshow :: forall url. Show url => Location url -> String
    show :: Location url -> String
    $cshowList :: forall url. Show url => [Location url] -> ShowS
    showList :: [Location url] -> ShowS
    Show, Location url -> Location url -> Bool
    (Location url -> Location url -> Bool)
    -> (Location url -> Location url -> Bool) -> Eq (Location url)
    forall url. Eq url => Location url -> Location url -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall url. Eq url => Location url -> Location url -> Bool
    == :: Location url -> Location url -> Bool
    $c/= :: forall url. Eq url => Location url -> Location url -> Bool
    /= :: Location url -> Location url -> Bool
    Eq)

    -- | A diff list that does not directly enforce uniqueness.
    -- When creating a widget Yesod will use nub to make it unique.
    newtype UniqueList x = UniqueList ([x] -> [x])

    data Script url = Script { forall url. Script url -> Location url
    scriptLocation :: !(Location url), forall url. Script url -> [(Text, Text)]
    scriptAttributes :: ![(Text, Text)] }
        deriving (Int -> Script url -> ShowS
    [Script url] -> ShowS
    Script url -> String
    (Int -> Script url -> ShowS)
    -> (Script url -> String)
    -> ([Script url] -> ShowS)
    -> Show (Script url)
    forall url. Show url => Int -> Script url -> ShowS
    forall url. Show url => [Script url] -> ShowS
    forall url. Show url => Script url -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall url. Show url => Int -> Script url -> ShowS
    showsPrec :: Int -> Script url -> ShowS
    $cshow :: forall url. Show url => Script url -> String
    show :: Script url -> String
    $cshowList :: forall url. Show url => [Script url] -> ShowS
    showList :: [Script url] -> ShowS
    Show, Script url -> Script url -> Bool
    (Script url -> Script url -> Bool)
    -> (Script url -> Script url -> Bool) -> Eq (Script url)
    forall url. Eq url => Script url -> Script url -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall url. Eq url => Script url -> Script url -> Bool
    == :: Script url -> Script url -> Bool
    $c/= :: forall url. Eq url => Script url -> Script url -> Bool
    /= :: Script url -> Script url -> Bool
    Eq)
    data Stylesheet url = Stylesheet { forall url. Stylesheet url -> Location url
    styleLocation :: !(Location url), forall url. Stylesheet url -> [(Text, Text)]
    styleAttributes :: ![(Text, Text)] }
        deriving (Int -> Stylesheet url -> ShowS
    [Stylesheet url] -> ShowS
    Stylesheet url -> String
    (Int -> Stylesheet url -> ShowS)
    -> (Stylesheet url -> String)
    -> ([Stylesheet url] -> ShowS)
    -> Show (Stylesheet url)
    forall url. Show url => Int -> Stylesheet url -> ShowS
    forall url. Show url => [Stylesheet url] -> ShowS
    forall url. Show url => Stylesheet url -> String
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: forall url. Show url => Int -> Stylesheet url -> ShowS
    showsPrec :: Int -> Stylesheet url -> ShowS
    $cshow :: forall url. Show url => Stylesheet url -> String
    show :: Stylesheet url -> String
    $cshowList :: forall url. Show url => [Stylesheet url] -> ShowS
    showList :: [Stylesheet url] -> ShowS
    Show, Stylesheet url -> Stylesheet url -> Bool
    (Stylesheet url -> Stylesheet url -> Bool)
    -> (Stylesheet url -> Stylesheet url -> Bool)
    -> Eq (Stylesheet url)
    forall url. Eq url => Stylesheet url -> Stylesheet url -> Bool
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: forall url. Eq url => Stylesheet url -> Stylesheet url -> Bool
    == :: Stylesheet url -> Stylesheet url -> Bool
    $c/= :: forall url. Eq url => Stylesheet url -> Stylesheet url -> Bool
    /= :: Stylesheet url -> Stylesheet url -> Bool
    Eq)
    newtype Title = Title { Title -> Html
    unTitle :: Html }
    newtype Description = Description { Description -> Text
    unDescription :: Text }

    newtype Head url = Head (HtmlUrl url)
        deriving (NonEmpty (Head url) -> Head url
    Head url -> Head url -> Head url
    (Head url -> Head url -> Head url)
    -> (NonEmpty (Head url) -> Head url)
    -> (forall b. Integral b => b -> Head url -> Head url)
    -> Semigroup (Head url)
    forall b. Integral b => b -> Head url -> Head url
    forall url. NonEmpty (Head url) -> Head url
    forall url. Head url -> Head url -> Head url
    forall a.
    (a -> a -> a)
    -> (NonEmpty a -> a)
    -> (forall b. Integral b => b -> a -> a)
    -> Semigroup a
    forall url b. Integral b => b -> Head url -> Head url
    $c<> :: forall url. Head url -> Head url -> Head url
    <> :: Head url -> Head url -> Head url
    $csconcat :: forall url. NonEmpty (Head url) -> Head url
    sconcat :: NonEmpty (Head url) -> Head url
    $cstimes :: forall url b. Integral b => b -> Head url -> Head url
    stimes :: forall b. Integral b => b -> Head url -> Head url
    Semigroup, Semigroup (Head url)
    Head url
    Semigroup (Head url) =>
    Head url
    -> (Head url -> Head url -> Head url)
    -> ([Head url] -> Head url)
    -> Monoid (Head url)
    [Head url] -> Head url
    Head url -> Head url -> Head url
    forall url. Semigroup (Head url)
    forall url. Head url
    forall a.
    Semigroup a =>
    a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
    forall url. [Head url] -> Head url
    forall url. Head url -> Head url -> Head url
    $cmempty :: forall url. Head url
    mempty :: Head url
    $cmappend :: forall url. Head url -> Head url -> Head url
    mappend :: Head url -> Head url -> Head url
    $cmconcat :: forall url. [Head url] -> Head url
    mconcat :: [Head url] -> Head url
    Monoid)
    newtype Body url = Body (HtmlUrl url)
        deriving (NonEmpty (Body url) -> Body url
    Body url -> Body url -> Body url
    (Body url -> Body url -> Body url)
    -> (NonEmpty (Body url) -> Body url)
    -> (forall b. Integral b => b -> Body url -> Body url)
    -> Semigroup (Body url)
    forall b. Integral b => b -> Body url -> Body url
    forall url. NonEmpty (Body url) -> Body url
    forall url. Body url -> Body url -> Body url
    forall a.
    (a -> a -> a)
    -> (NonEmpty a -> a)
    -> (forall b. Integral b => b -> a -> a)
    -> Semigroup a
    forall url b. Integral b => b -> Body url -> Body url
    $c<> :: forall url. Body url -> Body url -> Body url
    <> :: Body url -> Body url -> Body url
    $csconcat :: forall url. NonEmpty (Body url) -> Body url
    sconcat :: NonEmpty (Body url) -> Body url
    $cstimes :: forall url b. Integral b => b -> Body url -> Body url
    stimes :: forall b. Integral b => b -> Body url -> Body url
    Semigroup, Semigroup (Body url)
    Body url
    Semigroup (Body url) =>
    Body url
    -> (Body url -> Body url -> Body url)
    -> ([Body url] -> Body url)
    -> Monoid (Body url)
    [Body url] -> Body url
    Body url -> Body url -> Body url
    forall url. Semigroup (Body url)
    forall url. Body url
    forall a.
    Semigroup a =>
    a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
    forall url. [Body url] -> Body url
    forall url. Body url -> Body url -> Body url
    $cmempty :: forall url. Body url
    mempty :: Body url
    $cmappend :: forall url. Body url -> Body url -> Body url
    mappend :: Body url -> Body url -> Body url
    $cmconcat :: forall url. [Body url] -> Body url
    mconcat :: [Body url] -> Body url
    Monoid)

    type CssBuilderUrl a = (a -> [(Text, Text)] -> Text) -> TBuilder.Builder

    data GWData a = GWData
        { forall a. GWData a -> Body a
    gwdBody        :: !(Body a)
        , forall a. GWData a -> Last Title
    gwdTitle       :: !(Last Title)
        , forall a. GWData a -> Last Description
    gwdDescription :: !(Last Description)
        , forall a. GWData a -> UniqueList (Script a)
    gwdScripts     :: !(UniqueList (Script a))
        , forall a. GWData a -> UniqueList (Stylesheet a)
    gwdStylesheets :: !(UniqueList (Stylesheet a))
        , forall a. GWData a -> Map (Maybe Text) (CssBuilderUrl a)
    gwdCss         :: !(Map (Maybe Text) (CssBuilderUrl a)) -- media type
        , forall a. GWData a -> Maybe (JavascriptUrl a)
    gwdJavascript  :: !(Maybe (JavascriptUrl a))
        , forall a. GWData a -> Head a
    gwdHead        :: !(Head a)
        }
    instance Monoid (GWData a) where
        mempty :: GWData a
    mempty = Body a
    -> Last Title
    -> Last Description
    -> UniqueList (Script a)
    -> UniqueList (Stylesheet a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    -> Maybe (JavascriptUrl a)
    -> Head a
    -> GWData a
    forall a.
    Body a
    -> Last Title
    -> Last Description
    -> UniqueList (Script a)
    -> UniqueList (Stylesheet a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    -> Maybe (JavascriptUrl a)
    -> Head a
    -> GWData a
    GWData Body a
    forall a. Monoid a => a
    mempty Last Title
    forall a. Monoid a => a
    mempty Last Description
    forall a. Monoid a => a
    mempty UniqueList (Script a)
    forall a. Monoid a => a
    mempty UniqueList (Stylesheet a)
    forall a. Monoid a => a
    mempty Map (Maybe Text) (CssBuilderUrl a)
    forall a. Monoid a => a
    mempty Maybe (JavascriptUrl a)
    forall a. Monoid a => a
    mempty Head a
    forall a. Monoid a => a
    mempty
    instance Semigroup (GWData a) where
        GWData Body a
    a1 Last Title
    a2 Last Description
    a3 UniqueList (Script a)
    a4 UniqueList (Stylesheet a)
    a5 Map (Maybe Text) (CssBuilderUrl a)
    a6 Maybe (JavascriptUrl a)
    a7 Head a
    a8 <> :: GWData a -> GWData a -> GWData a
    <>
          GWData Body a
    b1 Last Title
    b2 Last Description
    b3 UniqueList (Script a)
    b4 UniqueList (Stylesheet a)
    b5 Map (Maybe Text) (CssBuilderUrl a)
    b6 Maybe (JavascriptUrl a)
    b7 Head a
    b8 = Body a
    -> Last Title
    -> Last Description
    -> UniqueList (Script a)
    -> UniqueList (Stylesheet a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    -> Maybe (JavascriptUrl a)
    -> Head a
    -> GWData a
    forall a.
    Body a
    -> Last Title
    -> Last Description
    -> UniqueList (Script a)
    -> UniqueList (Stylesheet a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    -> Maybe (JavascriptUrl a)
    -> Head a
    -> GWData a
    GWData
            (Body a -> Body a -> Body a
    forall a. Monoid a => a -> a -> a
    mappend Body a
    a1 Body a
    b1)
            (Last Title -> Last Title -> Last Title
    forall a. Monoid a => a -> a -> a
    mappend Last Title
    a2 Last Title
    b2)
            (Last Description -> Last Description -> Last Description
    forall a. Monoid a => a -> a -> a
    mappend Last Description
    a3 Last Description
    b3)
            (UniqueList (Script a)
    -> UniqueList (Script a) -> UniqueList (Script a)
    forall a. Monoid a => a -> a -> a
    mappend UniqueList (Script a)
    a4 UniqueList (Script a)
    b4)
            (UniqueList (Stylesheet a)
    -> UniqueList (Stylesheet a) -> UniqueList (Stylesheet a)
    forall a. Monoid a => a -> a -> a
    mappend UniqueList (Stylesheet a)
    a5 UniqueList (Stylesheet a)
    b5)
            ((CssBuilderUrl a -> CssBuilderUrl a -> CssBuilderUrl a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    -> Map (Maybe Text) (CssBuilderUrl a)
    forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
    unionWith CssBuilderUrl a -> CssBuilderUrl a -> CssBuilderUrl a
    forall a. Monoid a => a -> a -> a
    mappend Map (Maybe Text) (CssBuilderUrl a)
    a6 Map (Maybe Text) (CssBuilderUrl a)
    b6)
            (Maybe (JavascriptUrl a)
    -> Maybe (JavascriptUrl a) -> Maybe (JavascriptUrl a)
    forall a. Monoid a => a -> a -> a
    mappend Maybe (JavascriptUrl a)
    a7 Maybe (JavascriptUrl a)
    b7)
            (Head a -> Head a -> Head a
    forall a. Monoid a => a -> a -> a
    mappend Head a
    a8 Head a
    b8)

    data HandlerContents =
          HCContent !H.Status !TypedContent
        | HCError !ErrorResponse
        | HCSendFile !ContentType !FilePath !(Maybe FilePart)
        | HCRedirect !H.Status !Text
        | HCCreated !Text
        | HCWai !W.Response
        | HCWaiApp !W.Application

    instance Show HandlerContents where
        show :: HandlerContents -> String
    show (HCContent Status
    status (TypedContent ByteString
    t Content
    _)) = String
    "HCContent " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ (Status, ByteString) -> String
    forall a. Show a => a -> String
    show (Status
    status, ByteString
    t)
        show (HCError ErrorResponse
    e) = String
    "HCError " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ ErrorResponse -> String
    forall a. Show a => a -> String
    show ErrorResponse
    e
        show (HCSendFile ByteString
    ct String
    fp Maybe FilePart
    mfp) = String
    "HCSendFile " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ (ByteString, String, Maybe FilePart) -> String
    forall a. Show a => a -> String
    show (ByteString
    ct, String
    fp, Maybe FilePart
    mfp)
        show (HCRedirect Status
    s Text
    t) = String
    "HCRedirect " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ (Status, Text) -> String
    forall a. Show a => a -> String
    show (Status
    s, Text
    t)
        show (HCCreated Text
    t) = String
    "HCCreated " String -> ShowS
    forall a. [a] -> [a] -> [a]
    ++ Text -> String
    forall a. Show a => a -> String
    show Text
    t
        show (HCWai Response
    _) = String
    "HCWai"
        show (HCWaiApp Application
    _) = String
    "HCWaiApp"
    instance Exception HandlerContents

    -- Instances for WidgetFor
    instance Applicative (WidgetFor site) where
        pure :: forall a. a -> WidgetFor site a
    pure = (WidgetData site -> IO a) -> WidgetFor site a
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO a) -> WidgetFor site a)
    -> (a -> WidgetData site -> IO a) -> a -> WidgetFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IO a -> WidgetData site -> IO a
    forall a b. a -> b -> a
    const (IO a -> WidgetData site -> IO a)
    -> (a -> IO a) -> a -> WidgetData site -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> IO a
    forall a. a -> IO a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure
        <*> :: forall a b.
    WidgetFor site (a -> b) -> WidgetFor site a -> WidgetFor site b
    (<*>) = WidgetFor site (a -> b) -> WidgetFor site a -> WidgetFor site b
    forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
    ap
    instance Monad (WidgetFor site) where
        return :: forall a. a -> WidgetFor site a
    return = a -> WidgetFor site a
    forall a. a -> WidgetFor site a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure
        WidgetFor WidgetData site -> IO a
    x >>= :: forall a b.
    WidgetFor site a -> (a -> WidgetFor site b) -> WidgetFor site b
    >>= a -> WidgetFor site b
    f = (WidgetData site -> IO b) -> WidgetFor site b
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO b) -> WidgetFor site b)
    -> (WidgetData site -> IO b) -> WidgetFor site b
    forall a b. (a -> b) -> a -> b
    $ \WidgetData site
    wd -> do
            a <- WidgetData site -> IO a
    x WidgetData site
    wd
            unWidgetFor (f a) wd
    instance MonadIO (WidgetFor site) where
        liftIO :: forall a. IO a -> WidgetFor site a
    liftIO = (WidgetData site -> IO a) -> WidgetFor site a
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO a) -> WidgetFor site a)
    -> (IO a -> WidgetData site -> IO a) -> IO a -> WidgetFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IO a -> WidgetData site -> IO a
    forall a b. a -> b -> a
    const
    -- | @since 1.6.7
    instance PrimMonad (WidgetFor site) where
        type PrimState (WidgetFor site) = PrimState IO
        primitive :: forall a.
    (State# (PrimState (WidgetFor site))
     -> (# State# (PrimState (WidgetFor site)), a #))
    -> WidgetFor site a
    primitive = IO a -> WidgetFor site a
    forall a. IO a -> WidgetFor site a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> WidgetFor site a)
    -> ((State# RealWorld -> (# State# RealWorld, a #)) -> IO a)
    -> (State# RealWorld -> (# State# RealWorld, a #))
    -> WidgetFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
    (State# (PrimState IO) -> (# State# (PrimState IO), a #)) -> IO a
    forall a.
    (State# (PrimState IO) -> (# State# (PrimState IO), a #)) -> IO a
    forall (m :: * -> *) a.
    PrimMonad m =>
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a
    primitive
    -- | @since 1.4.38
    instance MonadUnliftIO (WidgetFor site) where
      {-# INLINE withRunInIO #-}
      withRunInIO :: forall b.
    ((forall a. WidgetFor site a -> IO a) -> IO b) -> WidgetFor site b
    withRunInIO (forall a. WidgetFor site a -> IO a) -> IO b
    inner = (WidgetData site -> IO b) -> WidgetFor site b
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO b) -> WidgetFor site b)
    -> (WidgetData site -> IO b) -> WidgetFor site b
    forall a b. (a -> b) -> a -> b
    $ \WidgetData site
    x -> (forall a. WidgetFor site a -> IO a) -> IO b
    inner ((forall a. WidgetFor site a -> IO a) -> IO b)
    -> (forall a. WidgetFor site a -> IO a) -> IO b
    forall a b. (a -> b) -> a -> b
    $ (WidgetFor site a -> WidgetData site -> IO a)
    -> WidgetData site -> WidgetFor site a -> IO a
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip WidgetFor site a -> WidgetData site -> IO a
    forall site a. WidgetFor site a -> WidgetData site -> IO a
    unWidgetFor WidgetData site
    x
    instance MonadReader (WidgetData site) (WidgetFor site) where
        ask :: WidgetFor site (WidgetData site)
    ask = (WidgetData site -> IO (WidgetData site))
    -> WidgetFor site (WidgetData site)
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor WidgetData site -> IO (WidgetData site)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        local :: forall a.
    (WidgetData site -> WidgetData site)
    -> WidgetFor site a -> WidgetFor site a
    local WidgetData site -> WidgetData site
    f (WidgetFor WidgetData site -> IO a
    g) = (WidgetData site -> IO a) -> WidgetFor site a
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO a) -> WidgetFor site a)
    -> (WidgetData site -> IO a) -> WidgetFor site a
    forall a b. (a -> b) -> a -> b
    $ WidgetData site -> IO a
    g (WidgetData site -> IO a)
    -> (WidgetData site -> WidgetData site) -> WidgetData site -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . WidgetData site -> WidgetData site
    f

    instance MonadThrow (WidgetFor site) where
        throwM :: forall e a. (HasCallStack, Exception e) => e -> WidgetFor site a
    throwM = IO a -> WidgetFor site a
    forall a. IO a -> WidgetFor site a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> WidgetFor site a) -> (e -> IO a) -> e -> WidgetFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . e -> IO a
    forall e a. (HasCallStack, Exception e) => e -> IO a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM

    instance MonadResource (WidgetFor site) where
        liftResourceT :: forall a. ResourceT IO a -> WidgetFor site a
    liftResourceT ResourceT IO a
    f = (WidgetData site -> IO a) -> WidgetFor site a
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO a) -> WidgetFor site a)
    -> (WidgetData site -> IO a) -> WidgetFor site a
    forall a b. (a -> b) -> a -> b
    $ ResourceT IO a -> InternalState -> IO a
    forall (m :: * -> *) a. ResourceT m a -> InternalState -> m a
    runInternalState ResourceT IO a
    f (InternalState -> IO a)
    -> (WidgetData site -> InternalState) -> WidgetData site -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData site site -> InternalState
    forall child site. HandlerData child site -> InternalState
    handlerResource (HandlerData site site -> InternalState)
    -> (WidgetData site -> HandlerData site site)
    -> WidgetData site
    -> InternalState
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . WidgetData site -> HandlerData site site
    forall site. WidgetData site -> HandlerData site site
    wdHandler

    instance MonadLogger (WidgetFor site) where
        monadLoggerLog :: forall msg.
    ToLogStr msg =>
    Loc -> Text -> LogLevel -> msg -> WidgetFor site ()
    monadLoggerLog Loc
    a Text
    b LogLevel
    c msg
    d = (WidgetData site -> IO ()) -> WidgetFor site ()
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site -> IO ()) -> WidgetFor site ())
    -> (WidgetData site -> IO ()) -> WidgetFor site ()
    forall a b. (a -> b) -> a -> b
    $ \WidgetData site
    wd ->
            RunHandlerEnv site site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog (HandlerData site site -> RunHandlerEnv site site
    forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv (HandlerData site site -> RunHandlerEnv site site)
    -> HandlerData site site -> RunHandlerEnv site site
    forall a b. (a -> b) -> a -> b
    $ WidgetData site -> HandlerData site site
    forall site. WidgetData site -> HandlerData site site
    wdHandler WidgetData site
    wd) Loc
    a Text
    b LogLevel
    c (msg -> LogStr
    forall msg. ToLogStr msg => msg -> LogStr
    toLogStr msg
    d)

    instance MonadLoggerIO (WidgetFor site) where
        askLoggerIO :: WidgetFor site (Loc -> Text -> LogLevel -> LogStr -> IO ())
    askLoggerIO = (WidgetData site
     -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> WidgetFor site (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall site a. (WidgetData site -> IO a) -> WidgetFor site a
    WidgetFor ((WidgetData site
      -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
     -> WidgetFor site (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> (WidgetData site
        -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> WidgetFor site (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall a b. (a -> b) -> a -> b
    $ (Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ((Loc -> Text -> LogLevel -> LogStr -> IO ())
     -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> (WidgetData site -> Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> WidgetData site
    -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunHandlerEnv site site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog (RunHandlerEnv site site
     -> Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> (WidgetData site -> RunHandlerEnv site site)
    -> WidgetData site
    -> Loc
    -> Text
    -> LogLevel
    -> LogStr
    -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData site site -> RunHandlerEnv site site
    forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv (HandlerData site site -> RunHandlerEnv site site)
    -> (WidgetData site -> HandlerData site site)
    -> WidgetData site
    -> RunHandlerEnv site site
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . WidgetData site -> HandlerData site site
    forall site. WidgetData site -> HandlerData site site
    wdHandler

    -- Instances for HandlerFor
    instance Applicative (HandlerFor site) where
        pure :: forall a. a -> HandlerFor site a
    pure = (HandlerData site site -> IO a) -> HandlerFor site a
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO a) -> HandlerFor site a)
    -> (a -> HandlerData site site -> IO a) -> a -> HandlerFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IO a -> HandlerData site site -> IO a
    forall a b. a -> b -> a
    const (IO a -> HandlerData site site -> IO a)
    -> (a -> IO a) -> a -> HandlerData site site -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> IO a
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        <*> :: forall a b.
    HandlerFor site (a -> b) -> HandlerFor site a -> HandlerFor site b
    (<*>) = HandlerFor site (a -> b) -> HandlerFor site a -> HandlerFor site b
    forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
    ap
    instance Monad (HandlerFor site) where
        return :: forall a. a -> HandlerFor site a
    return = a -> HandlerFor site a
    forall a. a -> HandlerFor site a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure
        HandlerFor HandlerData site site -> IO a
    x >>= :: forall a b.
    HandlerFor site a -> (a -> HandlerFor site b) -> HandlerFor site b
    >>= a -> HandlerFor site b
    f = (HandlerData site site -> IO b) -> HandlerFor site b
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO b) -> HandlerFor site b)
    -> (HandlerData site site -> IO b) -> HandlerFor site b
    forall a b. (a -> b) -> a -> b
    $ \HandlerData site site
    r -> HandlerData site site -> IO a
    x HandlerData site site
    r IO a -> (a -> IO b) -> IO b
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \a
    x' -> HandlerFor site b -> HandlerData site site -> IO b
    forall site a. HandlerFor site a -> HandlerData site site -> IO a
    unHandlerFor (a -> HandlerFor site b
    f a
    x') HandlerData site site
    r
    instance MonadIO (HandlerFor site) where
        liftIO :: forall a. IO a -> HandlerFor site a
    liftIO = (HandlerData site site -> IO a) -> HandlerFor site a
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO a) -> HandlerFor site a)
    -> (IO a -> HandlerData site site -> IO a)
    -> IO a
    -> HandlerFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IO a -> HandlerData site site -> IO a
    forall a b. a -> b -> a
    const
    -- | @since 1.6.7
    instance PrimMonad (HandlerFor site) where
        type PrimState (HandlerFor site) = PrimState IO
        primitive :: forall a.
    (State# (PrimState (HandlerFor site))
     -> (# State# (PrimState (HandlerFor site)), a #))
    -> HandlerFor site a
    primitive = IO a -> HandlerFor site a
    forall a. IO a -> HandlerFor site a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> HandlerFor site a)
    -> ((State# RealWorld -> (# State# RealWorld, a #)) -> IO a)
    -> (State# RealWorld -> (# State# RealWorld, a #))
    -> HandlerFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
    (State# (PrimState IO) -> (# State# (PrimState IO), a #)) -> IO a
    forall a.
    (State# (PrimState IO) -> (# State# (PrimState IO), a #)) -> IO a
    forall (m :: * -> *) a.
    PrimMonad m =>
    (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a
    primitive
    instance MonadReader (HandlerData site site) (HandlerFor site) where
        ask :: HandlerFor site (HandlerData site site)
    ask = (HandlerData site site -> IO (HandlerData site site))
    -> HandlerFor site (HandlerData site site)
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor HandlerData site site -> IO (HandlerData site site)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        local :: forall a.
    (HandlerData site site -> HandlerData site site)
    -> HandlerFor site a -> HandlerFor site a
    local HandlerData site site -> HandlerData site site
    f (HandlerFor HandlerData site site -> IO a
    g) = (HandlerData site site -> IO a) -> HandlerFor site a
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO a) -> HandlerFor site a)
    -> (HandlerData site site -> IO a) -> HandlerFor site a
    forall a b. (a -> b) -> a -> b
    $ HandlerData site site -> IO a
    g (HandlerData site site -> IO a)
    -> (HandlerData site site -> HandlerData site site)
    -> HandlerData site site
    -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData site site -> HandlerData site site
    f

    -- | @since 1.4.38
    instance MonadUnliftIO (HandlerFor site) where
      {-# INLINE withRunInIO #-}
      withRunInIO :: forall b.
    ((forall a. HandlerFor site a -> IO a) -> IO b)
    -> HandlerFor site b
    withRunInIO (forall a. HandlerFor site a -> IO a) -> IO b
    inner = (HandlerData site site -> IO b) -> HandlerFor site b
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO b) -> HandlerFor site b)
    -> (HandlerData site site -> IO b) -> HandlerFor site b
    forall a b. (a -> b) -> a -> b
    $ \HandlerData site site
    x -> (forall a. HandlerFor site a -> IO a) -> IO b
    inner ((forall a. HandlerFor site a -> IO a) -> IO b)
    -> (forall a. HandlerFor site a -> IO a) -> IO b
    forall a b. (a -> b) -> a -> b
    $ (HandlerFor site a -> HandlerData site site -> IO a)
    -> HandlerData site site -> HandlerFor site a -> IO a
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip HandlerFor site a -> HandlerData site site -> IO a
    forall site a. HandlerFor site a -> HandlerData site site -> IO a
    unHandlerFor HandlerData site site
    x

    instance MonadThrow (HandlerFor site) where
        throwM :: forall e a. (HasCallStack, Exception e) => e -> HandlerFor site a
    throwM = IO a -> HandlerFor site a
    forall a. IO a -> HandlerFor site a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> HandlerFor site a)
    -> (e -> IO a) -> e -> HandlerFor site a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . e -> IO a
    forall e a. (HasCallStack, Exception e) => e -> IO a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM

    instance MonadResource (HandlerFor site) where
        liftResourceT :: forall a. ResourceT IO a -> HandlerFor site a
    liftResourceT ResourceT IO a
    f = (HandlerData site site -> IO a) -> HandlerFor site a
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO a) -> HandlerFor site a)
    -> (HandlerData site site -> IO a) -> HandlerFor site a
    forall a b. (a -> b) -> a -> b
    $ ResourceT IO a -> InternalState -> IO a
    forall (m :: * -> *) a. ResourceT m a -> InternalState -> m a
    runInternalState ResourceT IO a
    f (InternalState -> IO a)
    -> (HandlerData site site -> InternalState)
    -> HandlerData site site
    -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData site site -> InternalState
    forall child site. HandlerData child site -> InternalState
    handlerResource

    instance MonadLogger (HandlerFor site) where
        monadLoggerLog :: forall msg.
    ToLogStr msg =>
    Loc -> Text -> LogLevel -> msg -> HandlerFor site ()
    monadLoggerLog Loc
    a Text
    b LogLevel
    c msg
    d = (HandlerData site site -> IO ()) -> HandlerFor site ()
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site -> IO ()) -> HandlerFor site ())
    -> (HandlerData site site -> IO ()) -> HandlerFor site ()
    forall a b. (a -> b) -> a -> b
    $ \HandlerData site site
    hd ->
            RunHandlerEnv site site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog (HandlerData site site -> RunHandlerEnv site site
    forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv HandlerData site site
    hd) Loc
    a Text
    b LogLevel
    c (msg -> LogStr
    forall msg. ToLogStr msg => msg -> LogStr
    toLogStr msg
    d)

    instance MonadLoggerIO (HandlerFor site) where
        askLoggerIO :: HandlerFor site (Loc -> Text -> LogLevel -> LogStr -> IO ())
    askLoggerIO = (HandlerData site site
     -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> HandlerFor site (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall site a. (HandlerData site site -> IO a) -> HandlerFor site a
    HandlerFor ((HandlerData site site
      -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
     -> HandlerFor site (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> (HandlerData site site
        -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> HandlerFor site (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall a b. (a -> b) -> a -> b
    $ \HandlerData site site
    hd -> (Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (RunHandlerEnv site site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog (HandlerData site site -> RunHandlerEnv site site
    forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv HandlerData site site
    hd))

    instance Monoid (UniqueList x) where
        mempty :: UniqueList x
    mempty = ([x] -> [x]) -> UniqueList x
    forall x. ([x] -> [x]) -> UniqueList x
    UniqueList [x] -> [x]
    forall a. a -> a
    id
    instance Semigroup (UniqueList x) where
        UniqueList [x] -> [x]
    x <> :: UniqueList x -> UniqueList x -> UniqueList x
    <> UniqueList [x] -> [x]
    y = ([x] -> [x]) -> UniqueList x
    forall x. ([x] -> [x]) -> UniqueList x
    UniqueList (([x] -> [x]) -> UniqueList x) -> ([x] -> [x]) -> UniqueList x
    forall a b. (a -> b) -> a -> b
    $ [x] -> [x]
    x ([x] -> [x]) -> ([x] -> [x]) -> [x] -> [x]
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . [x] -> [x]
    y

    instance IsString Content where
        fromString :: String -> Content
    fromString = (Builder -> Maybe Int -> Content)
    -> Maybe Int -> Builder -> Content
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip Builder -> Maybe Int -> Content
    ContentBuilder Maybe Int
    forall a. Maybe a
    Nothing (Builder -> Content) -> (String -> Builder) -> String -> Content
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . String -> Builder
    BB.stringUtf8

    instance RenderRoute WaiSubsite where
        data Route WaiSubsite = WaiSubsiteRoute [Text] [(Text, Text)]
            deriving (Int -> Route WaiSubsite -> ShowS
    [Route WaiSubsite] -> ShowS
    Route WaiSubsite -> String
    (Int -> Route WaiSubsite -> ShowS)
    -> (Route WaiSubsite -> String)
    -> ([Route WaiSubsite] -> ShowS)
    -> Show (Route WaiSubsite)
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Route WaiSubsite -> ShowS
    showsPrec :: Int -> Route WaiSubsite -> ShowS
    $cshow :: Route WaiSubsite -> String
    show :: Route WaiSubsite -> String
    $cshowList :: [Route WaiSubsite] -> ShowS
    showList :: [Route WaiSubsite] -> ShowS
    Show, Route WaiSubsite -> Route WaiSubsite -> Bool
    (Route WaiSubsite -> Route WaiSubsite -> Bool)
    -> (Route WaiSubsite -> Route WaiSubsite -> Bool)
    -> Eq (Route WaiSubsite)
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Route WaiSubsite -> Route WaiSubsite -> Bool
    == :: Route WaiSubsite -> Route WaiSubsite -> Bool
    $c/= :: Route WaiSubsite -> Route WaiSubsite -> Bool
    /= :: Route WaiSubsite -> Route WaiSubsite -> Bool
    Eq, ReadPrec [Route WaiSubsite]
    ReadPrec (Route WaiSubsite)
    Int -> ReadS (Route WaiSubsite)
    ReadS [Route WaiSubsite]
    (Int -> ReadS (Route WaiSubsite))
    -> ReadS [Route WaiSubsite]
    -> ReadPrec (Route WaiSubsite)
    -> ReadPrec [Route WaiSubsite]
    -> Read (Route WaiSubsite)
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS (Route WaiSubsite)
    readsPrec :: Int -> ReadS (Route WaiSubsite)
    $creadList :: ReadS [Route WaiSubsite]
    readList :: ReadS [Route WaiSubsite]
    $creadPrec :: ReadPrec (Route WaiSubsite)
    readPrec :: ReadPrec (Route WaiSubsite)
    $creadListPrec :: ReadPrec [Route WaiSubsite]
    readListPrec :: ReadPrec [Route WaiSubsite]
    Read, Eq (Route WaiSubsite)
    Eq (Route WaiSubsite) =>
    (Route WaiSubsite -> Route WaiSubsite -> Ordering)
    -> (Route WaiSubsite -> Route WaiSubsite -> Bool)
    -> (Route WaiSubsite -> Route WaiSubsite -> Bool)
    -> (Route WaiSubsite -> Route WaiSubsite -> Bool)
    -> (Route WaiSubsite -> Route WaiSubsite -> Bool)
    -> (Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite)
    -> (Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite)
    -> Ord (Route WaiSubsite)
    Route WaiSubsite -> Route WaiSubsite -> Bool
    Route WaiSubsite -> Route WaiSubsite -> Ordering
    Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Route WaiSubsite -> Route WaiSubsite -> Ordering
    compare :: Route WaiSubsite -> Route WaiSubsite -> Ordering
    $c< :: Route WaiSubsite -> Route WaiSubsite -> Bool
    < :: Route WaiSubsite -> Route WaiSubsite -> Bool
    $c<= :: Route WaiSubsite -> Route WaiSubsite -> Bool
    <= :: Route WaiSubsite -> Route WaiSubsite -> Bool
    $c> :: Route WaiSubsite -> Route WaiSubsite -> Bool
    > :: Route WaiSubsite -> Route WaiSubsite -> Bool
    $c>= :: Route WaiSubsite -> Route WaiSubsite -> Bool
    >= :: Route WaiSubsite -> Route WaiSubsite -> Bool
    $cmax :: Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite
    max :: Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite
    $cmin :: Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite
    min :: Route WaiSubsite -> Route WaiSubsite -> Route WaiSubsite
    Ord)
        renderRoute :: Route WaiSubsite -> ([Text], [(Text, Text)])
    renderRoute (WaiSubsiteRoute [Text]
    ps [(Text, Text)]
    qs) = ([Text]
    ps, [(Text, Text)]
    qs)
    instance ParseRoute WaiSubsite where
        parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsite)
    parseRoute ([Text]
    x, [(Text, Text)]
    y) = Route WaiSubsite -> Maybe (Route WaiSubsite)
    forall a. a -> Maybe a
    Just (Route WaiSubsite -> Maybe (Route WaiSubsite))
    -> Route WaiSubsite -> Maybe (Route WaiSubsite)
    forall a b. (a -> b) -> a -> b
    $ [Text] -> [(Text, Text)] -> Route WaiSubsite
    WaiSubsiteRoute [Text]
    x [(Text, Text)]
    y

    instance RenderRoute WaiSubsiteWithAuth where
      data Route WaiSubsiteWithAuth = WaiSubsiteWithAuthRoute [Text] [(Text,Text)]
           deriving (Int -> Route WaiSubsiteWithAuth -> ShowS
    [Route WaiSubsiteWithAuth] -> ShowS
    Route WaiSubsiteWithAuth -> String
    (Int -> Route WaiSubsiteWithAuth -> ShowS)
    -> (Route WaiSubsiteWithAuth -> String)
    -> ([Route WaiSubsiteWithAuth] -> ShowS)
    -> Show (Route WaiSubsiteWithAuth)
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Route WaiSubsiteWithAuth -> ShowS
    showsPrec :: Int -> Route WaiSubsiteWithAuth -> ShowS
    $cshow :: Route WaiSubsiteWithAuth -> String
    show :: Route WaiSubsiteWithAuth -> String
    $cshowList :: [Route WaiSubsiteWithAuth] -> ShowS
    showList :: [Route WaiSubsiteWithAuth] -> ShowS
    Show, Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool)
    -> (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool)
    -> Eq (Route WaiSubsiteWithAuth)
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    == :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    $c/= :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    /= :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    Eq, ReadPrec [Route WaiSubsiteWithAuth]
    ReadPrec (Route WaiSubsiteWithAuth)
    Int -> ReadS (Route WaiSubsiteWithAuth)
    ReadS [Route WaiSubsiteWithAuth]
    (Int -> ReadS (Route WaiSubsiteWithAuth))
    -> ReadS [Route WaiSubsiteWithAuth]
    -> ReadPrec (Route WaiSubsiteWithAuth)
    -> ReadPrec [Route WaiSubsiteWithAuth]
    -> Read (Route WaiSubsiteWithAuth)
    forall a.
    (Int -> ReadS a)
    -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
    $creadsPrec :: Int -> ReadS (Route WaiSubsiteWithAuth)
    readsPrec :: Int -> ReadS (Route WaiSubsiteWithAuth)
    $creadList :: ReadS [Route WaiSubsiteWithAuth]
    readList :: ReadS [Route WaiSubsiteWithAuth]
    $creadPrec :: ReadPrec (Route WaiSubsiteWithAuth)
    readPrec :: ReadPrec (Route WaiSubsiteWithAuth)
    $creadListPrec :: ReadPrec [Route WaiSubsiteWithAuth]
    readListPrec :: ReadPrec [Route WaiSubsiteWithAuth]
    Read, Eq (Route WaiSubsiteWithAuth)
    Eq (Route WaiSubsiteWithAuth) =>
    (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Ordering)
    -> (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool)
    -> (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool)
    -> (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool)
    -> (Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool)
    -> (Route WaiSubsiteWithAuth
        -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth)
    -> (Route WaiSubsiteWithAuth
        -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth)
    -> Ord (Route WaiSubsiteWithAuth)
    Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Ordering
    Route WaiSubsiteWithAuth
    -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Ordering
    compare :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Ordering
    $c< :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    < :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    $c<= :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    <= :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    $c> :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    > :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    $c>= :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    >= :: Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth -> Bool
    $cmax :: Route WaiSubsiteWithAuth
    -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth
    max :: Route WaiSubsiteWithAuth
    -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth
    $cmin :: Route WaiSubsiteWithAuth
    -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth
    min :: Route WaiSubsiteWithAuth
    -> Route WaiSubsiteWithAuth -> Route WaiSubsiteWithAuth
    Ord)
      renderRoute :: Route WaiSubsiteWithAuth -> ([Text], [(Text, Text)])
    renderRoute (WaiSubsiteWithAuthRoute [Text]
    ps [(Text, Text)]
    qs) = ([Text]
    ps,[(Text, Text)]
    qs)

    instance ParseRoute WaiSubsiteWithAuth where
      parseRoute :: ([Text], [(Text, Text)]) -> Maybe (Route WaiSubsiteWithAuth)
    parseRoute ([Text]
    x, [(Text, Text)]
    y) = Route WaiSubsiteWithAuth -> Maybe (Route WaiSubsiteWithAuth)
    forall a. a -> Maybe a
    Just (Route WaiSubsiteWithAuth -> Maybe (Route WaiSubsiteWithAuth))
    -> Route WaiSubsiteWithAuth -> Maybe (Route WaiSubsiteWithAuth)
    forall a b. (a -> b) -> a -> b
    $ [Text] -> [(Text, Text)] -> Route WaiSubsiteWithAuth
    WaiSubsiteWithAuthRoute [Text]
    x [(Text, Text)]
    y

    data Logger = Logger
        { Logger -> LoggerSet
    loggerSet :: !LoggerSet
        , Logger -> DateCacheGetter
    loggerDate :: !DateCacheGetter
        }

    loggerPutStr :: Logger -> LogStr -> IO ()
    loggerPutStr :: Logger -> LogStr -> IO ()
    loggerPutStr (Logger LoggerSet
    ls DateCacheGetter
    _) = LoggerSet -> LogStr -> IO ()
    pushLogStr LoggerSet
    ls

    -- | A handler monad for subsite
    --
    -- @since 1.6.0
    newtype SubHandlerFor sub master a = SubHandlerFor
        { forall sub master a.
    SubHandlerFor sub master a -> HandlerData sub master -> IO a
    unSubHandlerFor :: HandlerData sub master -> IO a
        }
        deriving (forall a b.
     (a -> b)
     -> SubHandlerFor sub master a -> SubHandlerFor sub master b)
    -> (forall a b.
        a -> SubHandlerFor sub master b -> SubHandlerFor sub master a)
    -> Functor (SubHandlerFor sub master)
    forall a b.
    a -> SubHandlerFor sub master b -> SubHandlerFor sub master a
    forall a b.
    (a -> b)
    -> SubHandlerFor sub master a -> SubHandlerFor sub master b
    forall sub master a b.
    a -> SubHandlerFor sub master b -> SubHandlerFor sub master a
    forall sub master a b.
    (a -> b)
    -> SubHandlerFor sub master a -> SubHandlerFor sub master b
    forall (f :: * -> *).
    (forall a b. (a -> b) -> f a -> f b)
    -> (forall a b. a -> f b -> f a) -> Functor f
    $cfmap :: forall sub master a b.
    (a -> b)
    -> SubHandlerFor sub master a -> SubHandlerFor sub master b
    fmap :: forall a b.
    (a -> b)
    -> SubHandlerFor sub master a -> SubHandlerFor sub master b
    $c<$ :: forall sub master a b.
    a -> SubHandlerFor sub master b -> SubHandlerFor sub master a
    <$ :: forall a b.
    a -> SubHandlerFor sub master b -> SubHandlerFor sub master a
    Functor

    instance Applicative (SubHandlerFor child master) where
        pure :: forall a. a -> SubHandlerFor child master a
    pure = (HandlerData child master -> IO a) -> SubHandlerFor child master a
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO a)
     -> SubHandlerFor child master a)
    -> (a -> HandlerData child master -> IO a)
    -> a
    -> SubHandlerFor child master a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IO a -> HandlerData child master -> IO a
    forall a b. a -> b -> a
    const (IO a -> HandlerData child master -> IO a)
    -> (a -> IO a) -> a -> HandlerData child master -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . a -> IO a
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        <*> :: forall a b.
    SubHandlerFor child master (a -> b)
    -> SubHandlerFor child master a -> SubHandlerFor child master b
    (<*>) = SubHandlerFor child master (a -> b)
    -> SubHandlerFor child master a -> SubHandlerFor child master b
    forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
    ap
    instance Monad (SubHandlerFor child master) where
        return :: forall a. a -> SubHandlerFor child master a
    return = a -> SubHandlerFor child master a
    forall a. a -> SubHandlerFor child master a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure
        SubHandlerFor HandlerData child master -> IO a
    x >>= :: forall a b.
    SubHandlerFor child master a
    -> (a -> SubHandlerFor child master b)
    -> SubHandlerFor child master b
    >>= a -> SubHandlerFor child master b
    f = (HandlerData child master -> IO b) -> SubHandlerFor child master b
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO b)
     -> SubHandlerFor child master b)
    -> (HandlerData child master -> IO b)
    -> SubHandlerFor child master b
    forall a b. (a -> b) -> a -> b
    $ \HandlerData child master
    r -> HandlerData child master -> IO a
    x HandlerData child master
    r IO a -> (a -> IO b) -> IO b
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \a
    x' -> SubHandlerFor child master b -> HandlerData child master -> IO b
    forall sub master a.
    SubHandlerFor sub master a -> HandlerData sub master -> IO a
    unSubHandlerFor (a -> SubHandlerFor child master b
    f a
    x') HandlerData child master
    r
    instance MonadIO (SubHandlerFor child master) where
        liftIO :: forall a. IO a -> SubHandlerFor child master a
    liftIO = (HandlerData child master -> IO a) -> SubHandlerFor child master a
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO a)
     -> SubHandlerFor child master a)
    -> (IO a -> HandlerData child master -> IO a)
    -> IO a
    -> SubHandlerFor child master a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . IO a -> HandlerData child master -> IO a
    forall a b. a -> b -> a
    const
    instance MonadReader (HandlerData child master) (SubHandlerFor child master) where
        ask :: SubHandlerFor child master (HandlerData child master)
    ask = (HandlerData child master -> IO (HandlerData child master))
    -> SubHandlerFor child master (HandlerData child master)
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor HandlerData child master -> IO (HandlerData child master)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return
        local :: forall a.
    (HandlerData child master -> HandlerData child master)
    -> SubHandlerFor child master a -> SubHandlerFor child master a
    local HandlerData child master -> HandlerData child master
    f (SubHandlerFor HandlerData child master -> IO a
    g) = (HandlerData child master -> IO a) -> SubHandlerFor child master a
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO a)
     -> SubHandlerFor child master a)
    -> (HandlerData child master -> IO a)
    -> SubHandlerFor child master a
    forall a b. (a -> b) -> a -> b
    $ HandlerData child master -> IO a
    g (HandlerData child master -> IO a)
    -> (HandlerData child master -> HandlerData child master)
    -> HandlerData child master
    -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData child master -> HandlerData child master
    f

    -- | @since 1.4.38
    instance MonadUnliftIO (SubHandlerFor child master) where
      {-# INLINE withRunInIO #-}
      withRunInIO :: forall b.
    ((forall a. SubHandlerFor child master a -> IO a) -> IO b)
    -> SubHandlerFor child master b
    withRunInIO (forall a. SubHandlerFor child master a -> IO a) -> IO b
    inner = (HandlerData child master -> IO b) -> SubHandlerFor child master b
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO b)
     -> SubHandlerFor child master b)
    -> (HandlerData child master -> IO b)
    -> SubHandlerFor child master b
    forall a b. (a -> b) -> a -> b
    $ \HandlerData child master
    x -> (forall a. SubHandlerFor child master a -> IO a) -> IO b
    inner ((forall a. SubHandlerFor child master a -> IO a) -> IO b)
    -> (forall a. SubHandlerFor child master a -> IO a) -> IO b
    forall a b. (a -> b) -> a -> b
    $ (SubHandlerFor child master a -> HandlerData child master -> IO a)
    -> HandlerData child master -> SubHandlerFor child master a -> IO a
    forall a b c. (a -> b -> c) -> b -> a -> c
    flip SubHandlerFor child master a -> HandlerData child master -> IO a
    forall sub master a.
    SubHandlerFor sub master a -> HandlerData sub master -> IO a
    unSubHandlerFor HandlerData child master
    x

    instance MonadThrow (SubHandlerFor child master) where
        throwM :: forall e a.
    (HasCallStack, Exception e) =>
    e -> SubHandlerFor child master a
    throwM = IO a -> SubHandlerFor child master a
    forall a. IO a -> SubHandlerFor child master a
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO a -> SubHandlerFor child master a)
    -> (e -> IO a) -> e -> SubHandlerFor child master a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . e -> IO a
    forall e a. (HasCallStack, Exception e) => e -> IO a
    forall (m :: * -> *) e a.
    (MonadThrow m, HasCallStack, Exception e) =>
    e -> m a
    throwM

    instance MonadResource (SubHandlerFor child master) where
        liftResourceT :: forall a. ResourceT IO a -> SubHandlerFor child master a
    liftResourceT ResourceT IO a
    f = (HandlerData child master -> IO a) -> SubHandlerFor child master a
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO a)
     -> SubHandlerFor child master a)
    -> (HandlerData child master -> IO a)
    -> SubHandlerFor child master a
    forall a b. (a -> b) -> a -> b
    $ ResourceT IO a -> InternalState -> IO a
    forall (m :: * -> *) a. ResourceT m a -> InternalState -> m a
    runInternalState ResourceT IO a
    f (InternalState -> IO a)
    -> (HandlerData child master -> InternalState)
    -> HandlerData child master
    -> IO a
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData child master -> InternalState
    forall child site. HandlerData child site -> InternalState
    handlerResource

    instance MonadLogger (SubHandlerFor child master) where
        monadLoggerLog :: forall msg.
    ToLogStr msg =>
    Loc -> Text -> LogLevel -> msg -> SubHandlerFor child master ()
    monadLoggerLog Loc
    a Text
    b LogLevel
    c msg
    d = (HandlerData child master -> IO ())
    -> SubHandlerFor child master ()
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master -> IO ())
     -> SubHandlerFor child master ())
    -> (HandlerData child master -> IO ())
    -> SubHandlerFor child master ()
    forall a b. (a -> b) -> a -> b
    $ \HandlerData child master
    sd ->
            RunHandlerEnv child master
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog (HandlerData child master -> RunHandlerEnv child master
    forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv HandlerData child master
    sd) Loc
    a Text
    b LogLevel
    c (msg -> LogStr
    forall msg. ToLogStr msg => msg -> LogStr
    toLogStr msg
    d)

    instance MonadLoggerIO (SubHandlerFor child master) where
        askLoggerIO :: SubHandlerFor
      child master (Loc -> Text -> LogLevel -> LogStr -> IO ())
    askLoggerIO = (HandlerData child master
     -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> SubHandlerFor
         child master (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall sub master a.
    (HandlerData sub master -> IO a) -> SubHandlerFor sub master a
    SubHandlerFor ((HandlerData child master
      -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
     -> SubHandlerFor
          child master (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> (HandlerData child master
        -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> SubHandlerFor
         child master (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall a b. (a -> b) -> a -> b
    $ (Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ((Loc -> Text -> LogLevel -> LogStr -> IO ())
     -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ()))
    -> (HandlerData child master
        -> Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> HandlerData child master
    -> IO (Loc -> Text -> LogLevel -> LogStr -> IO ())
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . RunHandlerEnv child master
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    forall child site.
    RunHandlerEnv child site
    -> Loc -> Text -> LogLevel -> LogStr -> IO ()
    rheLog (RunHandlerEnv child master
     -> Loc -> Text -> LogLevel -> LogStr -> IO ())
    -> (HandlerData child master -> RunHandlerEnv child master)
    -> HandlerData child master
    -> Loc
    -> Text
    -> LogLevel
    -> LogStr
    -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . HandlerData child master -> RunHandlerEnv child master
    forall child site.
    HandlerData child site -> RunHandlerEnv child site
    handlerEnv