View
@@ -56,35 +56,35 @@ import Snap.Snaplet.Internal.Types
------------------------------------------------------------------------------
-- | 'get' for InitializerState.
-iGet :: Initializer b e (InitializerState b)
+iGet :: Initializer b v (InitializerState b)
iGet = Initializer $ getBase
------------------------------------------------------------------------------
-- | 'get' for InitializerState.
-iPut :: InitializerState b -> Initializer b e ()
+iPut :: InitializerState b -> Initializer b v ()
iPut s = Initializer $ putBase s
------------------------------------------------------------------------------
-- | 'modify' for InitializerState.
-iModify :: (InitializerState b -> InitializerState b) -> Initializer b e ()
+iModify :: (InitializerState b -> InitializerState b) -> Initializer b v ()
iModify f = Initializer $ do
b <- getBase
putBase $ f b
------------------------------------------------------------------------------
-- | 'gets' for InitializerState.
-iGets :: (InitializerState b -> a) -> Initializer b e a
+iGets :: (InitializerState b -> a) -> Initializer b v a
iGets f = Initializer $ do
b <- getBase
return $ f b
------------------------------------------------------------------------------
-- | Converts a plain hook into a Snaplet hook.
-toSnapletHook :: (e -> IO e) -> (Snaplet e -> IO (Snaplet e))
+toSnapletHook :: (v -> IO v) -> (Snaplet v -> IO (Snaplet v))
toSnapletHook f (Snaplet cfg val) = do
val' <- f val
return $! Snaplet cfg val'
@@ -98,7 +98,7 @@ toSnapletHook f (Snaplet cfg val) = do
-- define its views. The Heist snaplet provides the 'addTemplates' function
-- which allows other snaplets to set up their own templates. 'addTemplates'
-- is implemented using this function.
-addPostInitHook :: (e -> IO e) -> Initializer b e ()
+addPostInitHook :: (v -> IO v) -> Initializer b v ()
addPostInitHook h = do
h' <- upHook $ toSnapletHook h
addPostInitHookBase' h'
@@ -107,29 +107,29 @@ addPostInitHook h = do
------------------------------------------------------------------------------
-- | Adds an IO action that modifies the application state to be run at the
-- end of initialization.
-addPostInitHookBase :: (b -> IO b) -> Initializer b e ()
+addPostInitHookBase :: (b -> IO b) -> Initializer b v ()
addPostInitHookBase = Initializer . lift . tell . Hook . toSnapletHook
------------------------------------------------------------------------------
addPostInitHookBase' :: (Snaplet b -> IO (Snaplet b))
- -> Initializer b e ()
+ -> Initializer b v ()
addPostInitHookBase' = Initializer . lift . tell . Hook
------------------------------------------------------------------------------
-- | Helper function for transforming hooks.
-upHook :: (Snaplet e -> IO (Snaplet e))
- -> Initializer b e (Snaplet b -> IO (Snaplet b))
+upHook :: (Snaplet v -> IO (Snaplet v))
+ -> Initializer b v (Snaplet b -> IO (Snaplet b))
upHook h = Initializer $ do
l <- ask
- return $ (\b -> do e <- h (getL l b)
- return $ setL l e b)
+ return $ (\b -> do v <- h (getL l b)
+ return $ setL l v b)
------------------------------------------------------------------------------
-- | Modifies the Initializer's SnapletConfig.
-modifyCfg :: (SnapletConfig -> SnapletConfig) -> Initializer b e ()
+modifyCfg :: (SnapletConfig -> SnapletConfig) -> Initializer b v ()
modifyCfg f = iModify $ modL curConfig $ \c -> f c
@@ -142,7 +142,7 @@ setupFilesystem :: Maybe (IO FilePath)
-- that need to be installed.
-> FilePath
-- ^ Directory where the files should be copied.
- -> Initializer b e ()
+ -> Initializer b v ()
setupFilesystem Nothing _ = return ()
setupFilesystem (Just getSnapletDataDir) targetDir = do
exists <- liftIO $ doesDirectoryExist targetDir
@@ -164,7 +164,7 @@ setupFilesystem (Just getSnapletDataDir) targetDir = do
-- this:
--
-- @
--- fooInit :: Initializer b e (Snaplet Foo)
+-- fooInit :: Initializer b v (Snaplet Foo)
-- fooInit = makeSnaplet \"foo\" Nothing $ do
-- -- Your initializer code here
-- return $ Foo 42
@@ -183,9 +183,9 @@ makeSnaplet :: Text
-- value to Nothing doesn't preclude the snaplet from having files in
-- in the filesystem, it just means that they won't be copied there
-- automatically.
- -> Initializer b e e
+ -> Initializer b v v
-- ^ Snaplet initializer.
- -> SnapletInit b e
+ -> SnapletInit b v
makeSnaplet snapletId desc getSnapletDataDir m = SnapletInit $ do
modifyCfg $ \c -> if isNothing $ _scId c
then setL scId (Just snapletId) c else c
@@ -216,7 +216,7 @@ makeSnaplet snapletId desc getSnapletDataDir m = SnapletInit $ do
------------------------------------------------------------------------------
-- | Internal function that gets the SnapletConfig out of the initializer
-- state and uses it to create a (Snaplet a).
-mkSnaplet :: Initializer b e a -> Initializer b e (Snaplet a)
+mkSnaplet :: Initializer b v a -> Initializer b v (Snaplet a)
mkSnaplet m = do
res <- m
cfg <- iGets _curConfig
@@ -226,7 +226,7 @@ mkSnaplet m = do
------------------------------------------------------------------------------
-- | Brackets an initializer computation, restoring curConfig after the
-- computation returns.
-bracketInit :: Initializer b e a -> Initializer b e a
+bracketInit :: Initializer b v a -> Initializer b v a
bracketInit m = do
s <- iGet
res <- m
@@ -250,11 +250,11 @@ setupSnapletCall rte = do
nestSnaplet :: ByteString
-- ^ The root url for all the snaplet's routes. An empty string
-- gives the routes the same root as the parent snaplet's routes.
- -> (e :-> Snaplet e1)
+ -> (v :-> Snaplet v1)
-- ^ Lens identifying the snaplet
- -> SnapletInit b e1
+ -> SnapletInit b v1
-- ^ The initializer function for the subsnaplet.
- -> Initializer b e (Snaplet e1)
+ -> Initializer b v (Snaplet v1)
nestSnaplet rte l (SnapletInit snaplet) = with l $ bracketInit $ do
setupSnapletCall rte
snaplet
@@ -266,11 +266,11 @@ nestSnaplet rte l (SnapletInit snaplet) = with l $ bracketInit $ do
embedSnaplet :: ByteString
-- ^ The root url for all the snaplet's routes. An empty string
-- gives the routes the same root as the parent snaplet's routes.
- -> (e :-> Snaplet e1)
+ -> (v :-> Snaplet v1)
-- ^ Lens identifying the snaplet
- -> SnapletInit e1 e1
+ -> SnapletInit v1 v1
-- ^ The initializer function for the subsnaplet.
- -> Initializer b e (Snaplet e1)
+ -> Initializer b v (Snaplet v1)
embedSnaplet rte l (SnapletInit snaplet) = do
curLens <- getLens
setupSnapletCall rte
@@ -283,9 +283,9 @@ embedSnaplet rte l (SnapletInit snaplet) = do
-- NOTE: You shouldn't use bracketInit with this function as in nestSnaplet
-- because that is handled by the implementation.
chroot :: ByteString
- -> (Snaplet b :-> Snaplet e1)
- -> Initializer e1 e1 a
- -> Initializer b e a
+ -> (Snaplet b :-> Snaplet v1)
+ -> Initializer v1 v1 a
+ -> Initializer b v a
chroot rte l (Initializer m) = do
curState <- iGet
((a,s), (Hook hook)) <- liftIO $ runWriterT $ runLensT m id $
@@ -301,8 +301,8 @@ chroot rte l (Initializer m) = do
------------------------------------------------------------------------------
-- | Changes the base state of a handler.
-chrootHandler :: (Snaplet e :-> Snaplet t)
- -> Handler t t a -> Handler b e a
+chrootHandler :: (Snaplet v :-> Snaplet b')
+ -> Handler b' b' a -> Handler b v a
chrootHandler l (Handler h) = Handler $ do
s <- get
(a, s') <- liftSnap $ runLensT h id (getL l s)
@@ -320,9 +320,9 @@ chrootHandler l (Handler h) = Handler $ do
-- @fooState <- nestSnaplet \"fooA\" $ nameSnaplet \"myFoo\" $ fooInit@
nameSnaplet :: Text
-- ^ The snaplet name
- -> SnapletInit b e
+ -> SnapletInit b v
-- ^ The snaplet initializer function
- -> SnapletInit b e
+ -> SnapletInit b v
nameSnaplet nm (SnapletInit m) = SnapletInit $
modifyCfg (setL scId (Just nm)) >> m
@@ -331,28 +331,28 @@ nameSnaplet nm (SnapletInit m) = SnapletInit $
-- | Adds routing to the current 'Handler'. The new routes are merged with the
-- main routing section and take precedence over existing routing that was
-- previously defined.
-addRoutes :: [(ByteString, Handler b e ())]
- -> Initializer b e ()
+addRoutes :: [(ByteString, Handler b v ())]
+ -> Initializer b v ()
addRoutes rs = do
l <- getLens
ctx <- iGets (_scRouteContext . _curConfig)
let rs' = map (\(r,h) -> (buildPath (r:ctx), withTop' l h)) rs
- iModify (\e -> modL handlers (++rs') e)
+ iModify (\v -> modL handlers (++rs') v)
------------------------------------------------------------------------------
-- | Wraps the snaplet's routing. This can be used to provide a snaplet that
-- does per-request setup and cleanup, but then dispatches to the rest of the
-- application.
-wrapHandlers :: (Handler b e () -> Handler b e ()) -> Initializer b e ()
+wrapHandlers :: (Handler b v () -> Handler b v ()) -> Initializer b v ()
wrapHandlers f0 = do
f <- mungeFilter f0
- iModify (\e -> modL hFilter (f.) e)
+ iModify (\v -> modL hFilter (f.) v)
------------------------------------------------------------------------------
-mungeFilter :: (Handler b e () -> Handler b e ())
- -> Initializer b e (Handler b b () -> Handler b b ())
+mungeFilter :: (Handler b v () -> Handler b v ())
+ -> Initializer b v (Handler b b () -> Handler b b ())
mungeFilter f = do
myLens <- Initializer ask
return $ \m -> b myLens $ f' m
@@ -365,8 +365,8 @@ mungeFilter f = do
------------------------------------------------------------------------------
-- | Attaches an unload handler to the snaplet. The unload handler will be
-- called when the server shuts down, or is reloaded.
-onUnload :: IO () -> Initializer b e ()
-onUnload m = iModify (\e -> modL cleanup (m>>) e)
+onUnload :: IO () -> Initializer b v ()
+onUnload m = iModify (\v -> modL cleanup (m>>) v)
------------------------------------------------------------------------------
@@ -380,7 +380,7 @@ logInitMsg ref msg = atomicModifyIORef ref (\cur -> (cur `T.append` msg, ()))
-- messages to be displayed to the user. On application startup they will be
-- sent to the console. When executed from the reloader, they will be sent
-- back to the user in the HTTP response.
-printInfo :: Text -> Initializer b e ()
+printInfo :: Text -> Initializer b v ()
printInfo msg = do
logRef <- iGets _initMessages
liftIO $ logInitMsg logRef (msg `T.append` "\n")
View
@@ -20,7 +20,7 @@ import Snap.Types
import Snap.Snaplet.Internal.RST
-newtype LensT b e s m a = LensT (RST (b :-> e) s m a)
+newtype LensT b v s m a = LensT (RST (b :-> v) s m a)
deriving ( Monad
, MonadTrans
, Functor
@@ -29,30 +29,30 @@ newtype LensT b e s m a = LensT (RST (b :-> e) s m a)
, MonadPlus
, MonadCatchIO
, Alternative
- , MonadReader (b :-> e)
+ , MonadReader (b :-> v)
, MonadSnap )
------------------------------------------------------------------------------
-instance (Monad m) => MonadState e (LensT b e b m) where
+instance (Monad m) => MonadState v (LensT b v b m) where
get = lGet
put = lPut
------------------------------------------------------------------------------
-getBase :: (Monad m) => LensT b e s m s
+getBase :: (Monad m) => LensT b v s m s
getBase = LensT get
{-# INLINE getBase #-}
------------------------------------------------------------------------------
-putBase :: (Monad m) => s -> LensT b e s m ()
+putBase :: (Monad m) => s -> LensT b v s m ()
putBase = LensT . put
{-# INLINE putBase #-}
------------------------------------------------------------------------------
-lGet :: (Monad m) => LensT b e b m e
+lGet :: (Monad m) => LensT b v b m v
lGet = LensT $ do
!l <- ask
!b <- get
@@ -61,18 +61,18 @@ lGet = LensT $ do
------------------------------------------------------------------------------
-lPut :: (Monad m) => e -> LensT b e b m ()
-lPut e = LensT $ do
+lPut :: (Monad m) => v -> LensT b v b m ()
+lPut v = LensT $ do
!l <- ask
!b <- get
- put $! setL l e b
+ put $! setL l v b
{-# INLINE lPut #-}
------------------------------------------------------------------------------
runLensT :: (Monad m) =>
- LensT b e s m a
- -> b :-> e
+ LensT b v s m a
+ -> b :-> v
-> s
-> m (a, s)
runLensT (LensT m) = runRST m
@@ -81,31 +81,31 @@ runLensT (LensT m) = runRST m
------------------------------------------------------------------------------
withLens :: Monad m =>
- (e :-> e')
- -> LensT b e' s m a
- -> LensT b e s m a
+ (v :-> v')
+ -> LensT b v' s m a
+ -> LensT b v s m a
withLens !subLens = withLensT (subLens .)
{-# INLINE withLens #-}
------------------------------------------------------------------------------
withLensT :: Monad m =>
- ((b' :-> e') -> (b :-> e))
- -> LensT b e s m a
- -> LensT b' e' s m a
+ ((b' :-> v') -> (b :-> v))
+ -> LensT b v s m a
+ -> LensT b' v' s m a
withLensT f (LensT m) = LensT $ withRST f m
{-# INLINE withLensT #-}
------------------------------------------------------------------------------
-modLens :: (b :-> e) -> LensT b e s m a -> LensT b' e' s m a
+modLens :: (b :-> v) -> LensT b v s m a -> LensT b' v' s m a
modLens l (LensT m) = LensT $ modR l m
{-# INLINE modLens #-}
------------------------------------------------------------------------------
downcast :: (Monad m) =>
LensT b b s m a
- -> LensT b e s m a
+ -> LensT b v s m a
downcast (LensT m) = LensT $ RST $ \_ -> runRST m id
View
@@ -91,84 +91,84 @@ subSnaplet = (. value)
class MonadSnaplet m where
-- | Runs a child snaplet action in a parent snaplet's monad. The
-- supplied lens defines the state type to use.
- with :: (e :-> Snaplet e') -> m b e' a -> m b e a
+ with :: (v :-> Snaplet v') -> m b v' a -> m b v a
with = with' . subSnaplet
-- | Like 'with' but doesn't impose the requirement that the action
-- being run be a descendant of the current snaplet.
- withTop :: (b :-> Snaplet e') -> m b e' a -> m b e a
+ withTop :: (b :-> Snaplet v') -> m b v' a -> m b v a
withTop l = withTop' (subSnaplet l)
-- | A variant of with accepting another kind of lens formulation
-- that has an identity. The lenses generated by 'mkLabels' will not
-- work with this function, however the lens returned by 'getLens' will.
--
-- @with = with' . subSnaplet@
- with' :: (Snaplet e :-> Snaplet e') -> m b e' a -> m b e a
+ with' :: (Snaplet v :-> Snaplet v') -> m b v' a -> m b v a
-- Not providing a definition for this function in terms of withTop'
-- allows us to avoid extra Monad type class constraints, making the type
-- signature easier to read.
-- with' l m = flip withTop m . (l .) =<< getLens
-- | The sibling version of 'with''
- withTop' :: (Snaplet b :-> Snaplet e') -> m b e' a -> m b e a
+ withTop' :: (Snaplet b :-> Snaplet v') -> m b v' a -> m b v a
-- | Gets the lens for the current snaplet.
- getLens :: m b e (Snaplet b :-> Snaplet e)
+ getLens :: m b v (Snaplet b :-> Snaplet v)
-- | Gets a list of the names of snaplets that are direct ancestors of the
-- current snaplet.
- getSnapletAncestry :: m b e [Text]
+ getSnapletAncestry :: m b v [Text]
-- | Gets the snaplet's path on the filesystem.
- getSnapletFilePath :: m b e FilePath
+ getSnapletFilePath :: m b v FilePath
-- | Gets the current snaple's name.
- getSnapletName :: m b e (Maybe Text)
+ getSnapletName :: m b v (Maybe Text)
-- | Gets the current snaple's name.
- getSnapletDescription :: m b e Text
+ getSnapletDescription :: m b v Text
-- | Gets the config data structure for the current snaplet.
- getSnapletConfig :: m b e Config
+ getSnapletConfig :: m b v Config
-- | Gets the base URL for the current snaplet. Directories get added to
-- the current snaplet path by calls to `nestSnaplet`.
- getSnapletRootURL :: m b e ByteString
+ getSnapletRootURL :: m b v ByteString
-wrap' :: (MonadSnaplet m, Monad (m b b), Monad (m b e'))
- => (m b e a -> m b e' a)
- -> (m b e a -> m b e a)
- -> (m b e' a -> m b e' a)
+wrap' :: (MonadSnaplet m, Monad (m b b), Monad (m b v'))
+ => (m b v a -> m b v' a)
+ -> (m b v a -> m b v a)
+ -> (m b v' a -> m b v' a)
wrap' proj _filter m = do
currentLens <- getLens
proj (_filter (withTop' currentLens m))
------------------------------------------------------------------------------
-- | Applies a "filter" style function on snaplet monads with a descendent
-- snaplet.
-wrap :: (MonadSnaplet m, Monad (m b b), Monad (m b e'))
- => (Snaplet e' :-> Snaplet e)
- -> (m b e a -> m b e a)
- -> (m b e' a -> m b e' a)
+wrap :: (MonadSnaplet m, Monad (m b b), Monad (m b v'))
+ => (Snaplet v' :-> Snaplet v)
+ -> (m b v a -> m b v a)
+ -> (m b v' a -> m b v' a)
wrap l = wrap' (with' l)
------------------------------------------------------------------------------
-- | Applies a "filter" style function on snaplet monads with a sibling
-- snaplet.
-wrapTop :: (MonadSnaplet m, Monad (m b b), Monad (m b e'))
- => (Snaplet b :-> Snaplet e)
- -> (m b e a -> m b e a)
- -> (m b e' a -> m b e' a)
+wrapTop :: (MonadSnaplet m, Monad (m b b), Monad (m b v'))
+ => (Snaplet b :-> Snaplet v)
+ -> (m b v a -> m b v a)
+ -> (m b v' a -> m b v' a)
wrapTop l = wrap' (withTop' l)
------------------------------------------------------------------------------
-newtype Handler b e a =
- Handler (LensT (Snaplet b) (Snaplet e) (Snaplet b) Snap a)
+newtype Handler b v a =
+ Handler (LensT (Snaplet b) (Snaplet v) (Snaplet b) Snap a)
deriving ( Monad
, Functor
, Applicative
@@ -185,7 +185,7 @@ type family Base (m :: * -> *) :: *
type family Env (m :: * -> *) :: *
-hConfig :: Handler b e SnapletConfig
+hConfig :: Handler b v SnapletConfig
hConfig = Handler $ liftM _snapletConfig get
@@ -205,7 +205,7 @@ instance MonadSnaplet Handler where
------------------------------------------------------------------------------
-- | Handler that reloads the site.
-reloadSite :: Handler b e ()
+reloadSite :: Handler b v ()
reloadSite = failIfNotLocal $ do
cfg <- hConfig
!res <- liftIO $ _reloader cfg
@@ -256,9 +256,9 @@ instance Monoid (Hook a) where
------------------------------------------------------------------------------
-- | Monad used for initializing snaplets.
-newtype Initializer b e a =
+newtype Initializer b v a =
Initializer (LensT (Snaplet b)
- (Snaplet e)
+ (Snaplet v)
(InitializerState b)
(WriterT (Hook b) IO)
a)
@@ -267,7 +267,7 @@ newtype Initializer b e a =
mkLabels [''InitializerState]
-iConfig :: Initializer b e SnapletConfig
+iConfig :: Initializer b v SnapletConfig
iConfig = Initializer $ liftM _curConfig getBase
@@ -289,7 +289,7 @@ instance MonadSnaplet Initializer where
------------------------------------------------------------------------------
-- | Opaque newtype which gives us compile-time guarantees that the user is
-- using makeSnaplet and nestSnaplet correctly.
-newtype SnapletInit b e = SnapletInit (Initializer b e (Snaplet e))
+newtype SnapletInit b v = SnapletInit (Initializer b v (Snaplet v))
------------------------------------------------------------------------------
@@ -303,17 +303,17 @@ data ReloadInfo b = ReloadInfo
------------------------------------------------------------------------------
-instance MonadState e (Handler b e) where
+instance MonadState v (Handler b v) where
get = liftM _value lhGet
put v = do
s <- lhGet
lhPut $ s { _value = v }
-lhGet :: Handler b e (Snaplet e)
+lhGet :: Handler b v (Snaplet v)
lhGet = Handler get
{-# INLINE lhGet #-}
-lhPut :: Snaplet e -> Handler b e ()
+lhPut :: Snaplet v -> Handler b v ()
lhPut = Handler . put
{-# INLINE lhPut #-}
View
@@ -37,7 +37,7 @@ import qualified Snap.Snaplet.Session.SessionManager as SM
-- | Wrap around a handler, committing any changes in the session at the end
-withSession :: (b :-> Snaplet SessionManager) -> Handler b e a -> Handler b e a
+withSession :: (b :-> Snaplet SessionManager) -> Handler b v a -> Handler b v a
withSession l h = do
a <- h
withTop l commitSession
View
@@ -54,7 +54,7 @@ fooInit = makeSnaplet "foosnaplet" "foo snaplet" Nothing $ do
--fooSplice :: (Snaplet b :-> Snaplet (FooSnaplet b))
-- -> SnapletSplice (Handler b b)
fooSplice :: (Snaplet b :-> Snaplet FooSnaplet)
- -> SnapletHeist b e Template
+ -> SnapletHeist b v Template
fooSplice fooLens = do
val <- liftWith fooLens $ gets _fooVal
liftHeist $ textSplice $ T.pack $ "splice value" ++ (show val)
View
@@ -72,7 +72,7 @@ function wrapping all the routes, and return the resulting state data
structure. This example demonstrates the use of a few of the most common
snaplet functions.
- nestSnaplet :: ByteString -> Initializer b e a -> Initializer b e a
+ nestSnaplet :: ByteString -> Initializer b v a -> Initializer b v a
All calls to child snaplet initializer functions must be wrapped in a call to
nestSnaplet. The first parameter is a URL path segment that is used to prefix
@@ -92,15 +92,15 @@ mkLabels function and will be discussed in more detail later. For now it's
sufficient to think of them as a getter and a setter combined (to use an OO
metaphor).
- nameSnaplet :: Text -> Initializer b e (Snaplet a) -> Initializer b e (Snaplet a)
+ nameSnaplet :: Text -> Initializer b v (Snaplet a) -> Initializer b v (Snaplet a)
Snaplets usually define a default name used to identify the snaplet. This name
is used for the snaplet's directory in the filesystem. If you don't want to use
the default name, you can override it with the nameSnaplet function. Also, if
you want to have two instances of the same snaplet, then you will need to use
nameSnaplet to give at least one of them a unique name.
- addRoutes :: [(ByteString, Handler b b ())] -> Initializer b e ()
+ addRoutes :: [(ByteString, Handler b b ())] -> Initializer b v ()
The addRoutes function is how an application (or snaplet) defines its routes.
Under the hood the snaplet infrastructure merges all the routes from all
@@ -116,7 +116,7 @@ monad. It has a MonadState instance that lets you access and modify the current
snaplet's state, and a MonadSnap instance providing the request-processing
functions defined in Snap.Types.
- wrapHandlers :: (Handler b b () -> Handler b b ()) -> Initializer b e ()
+ wrapHandlers :: (Handler b b () -> Handler b b ()) -> Initializer b v ()
wrapHandlers allows you to apply an arbitrary Handler transformation to the
top-level handler. This is useful if you want to do some generic processing at
@@ -135,10 +135,10 @@ to look at heistServe's type signature:
heistServe :: Handler b (Heist b) ()
This type signature isn't quite what the type checker will tell you, but it
-communicates the basic concept. "Handler b e" is the runtime monad for
+communicates the basic concept. "Handler b v" is the runtime monad for
snaplets. The type parameter 'b' is the base state type for the application.
-The type parameter e defines the snaplet currently in context. Handler's
-MonadState instance gives it access to the current context (the 'e'), which is
+The type parameter v defines the snaplet currently in view. Handler's
+MonadState instance gives it access to the current context (the 'v'), which is
why the Heist snaplet provides heistServe with the above (approximate) type
signature. The addRoutes and wrapHandlers functions require handlers where the
current context is the top-level application. The with function transforms a