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


-- | Haskell utilities for building embedded Elm programs.
--   
--   This package provides utilities for serving Elm programs directly from
--   your Haskell binary. It uses TemplateHaskell to compile your Elm
--   program at build time, and construct a WAI Middleware which intercepts
--   requests appropriate to the Elm program, and passing other requests to
--   a downstream WAI Application. It is useful for bundling the browser
--   side of a web application with its backing web services
--   implementation.
@package om-elm
@version 1.0.0.3


-- | This module contains utilities for compiling and bundling Elm programs
--   directly into your Haskell executable binary. It is useful for the
--   case where you want to bundle a front-end Elm web app along with the
--   backing services that support it, and especially for when the two
--   components are part of the same codebase. It produces WAI Middleware,
--   and is thus compatible with a wide range server-side frameworks.
--   
--   Usage is designed to be as simple as possible. There are 3 steps:
--   
--   1) Change your .cabal file to use a "Custom" build type, and add the
--   appropriate custom build dependencies.
--   
--   <pre>
--   build-type: Custom
--   ...
--   custom-setup
--     setup-depends:
--       Cabal,
--       base,
--       om-elm
--   </pre>
--   
--   2) Modify your <tt>Setup.hs</tt> file, using <a>requireElm</a>.
--   
--   3) Include a <a>Middleware</a> template-haskell splice, using
--   <a>elmSite</a>, in the appropriate place in your code.
--   
--   See the function documnetation for more details.
module System.Elm.Middleware

-- | Add the elm-make program requirements to a set of build hooks. This is
--   expected to be used in your Setup.hs file thusly:
--   
--   <pre>
--   import Distribution.Simple (defaultMainWithHooks, simpleUserHooks)
--   import System.Elm.Middleware (requireElm)
--   
--   main = defaultMainWithHooks (requireElm simpleUserHooks)
--   </pre>
requireElm :: UserHooks -> UserHooks

-- | Template Haskell method to create a <a>Middleware</a> that serves a
--   set of elm programs. The elm programs are compiled into HTML at
--   compile time, and that HTML is included directly in your executable.
--   
--   The parameter is a map of <a>pathInfo</a>s to elm program module file.
--   The elm program located at the file is served whenever the pathInfo
--   matches that of the request. Any non-matching request is forwarded to
--   the downstream <a>Application</a>.
--   
--   The typed template-haskell splice:
--   
--   <pre>
--   $$(elmSite $ Map.fromList [
--       (["app.js"], "elm/Your/Elm/Module/App.elm")
--     ])
--   </pre>
--   
--   will construct a WAI <a>Middleware</a> which serves the compiled elm
--   program on <tt>/app.js</tt>.
elmSite :: Map PathInfo FilePath -> Q (TExp Middleware)

-- | Like <a>elmSite</a>, but serve the debug elm runtime.
elmSiteDebug :: Map PathInfo FilePath -> Q (TExp Middleware)

-- | A WAI uri path, as per the meaning of <a>pathInfo</a>.
type PathInfo = [Text]
