Snap.Extension.Loader.Devel

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

Snap.Extension.Loader.Devel

Description

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.

Synopsis

- loadSnapTH :: Name -> Name -> [String] -> Q Exp
- loadSnapTH' :: [String] -> [String] -> [String] -> String -> Q Exp

# Documentation

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

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.

loadSnapTH'

Arguments

:: [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.