snap-0.5.4: Snap: A Haskell Web Framework: project starter executable and glue code library



This module includes the machinery necessary to use hint to load action code dynamically. It includes a Template Haskell function to gather the necessary compile-time information about code location, compiler arguments, etc, and bind that information into the calls to the dynamic loader.



loadSnapTH :: Name -> Name -> [String] -> Q ExpSource

This function derives all the information necessary to use the interpreter from the compile-time environment, and compiles it in to the generated code.

This could be considered a TH wrapper around a function

 loadSnap :: Initializer s -> SnapExtend s () -> [String] -> IO (Snap ())

with a magical implementation.

The upshot is that you shouldn't need to recompile your server during development unless your .cabal file changes, or the code that uses this splice changes.



:: [String]

the list of modules to interpret

-> [String]

the list of modules to import in addition to those being interpreted

-> [String]

additional directories to watch for changes to trigger to recompile/reload

-> String

the expression to interpret in the context of the loaded modules and imports. It should have the type HintLoadable

-> Q Exp 

This is the backing implementation for loadSnapTH. This interface can be used when the types involved don't include a SnapExtend and an Initializer.