-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Creation of type-safe, RESTful web applications.
--   
--   API docs and the README are available at
--   <a>http://www.stackage.org/package/yesod</a>
@package yesod
@version 1.4.3

module Yesod.Default.Handlers
getFaviconR :: MonadHandler m => m ()
getRobotsR :: MonadHandler m => m ()


-- | Various utilities used in the scaffolded site.
module Yesod.Default.Util

-- | An implementation of <a>addStaticContent</a> which stores the contents
--   in an external file. Files are created in the given static folder with
--   names based on a hash of their content. This allows expiration dates
--   to be set far in the future without worry of users receiving stale
--   content.
addStaticContentExternal :: (ByteString -> Either a ByteString) -> (ByteString -> String) -> FilePath -> ([Text] -> Route master) -> Text -> Text -> ByteString -> HandlerT master IO (Maybe (Either Text (Route master, [(Text, Text)])))

-- | expects a file extension for each type, e.g: hamlet lucius julius
globFile :: String -> String -> FilePath
widgetFileNoReload :: WidgetFileSettings -> FilePath -> Q Exp
widgetFileReload :: WidgetFileSettings -> FilePath -> Q Exp
data TemplateLanguage
TemplateLanguage :: Bool -> String -> (FilePath -> Q Exp) -> (FilePath -> Q Exp) -> TemplateLanguage
[tlRequiresToWidget] :: TemplateLanguage -> Bool
[tlExtension] :: TemplateLanguage -> String
[tlNoReload] :: TemplateLanguage -> FilePath -> Q Exp
[tlReload] :: TemplateLanguage -> FilePath -> Q Exp
defaultTemplateLanguages :: HamletSettings -> [TemplateLanguage]
data WidgetFileSettings
wfsLanguages :: WidgetFileSettings -> HamletSettings -> [TemplateLanguage]
wfsHamletSettings :: WidgetFileSettings -> HamletSettings
instance Data.Default.Class.Default Yesod.Default.Util.WidgetFileSettings


-- | Some next-gen helper functions for the scaffolding's configuration
--   system.
module Yesod.Default.Config2

-- | Location of the default config file.
configSettingsYml :: FilePath

-- | Helper for getApplicationDev in the scaffolding. Looks up PORT and
--   DISPLAY_PORT and prints appropriate messages.
getDevSettings :: Settings -> IO Settings

-- | Helper for develMain in the scaffolding.
develMainHelper :: IO (Settings, Application) -> IO ()

-- | Create a <a>Logger</a> value (from yesod-core) out of a
--   <a>LoggerSet</a> (from fast-logger).
makeYesodLogger :: LoggerSet -> IO Logger

-- | A convenience wrapper around <a>applyEnvValue</a> and
--   <a>getCurrentEnv</a>
applyCurrentEnv :: Bool -> Value -> IO Value

-- | Get the actual environment as a <tt>HashMap</tt> from <tt>Text</tt> to
--   <tt>Text</tt>.
getCurrentEnv :: IO (HashMap Text Text)

-- | Override environment variable placeholders in the given <tt>Value</tt>
--   with values from the environment.
--   
--   If the first argument is <tt>True</tt>, then all placeholders _must_
--   be provided by the actual environment. Otherwise, default values from
--   the <tt>Value</tt> will be used.
applyEnvValue :: Bool -> HashMap Text Text -> Value -> Value

-- | Load the settings from the following three sources:
--   
--   <ul>
--   <li>Run time config files</li>
--   <li>Run time environment variables</li>
--   <li>The default compile time config file</li>
--   </ul>
--   
--   For example, to load up settings from <tt>config/foo.yaml</tt> and
--   allow overriding from the actual environment, you can use:
--   
--   <pre>
--   loadYamlSettings ["config/foo.yaml"] [] useEnv
--   </pre>
loadYamlSettings :: FromJSON settings => [FilePath] -> [Value] -> EnvUsage -> IO settings

-- | Same as <tt>loadYamlSettings</tt>, but get the list of runtime config
--   files from the command line arguments.
loadYamlSettingsArgs :: FromJSON settings => [Value] -> EnvUsage -> IO settings

-- | Defines how we want to use the environment variables when loading a
--   config file. Use the smart constructors provided by this module.
data EnvUsage :: *

-- | Do not use any environment variables, instead relying on defaults
--   values in the config file.
ignoreEnv :: EnvUsage

-- | Use environment variables when available, otherwise use defaults.
useEnv :: EnvUsage

-- | Do not use default values from the config file, but instead take all
--   overrides from the environment. If a value is missing, loading the
--   file will throw an exception.
requireEnv :: EnvUsage

-- | Same as <a>useEnv</a>, but instead of the actual environment, use the
--   provided <tt>HashMap</tt> as the environment.
useCustomEnv :: HashMap Text Text -> EnvUsage

-- | Same as <a>requireEnv</a>, but instead of the actual environment, use
--   the provided <tt>HashMap</tt> as the environment.
requireCustomEnv :: HashMap Text Text -> EnvUsage
newtype MergedValue
MergedValue :: Value -> MergedValue
[getMergedValue] :: MergedValue -> Value

-- | Load the settings from the following three sources:
--   
--   <ul>
--   <li>Run time config files</li>
--   <li>Run time environment variables</li>
--   <li>The default compile time config file</li>
--   </ul>

-- | <i>Deprecated: Use loadYamlSettings</i>
loadAppSettings :: FromJSON settings => [FilePath] -> [Value] -> EnvUsage -> IO settings

-- | Same as <tt>loadAppSettings</tt>, but get the list of runtime config
--   files from the command line arguments.

-- | <i>Deprecated: Use loadYamlSettingsArgs</i>
loadAppSettingsArgs :: FromJSON settings => [Value] -> EnvUsage -> IO settings
instance Data.Semigroup.Semigroup Yesod.Default.Config2.MergedValue

module Yesod.Default.Config

-- | A yesod-provided <tt><tt>AppEnv</tt></tt>, allows for Development,
--   Testing, and Production environments
data DefaultEnv
Development :: DefaultEnv
Testing :: DefaultEnv
Staging :: DefaultEnv
Production :: DefaultEnv

-- | Load the app config from command line parameters
fromArgs :: (Read env, Show env, Enum env, Bounded env) => (env -> Object -> Parser extra) -> IO (AppConfig env extra)

-- | Load the app config from command line parameters, using the given
--   @ConfigSettings.
--   
--   Since 1.2.2
fromArgsSettings :: (Read env, Show env, Enum env, Bounded env) => (env -> IO (ConfigSettings env extra)) -> IO (AppConfig env extra)

-- | Load your development config (when using <tt><a>DefaultEnv</a></tt>)
loadDevelopmentConfig :: IO (AppConfig DefaultEnv ())

-- | Dynamic per-environment configuration which can be loaded at run-time
--   negating the need to recompile between environments.
data AppConfig environment extra
AppConfig :: environment -> Int -> Text -> HostPreference -> extra -> AppConfig environment extra
[appEnv] :: AppConfig environment extra -> environment
[appPort] :: AppConfig environment extra -> Int
[appRoot] :: AppConfig environment extra -> Text
[appHost] :: AppConfig environment extra -> HostPreference
[appExtra] :: AppConfig environment extra -> extra
data ConfigSettings environment extra
ConfigSettings :: environment -> (environment -> Object -> Parser extra) -> (environment -> IO FilePath) -> (environment -> Value -> IO Value) -> ConfigSettings environment extra

-- | An arbitrary value, used below, to indicate the current running
--   environment. Usually, you will use <a>DefaultEnv</a> for this type.
[csEnv] :: ConfigSettings environment extra -> environment

-- | Load any extra data, to be used by the application.
[csParseExtra] :: ConfigSettings environment extra -> environment -> Object -> Parser extra

-- | Return the path to the YAML config file.
[csFile] :: ConfigSettings environment extra -> environment -> IO FilePath

-- | Get the sub-object (if relevant) from the given YAML source which
--   contains the specific settings for the current environment.
[csGetObject] :: ConfigSettings environment extra -> environment -> Value -> IO Value

-- | Default config settings.
configSettings :: Show env => env -> ConfigSettings env ()

-- | Load an <tt><a>AppConfig</a></tt>.
--   
--   Some examples:
--   
--   <pre>
--   -- typical local development
--   Development:
--     host: localhost
--     port: 3000
--   
--     -- approot: will default to ""
--   </pre>
--   
--   <pre>
--   -- typical outward-facing production box
--   Production:
--     host: www.example.com
--   
--     -- port: will default 80
--     -- host: will default to "*"
--     -- approot: will default "http://www.example.com"
--   </pre>
--   
--   <pre>
--   -- maybe you're reverse proxying connections to the running app
--   -- on some other port
--   Production:
--     port: 8080
--     approot: "http://example.com"
--     host: "localhost"
--   </pre>
loadConfig :: ConfigSettings environment extra -> IO (AppConfig environment extra)

-- | Loads the configuration block in the passed file named by the passed
--   environment, yields to the passed function as a mapping.
--   
--   Errors in the case of a bad load or if your function returns
--   <tt>Nothing</tt>.
withYamlEnvironment :: Show e => FilePath -> e -> (Value -> Parser a) -> IO a
instance (GHC.Show.Show environment, GHC.Show.Show extra) => GHC.Show.Show (Yesod.Default.Config.AppConfig environment extra)
instance GHC.Show.Show env => GHC.Show.Show (Yesod.Default.Config.ArgConfig env)
instance GHC.Enum.Bounded Yesod.Default.Config.DefaultEnv
instance GHC.Enum.Enum Yesod.Default.Config.DefaultEnv
instance GHC.Show.Show Yesod.Default.Config.DefaultEnv
instance GHC.Read.Read Yesod.Default.Config.DefaultEnv

module Yesod.Default.Main

-- | Run your app, taking environment and port settings from the
--   commandline.
--   
--   <tt><a>fromArgs</a></tt> helps parse a custom configuration
--   
--   <pre>
--   main :: IO ()
--   main = defaultMain (fromArgs parseExtra) makeApplication
--   </pre>
defaultMain :: (Show env, Read env) => IO (AppConfig env extra) -> (AppConfig env extra -> IO Application) -> IO ()

-- | Same as <tt>defaultMain</tt>, but gets a logging function back as well
--   as an <tt>Application</tt> to install Warp exception handlers.
--   
--   Since 1.2.5
defaultMainLog :: (Show env, Read env) => IO (AppConfig env extra) -> (AppConfig env extra -> IO (Application, LogFunc)) -> IO ()

-- | Run your application continously, listening for SIGINT and exiting
--   when received
--   
--   <pre>
--   withYourSite :: AppConfig DefaultEnv -&gt; Logger -&gt; (Application -&gt; IO a) -&gt; IO ()
--   withYourSite conf logger f = do
--       Settings.withConnectionPool conf $ \p -&gt; do
--           runConnectionPool (runMigration yourMigration) p
--           defaultRunner f $ YourSite conf logger p
--   </pre>
defaultRunner :: (Application -> IO ()) -> Application -> IO ()

-- | Run your development app using a custom environment type and loader
--   function
defaultDevelApp :: (Show env, Read env) => IO (AppConfig env extra) -> (AppConfig env extra -> IO Application) -> IO (Int, Application)
type LogFunc = Loc -> LogSource -> LogLevel -> LogStr -> IO ()


-- | This module simply re-exports from other modules for your convenience.
module Yesod
