--- /srv/reproducible-results/rbuild-debian/r-b-build.CyRFl79Z/b1/haskell-snap-templates_1.0.0.2-5_armhf.changes +++ /srv/reproducible-results/rbuild-debian/r-b-build.CyRFl79Z/b2/haskell-snap-templates_1.0.0.2-5_armhf.changes ├── Files │ @@ -1,2 +1,2 @@ │ │ - 36deb15d0c39f98f21dac16bf3ec4612 3211896 haskell optional snap-templates_1.0.0.2-5_armhf.deb │ + 0ed49e24179455711b298ef595f32e7b 3212664 haskell optional snap-templates_1.0.0.2-5_armhf.deb ├── snap-templates_1.0.0.2-5_armhf.deb │ ├── file list │ │ @@ -1,3 +1,3 @@ │ │ -rw-r--r-- 0 0 0 4 2024-01-05 01:14:13.000000 debian-binary │ │ -rw-r--r-- 0 0 0 900 2024-01-05 01:14:13.000000 control.tar.xz │ │ --rw-r--r-- 0 0 0 3210804 2024-01-05 01:14:13.000000 data.tar.xz │ │ +-rw-r--r-- 0 0 0 3211572 2024-01-05 01:14:13.000000 data.tar.xz │ ├── control.tar.xz │ │ ├── control.tar │ │ │ ├── ./md5sums │ │ │ │ ├── ./md5sums │ │ │ │ │┄ Files differ │ ├── data.tar.xz │ │ ├── data.tar │ │ │ ├── ./usr/bin/snap-framework │ │ │ │┄ File has been modified after NT_GNU_BUILD_ID has been applied. │ │ │ │ ├── readelf --wide --notes {} │ │ │ │ │ @@ -1,12 +1,12 @@ │ │ │ │ │ │ │ │ │ │ Displaying notes found in: .note.ABI-tag │ │ │ │ │ Owner Data size Description │ │ │ │ │ GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag) OS: Linux, ABI: 3.2.0 │ │ │ │ │ │ │ │ │ │ Displaying notes found in: .note.gnu.build-id │ │ │ │ │ Owner Data size Description │ │ │ │ │ - GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 26b9dfe769d7a3a3d6a5f11dbe14c4ac6ec9a388 │ │ │ │ │ + GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: f0f266036a636bddf521bda94700e2e2b7e2cef2 │ │ │ │ │ │ │ │ │ │ Displaying notes found in: .note.gnu.gold-version │ │ │ │ │ Owner Data size Description │ │ │ │ │ GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version) Version: gold 1.16 │ │ │ │ ├── strings --all --bytes=8 {} │ │ │ │ │┄ Ordering differences only │ │ │ │ │ @@ -251,26 +251,14 @@ │ │ │ │ │ snap init [type] │ │ │ │ │ on that action │ │ │ │ │ Note: you can use --help after any of the above actions to get help │ │ │ │ │ init - create a new project directory structure in the current directory │ │ │ │ │ can be one of: │ │ │ │ │ snap │ │ │ │ │ Snap 1.0.0.0 Project Kickstarter │ │ │ │ │ -> {-# LANGUAGE OverloadedStrings #-} │ │ │ │ │ -> module Part2 where │ │ │ │ │ -> import Snap.Snaplet │ │ │ │ │ -> data Foo = Foo │ │ │ │ │ -> data Bar = Bar │ │ │ │ │ -> fooInit :: SnapletInit b Foo │ │ │ │ │ -> fooInit = makeSnaplet "foo" "Foo snaplet" Nothing $ do │ │ │ │ │ -> return Foo │ │ │ │ │ -> barInit :: SnapletLens b Foo -> SnapletInit b Bar │ │ │ │ │ -> barInit _h = makeSnaplet "bar" "Bar snaplet" Nothing $ do │ │ │ │ │ -> return Bar │ │ │ │ │ -./src/Part2.lhs │ │ │ │ │ What Are Snaplets? │ │ │ │ │ ================== │ │ │ │ │ A snaplet is a composable web application. Snaplets allow you to build │ │ │ │ │ self-contained pieces of functionality and glue them together to make larger │ │ │ │ │ applications. Here are some of the things provided by the snaplet API: │ │ │ │ │ - Infrastructure for application state/environment │ │ │ │ │ - Snaplet initialization, reload, and cleanup │ │ │ │ │ @@ -561,14 +549,26 @@ │ │ │ │ │ run and it sees that the snaplet's directory does not already exist. If the │ │ │ │ │ user upgrades to a new version of the snaplet and the new version made changes │ │ │ │ │ to the filesystem resources, those resources will NOT be automatically copied │ │ │ │ │ in by default. Resource installation *only* happens when the `snaplets/foo` │ │ │ │ │ directory does not exist. If you want to get the latest version of the │ │ │ │ │ filesystem resources, remove the `snaplets/foo` directory, and restart your │ │ │ │ │ ./src/Tutorial.lhs │ │ │ │ │ +> {-# LANGUAGE OverloadedStrings #-} │ │ │ │ │ +> module Part2 where │ │ │ │ │ +> import Snap.Snaplet │ │ │ │ │ +> data Foo = Foo │ │ │ │ │ +> data Bar = Bar │ │ │ │ │ +> fooInit :: SnapletInit b Foo │ │ │ │ │ +> fooInit = makeSnaplet "foo" "Foo snaplet" Nothing $ do │ │ │ │ │ +> return Foo │ │ │ │ │ +> barInit :: SnapletLens b Foo -> SnapletInit b Bar │ │ │ │ │ +> barInit _h = makeSnaplet "bar" "Bar snaplet" Nothing $ do │ │ │ │ │ +> return Bar │ │ │ │ │ +./src/Part2.lhs │ │ │ │ │ Name: projname │ │ │ │ │ Version: 0.1 │ │ │ │ │ Synopsis: Project Synopsis Here │ │ │ │ │ Description: Project Description Here │ │ │ │ │ License: AllRightsReserved │ │ │ │ │ Author: Author │ │ │ │ │ Maintainer: maintainer@example.com │ │ │ │ │ @@ -591,36 +591,83 @@ │ │ │ │ │ snap >= 1.0 && < 1.2, │ │ │ │ │ snap-core >= 1.0 && < 1.1, │ │ │ │ │ snap-server >= 1.0 && < 1.2 │ │ │ │ │ if impl(ghc >= 6.12.0) │ │ │ │ │ ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 │ │ │ │ │ -fno-warn-unused-do-bind │ │ │ │ │ ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 │ │ │ │ │ -{-# LANGUAGE TemplateHaskell #-} │ │ │ │ │ +{-# LANGUAGE OverloadedStrings #-} │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ --- | This module defines our application's state type and an alias for its │ │ │ │ │ --- handler monad. │ │ │ │ │ -module Application where │ │ │ │ │ +-- | This module is where all the routes and handlers are defined for your │ │ │ │ │ +-- site. The 'app' function is the initializer that combines everything │ │ │ │ │ +-- together and is exported by this module. │ │ │ │ │ +module Site │ │ │ │ │ + ) where │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ -import Control.Lens │ │ │ │ │ -import Snap.Snaplet │ │ │ │ │ -import Snap.Snaplet.Heist │ │ │ │ │ -import Snap.Snaplet.Auth │ │ │ │ │ -import Snap.Snaplet.Session │ │ │ │ │ +import Control.Applicative │ │ │ │ │ +import Data.ByteString (ByteString) │ │ │ │ │ +import Data.Map.Syntax ((##)) │ │ │ │ │ +import qualified Data.Text as T │ │ │ │ │ +import Snap.Core │ │ │ │ │ +import Snap.Snaplet │ │ │ │ │ +import Snap.Snaplet.Auth │ │ │ │ │ +import Snap.Snaplet.Auth.Backends.JsonFile │ │ │ │ │ +import Snap.Snaplet.Heist │ │ │ │ │ +import Snap.Snaplet.Session.Backends.CookieSession │ │ │ │ │ +import Snap.Util.FileServe │ │ │ │ │ +import qualified Heist.Interpreted as I │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ -data App = App │ │ │ │ │ - { _heist :: Snaplet (Heist App) │ │ │ │ │ - , _sess :: Snaplet SessionManager │ │ │ │ │ - , _auth :: Snaplet (AuthManager App) │ │ │ │ │ -makeLenses ''App │ │ │ │ │ -instance HasHeist App where │ │ │ │ │ - heistLens = subSnaplet heist │ │ │ │ │ +import Application │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ -type AppHandler = Handler App App │ │ │ │ │ -./src/Application.hs │ │ │ │ │ +-- | Render login form │ │ │ │ │ +handleLogin :: Maybe T.Text -> Handler App (AuthManager App) () │ │ │ │ │ +handleLogin authError = heistLocal (I.bindSplices errs) $ render "login" │ │ │ │ │ + errs = maybe mempty splice authError │ │ │ │ │ + splice err = "loginError" ## I.textSplice err │ │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ │ +-- | Handle login submit │ │ │ │ │ +handleLoginSubmit :: Handler App (AuthManager App) () │ │ │ │ │ +handleLoginSubmit = │ │ │ │ │ + loginUser "login" "password" Nothing │ │ │ │ │ + (\_ -> handleLogin err) (redirect "/") │ │ │ │ │ + err = Just "Unknown user or password" │ │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ │ +-- | Logs out and redirects the user to the site index. │ │ │ │ │ +handleLogout :: Handler App (AuthManager App) () │ │ │ │ │ +handleLogout = logout >> redirect "/" │ │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ │ +-- | Handle new user form submit │ │ │ │ │ +handleNewUser :: Handler App (AuthManager App) () │ │ │ │ │ +handleNewUser = method GET handleForm <|> method POST handleFormSubmit │ │ │ │ │ + handleForm = render "new_user" │ │ │ │ │ + handleFormSubmit = registerUser "login" "password" >> redirect "/" │ │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ │ +-- | The application's routes. │ │ │ │ │ +routes :: [(ByteString, Handler App App ())] │ │ │ │ │ +routes = [ ("login", with auth handleLoginSubmit) │ │ │ │ │ + , ("logout", with auth handleLogout) │ │ │ │ │ + , ("new_user", with auth handleNewUser) │ │ │ │ │ + , ("", serveDirectory "static") │ │ │ │ │ + ] │ │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ │ +-- | The application initializer. │ │ │ │ │ +app :: SnapletInit App App │ │ │ │ │ +app = makeSnaplet "app" "An snaplet example application." Nothing $ do │ │ │ │ │ + h <- nestSnaplet "" heist $ heistInit "templates" │ │ │ │ │ + s <- nestSnaplet "sess" sess $ │ │ │ │ │ + initCookieSessionManager "site_key.txt" "sess" Nothing (Just 3600) │ │ │ │ │ + -- NOTE: We're using initJsonFileAuthManager here because it's easy and │ │ │ │ │ + -- doesn't require any kind of database server to run. In practice, │ │ │ │ │ + -- you'll probably want to change this to a more robust auth backend. │ │ │ │ │ + a <- nestSnaplet "auth" auth $ │ │ │ │ │ + initJsonFileAuthManager defAuthSettings sess "users.json" │ │ │ │ │ + addRoutes routes │ │ │ │ │ + addAuthSplices h auth │ │ │ │ │ + return $ App h s a │ │ │ │ │ +./src/Site.hs │ │ │ │ │ {-# LANGUAGE CPP #-} │ │ │ │ │ {-# LANGUAGE TemplateHaskell #-} │ │ │ │ │ NOTE: Don't modify this file unless you know what you are doing. If you are │ │ │ │ │ new to snap, start with Site.hs and Application.hs. This file contains │ │ │ │ │ boilerplate needed for dynamic reloading and is not meant for general │ │ │ │ │ consumption. │ │ │ │ │ Occasionally if we modify the way the dynamic reloader works and you want to │ │ │ │ │ @@ -700,141 +747,36 @@ │ │ │ │ │ -- sophisticated code might. │ │ │ │ │ getActions :: Config Snap AppConfig -> IO (Snap (), IO ()) │ │ │ │ │ getActions conf = do │ │ │ │ │ (msgs, site, cleanup) <- runSnaplet │ │ │ │ │ (appEnvironment =<< getOther conf) app │ │ │ │ │ hPutStrLn stderr $ T.unpack msgs │ │ │ │ │ return (site, cleanup) │ │ │ │ │ -{-# LANGUAGE OverloadedStrings #-} │ │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ │ --- | This module is where all the routes and handlers are defined for your │ │ │ │ │ --- site. The 'app' function is the initializer that combines everything │ │ │ │ │ --- together and is exported by this module. │ │ │ │ │ -module Site │ │ │ │ │ - ) where │ │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ │ -import Control.Applicative │ │ │ │ │ -import Data.ByteString (ByteString) │ │ │ │ │ -import Data.Map.Syntax ((##)) │ │ │ │ │ -import qualified Data.Text as T │ │ │ │ │ -import Snap.Core │ │ │ │ │ -import Snap.Snaplet │ │ │ │ │ -import Snap.Snaplet.Auth │ │ │ │ │ -import Snap.Snaplet.Auth.Backends.JsonFile │ │ │ │ │ -import Snap.Snaplet.Heist │ │ │ │ │ -import Snap.Snaplet.Session.Backends.CookieSession │ │ │ │ │ -import Snap.Util.FileServe │ │ │ │ │ -import qualified Heist.Interpreted as I │ │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ │ -import Application │ │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ │ --- | Render login form │ │ │ │ │ -handleLogin :: Maybe T.Text -> Handler App (AuthManager App) () │ │ │ │ │ -handleLogin authError = heistLocal (I.bindSplices errs) $ render "login" │ │ │ │ │ - errs = maybe mempty splice authError │ │ │ │ │ - splice err = "loginError" ## I.textSplice err │ │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ │ --- | Handle login submit │ │ │ │ │ -handleLoginSubmit :: Handler App (AuthManager App) () │ │ │ │ │ -handleLoginSubmit = │ │ │ │ │ - loginUser "login" "password" Nothing │ │ │ │ │ - (\_ -> handleLogin err) (redirect "/") │ │ │ │ │ - err = Just "Unknown user or password" │ │ │ │ │ +{-# LANGUAGE TemplateHaskell #-} │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ --- | Logs out and redirects the user to the site index. │ │ │ │ │ -handleLogout :: Handler App (AuthManager App) () │ │ │ │ │ -handleLogout = logout >> redirect "/" │ │ │ │ │ +-- | This module defines our application's state type and an alias for its │ │ │ │ │ +-- handler monad. │ │ │ │ │ +module Application where │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ --- | Handle new user form submit │ │ │ │ │ -handleNewUser :: Handler App (AuthManager App) () │ │ │ │ │ -handleNewUser = method GET handleForm <|> method POST handleFormSubmit │ │ │ │ │ - handleForm = render "new_user" │ │ │ │ │ - handleFormSubmit = registerUser "login" "password" >> redirect "/" │ │ │ │ │ +import Control.Lens │ │ │ │ │ +import Snap.Snaplet │ │ │ │ │ +import Snap.Snaplet.Heist │ │ │ │ │ +import Snap.Snaplet.Auth │ │ │ │ │ +import Snap.Snaplet.Session │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ --- | The application's routes. │ │ │ │ │ -routes :: [(ByteString, Handler App App ())] │ │ │ │ │ -routes = [ ("login", with auth handleLoginSubmit) │ │ │ │ │ - , ("logout", with auth handleLogout) │ │ │ │ │ - , ("new_user", with auth handleNewUser) │ │ │ │ │ - , ("", serveDirectory "static") │ │ │ │ │ - ] │ │ │ │ │ +data App = App │ │ │ │ │ + { _heist :: Snaplet (Heist App) │ │ │ │ │ + , _sess :: Snaplet SessionManager │ │ │ │ │ + , _auth :: Snaplet (AuthManager App) │ │ │ │ │ +makeLenses ''App │ │ │ │ │ +instance HasHeist App where │ │ │ │ │ + heistLens = subSnaplet heist │ │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ │ --- | The application initializer. │ │ │ │ │ -app :: SnapletInit App App │ │ │ │ │ -app = makeSnaplet "app" "An snaplet example application." Nothing $ do │ │ │ │ │ - h <- nestSnaplet "" heist $ heistInit "templates" │ │ │ │ │ - s <- nestSnaplet "sess" sess $ │ │ │ │ │ - initCookieSessionManager "site_key.txt" "sess" Nothing (Just 3600) │ │ │ │ │ - -- NOTE: We're using initJsonFileAuthManager here because it's easy and │ │ │ │ │ - -- doesn't require any kind of database server to run. In practice, │ │ │ │ │ - -- you'll probably want to change this to a more robust auth backend. │ │ │ │ │ - a <- nestSnaplet "auth" auth $ │ │ │ │ │ - initJsonFileAuthManager defAuthSettings sess "users.json" │ │ │ │ │ - addRoutes routes │ │ │ │ │ - addAuthSplices h auth │ │ │ │ │ - return $ App h s a │ │ │ │ │ -./src/Site.hs │ │ │ │ │ - │ │ │ │ │ - Snap web server │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ -
│ │ │ │ │ - │ │ │ │ │ -
│ │ │ │ │ - │ │ │ │ │ -./snaplets/heist/templates/base.tpl │ │ │ │ │ -

Snap Example App Login

│ │ │ │ │ -

│ │ │ │ │ -/login │ │ │ │ │ -Login │ │ │ │ │ - │ │ │ │ │ -

Don't have a login yet? Create a new user

│ │ │ │ │ -./snaplets/heist/templates/_login.tpl │ │ │ │ │ -

Register a new user

│ │ │ │ │ -/new_user │ │ │ │ │ -Add User │ │ │ │ │ - │ │ │ │ │ -./snaplets/heist/templates/_new_user.tpl │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ -./snaplets/heist/templates/login.tpl │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - This is a simple demo page served using │ │ │ │ │ - Heist │ │ │ │ │ - and the Snap web framework. │ │ │ │ │ -

│ │ │ │ │ -

Congrats! You're logged in as ''

│ │ │ │ │ -

Logout

│ │ │ │ │ -
│ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ -
│ │ │ │ │ -./snaplets/heist/templates/index.tpl │ │ │ │ │ -
│ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ -
Login:
Password:
│ │ │ │ │ -./snaplets/heist/templates/userform.tpl │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ - │ │ │ │ │ -./snaplets/heist/templates/new_user.tpl │ │ │ │ │ +type AppHandler = Handler App App │ │ │ │ │ +./src/Application.hs │ │ │ │ │ Name: projname │ │ │ │ │ Version: 0.1 │ │ │ │ │ Synopsis: Project Synopsis Here │ │ │ │ │ Description: Project Description Here │ │ │ │ │ License: AllRightsReserved │ │ │ │ │ Author: Author │ │ │ │ │ Maintainer: maintainer@example.com │ │ │ │ │ @@ -878,14 +820,72 @@ │ │ │ │ │ ghc-options: -threaded -w │ │ │ │ │ if impl(ghc >= 6.12.0) │ │ │ │ │ ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 │ │ │ │ │ -fno-warn-orphans -fno-warn-unused-do-bind │ │ │ │ │ else │ │ │ │ │ ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 │ │ │ │ │ -fno-warn-orphans │ │ │ │ │ +

Register a new user

│ │ │ │ │ +/new_user │ │ │ │ │ +Add User │ │ │ │ │ + │ │ │ │ │ +./snaplets/heist/templates/_new_user.tpl │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ +
Login:
Password:
│ │ │ │ │ +./snaplets/heist/templates/userform.tpl │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ +./snaplets/heist/templates/new_user.tpl │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ +./snaplets/heist/templates/login.tpl │ │ │ │ │ +

Snap Example App Login

│ │ │ │ │ +

│ │ │ │ │ +/login │ │ │ │ │ +Login │ │ │ │ │ + │ │ │ │ │ +

Don't have a login yet? Create a new user

│ │ │ │ │ +./snaplets/heist/templates/_login.tpl │ │ │ │ │ + │ │ │ │ │ + Snap web server │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ +
│ │ │ │ │ + │ │ │ │ │ +
│ │ │ │ │ + │ │ │ │ │ +./snaplets/heist/templates/base.tpl │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + This is a simple demo page served using │ │ │ │ │ + Heist │ │ │ │ │ + and the Snap web framework. │ │ │ │ │ +

│ │ │ │ │ +

Congrats! You're logged in as ''

│ │ │ │ │ +

Logout

│ │ │ │ │ +
│ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ + │ │ │ │ │ +
│ │ │ │ │ +./snaplets/heist/templates/index.tpl │ │ │ │ │ padding: 0; │ │ │ │ │ margin: 0; │ │ │ │ │ background-color: #ffffff; │ │ │ │ │ font-family: Verdana, Helvetica, sans-serif; │ │ │ │ │ padding: 0; │ │ │ │ │ margin: 0; │ │ │ │ │ text-decoration: underline; │ │ │ │ │ @@ -917,16 +917,14 @@ │ │ │ │ │ dir "static" (serveDirectory ".") │ │ │ │ │ echoHandler :: Snap () │ │ │ │ │ echoHandler = do │ │ │ │ │ param <- getParam "echoparam" │ │ │ │ │ maybe (writeBS "must specify echo/param in URL") │ │ │ │ │ writeBS param │ │ │ │ │ ./src/Main.hs │ │ │ │ │ -placeholder │ │ │ │ │ -./log/placeholder │ │ │ │ │ Name: projname │ │ │ │ │ Version: 0.1 │ │ │ │ │ Synopsis: Project Synopsis Here │ │ │ │ │ Description: Project Description Here │ │ │ │ │ License: AllRightsReserved │ │ │ │ │ Author: Author │ │ │ │ │ Maintainer: maintainer@example.com │ │ │ │ │ @@ -944,14 +942,16 @@ │ │ │ │ │ snap-core >= 1.0 && < 1.1, │ │ │ │ │ snap-server >= 1.0 && < 1.2 │ │ │ │ │ if impl(ghc >= 6.12.0) │ │ │ │ │ ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 │ │ │ │ │ -fno-warn-unused-do-bind │ │ │ │ │ ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2 │ │ │ │ │ ./foo.cabal │ │ │ │ │ +placeholder │ │ │ │ │ +./log/placeholder │ │ │ │ │ :set -isrc │ │ │ │ │ :set -hide-package MonadCatchIO-mtl │ │ │ │ │ :set -hide-package monads-fd │ │ │ │ │ :set -XOverloadedStrings │ │ │ │ │ main:Main.Help │ │ │ │ │ Data.Text.concat: size overflow │ │ │ │ │ overflowError │ │ │ │ ├── readelf --wide --decompress --hex-dump=.rodata {} │ │ │ │ │ @@ -46,1115 +46,1115 @@ │ │ │ │ │ 0x011466f0 79207374 72756374 75726520 696e2074 y structure in t │ │ │ │ │ 0x01146700 68652063 75727265 6e742064 69726563 he current direc │ │ │ │ │ 0x01146710 746f7279 00202020 203c6163 74696f6e tory. can be one of: │ │ │ │ │ 0x01146730 00202073 6e617020 3c616374 696f6e3e . snap │ │ │ │ │ 0x01146740 00557361 67653a00 536e6170 20312e30 .Usage:.Snap 1.0 │ │ │ │ │ 0x01146750 2e302e30 2050726f 6a656374 204b6963 .0.0 Project Kic │ │ │ │ │ - 0x01146760 6b737461 72746572 003e207b 2d23204c kstarter.> {-# L │ │ │ │ │ - 0x01146770 414e4755 41474520 4f766572 6c6f6164 ANGUAGE Overload │ │ │ │ │ - 0x01146780 65645374 72696e67 7320232d 7d0a3e20 edStrings #-}.> │ │ │ │ │ - 0x01146790 6d6f6475 6c652050 61727432 20776865 module Part2 whe │ │ │ │ │ - 0x011467a0 72650a0a 3e20696d 706f7274 20202020 re..> import │ │ │ │ │ - 0x011467b0 20202020 20202053 6e61702e 536e6170 Snap.Snap │ │ │ │ │ - 0x011467c0 6c65740a 0a3e2064 61746120 466f6f20 let..> data Foo │ │ │ │ │ - 0x011467d0 3d20466f 6f0a3e0a 3e206461 74612042 = Foo.>.> data B │ │ │ │ │ - 0x011467e0 6172203d 20426172 0a3e0a3e 20666f6f ar = Bar.>.> foo │ │ │ │ │ - 0x011467f0 496e6974 203a3a20 536e6170 6c657449 Init :: SnapletI │ │ │ │ │ - 0x01146800 6e697420 6220466f 6f0a3e20 666f6f49 nit b Foo.> fooI │ │ │ │ │ - 0x01146810 6e697420 3d206d61 6b65536e 61706c65 nit = makeSnaple │ │ │ │ │ - 0x01146820 74202266 6f6f2220 22466f6f 20736e61 t "foo" "Foo sna │ │ │ │ │ - 0x01146830 706c6574 22204e6f 7468696e 67202420 plet" Nothing $ │ │ │ │ │ - 0x01146840 646f0a3e 20202020 20726574 75726e20 do.> return │ │ │ │ │ - 0x01146850 466f6f0a 3e0a3e20 62617249 6e697420 Foo.>.> barInit │ │ │ │ │ - 0x01146860 3a3a2053 6e61706c 65744c65 6e732062 :: SnapletLens b │ │ │ │ │ - 0x01146870 20466f6f 202d3e20 536e6170 6c657449 Foo -> SnapletI │ │ │ │ │ - 0x01146880 6e697420 62204261 720a3e20 62617249 nit b Bar.> barI │ │ │ │ │ - 0x01146890 6e697420 5f68203d 206d616b 65536e61 nit _h = makeSna │ │ │ │ │ - 0x011468a0 706c6574 20226261 72222022 42617220 plet "bar" "Bar │ │ │ │ │ - 0x011468b0 736e6170 6c657422 204e6f74 68696e67 snaplet" Nothing │ │ │ │ │ - 0x011468c0 20242064 6f0a3e20 20202020 72657475 $ do.> retu │ │ │ │ │ - 0x011468d0 726e2042 61720a00 2e2f7372 632f5061 rn Bar.../src/Pa │ │ │ │ │ - 0x011468e0 7274322e 6c687300 57686174 20417265 rt2.lhs.What Are │ │ │ │ │ - 0x011468f0 20536e61 706c6574 733f0a3d 3d3d3d3d Snaplets?.===== │ │ │ │ │ - 0x01146900 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d0a0a41 =============..A │ │ │ │ │ - 0x01146910 20736e61 706c6574 20697320 6120636f snaplet is a co │ │ │ │ │ - 0x01146920 6d706f73 61626c65 20776562 20617070 mposable web app │ │ │ │ │ - 0x01146930 6c696361 74696f6e 2e202053 6e61706c lication. Snapl │ │ │ │ │ - 0x01146940 65747320 616c6c6f 7720796f 7520746f ets allow you to │ │ │ │ │ - 0x01146950 20627569 6c640a73 656c662d 636f6e74 build.self-cont │ │ │ │ │ - 0x01146960 61696e65 64207069 65636573 206f6620 ained pieces of │ │ │ │ │ - 0x01146970 66756e63 74696f6e 616c6974 7920616e functionality an │ │ │ │ │ - 0x01146980 6420676c 75652074 68656d20 746f6765 d glue them toge │ │ │ │ │ - 0x01146990 74686572 20746f20 6d616b65 206c6172 ther to make lar │ │ │ │ │ - 0x011469a0 6765720a 6170706c 69636174 696f6e73 ger.applications │ │ │ │ │ - 0x011469b0 2e202048 65726520 61726520 736f6d65 . Here are some │ │ │ │ │ - 0x011469c0 206f6620 74686520 7468696e 67732070 of the things p │ │ │ │ │ - 0x011469d0 726f7669 64656420 62792074 68652073 rovided by the s │ │ │ │ │ - 0x011469e0 6e61706c 65742041 50493a0a 0a20202d naplet API:.. - │ │ │ │ │ - 0x011469f0 20496e66 72617374 72756374 75726520 Infrastructure │ │ │ │ │ - 0x01146a00 666f7220 6170706c 69636174 696f6e20 for application │ │ │ │ │ - 0x01146a10 73746174 652f656e 7669726f 6e6d656e state/environmen │ │ │ │ │ - 0x01146a20 740a0a20 202d2053 6e61706c 65742069 t.. - Snaplet i │ │ │ │ │ - 0x01146a30 6e697469 616c697a 6174696f 6e2c2072 nitialization, r │ │ │ │ │ - 0x01146a40 656c6f61 642c2061 6e642063 6c65616e eload, and clean │ │ │ │ │ - 0x01146a50 75700a0a 20202d20 4d616e61 67656d65 up.. - Manageme │ │ │ │ │ - 0x01146a60 6e74206f 66206669 6c657379 7374656d nt of filesystem │ │ │ │ │ - 0x01146a70 20646174 6120616e 64206175 746f6d61 data and automa │ │ │ │ │ - 0x01146a80 74696320 736e6170 6c657420 696e7374 tic snaplet inst │ │ │ │ │ - 0x01146a90 616c6c61 74696f6e 0a0a2020 2d20556e allation.. - Un │ │ │ │ │ - 0x01146aa0 69666965 6420636f 6e666967 2066696c ified config fil │ │ │ │ │ - 0x01146ab0 6520696e 66726173 74727563 74757265 e infrastructure │ │ │ │ │ - 0x01146ac0 0a0a4f6e 65206578 616d706c 65206d69 ..One example mi │ │ │ │ │ - 0x01146ad0 67687420 62652061 2077696b 6920736e ght be a wiki sn │ │ │ │ │ - 0x01146ae0 61706c65 742e2020 49742077 6f756c64 aplet. It would │ │ │ │ │ - 0x01146af0 20626520 64697374 72696275 74656420 be distributed │ │ │ │ │ - 0x01146b00 61732061 20686173 6b656c6c 0a706163 as a haskell.pac │ │ │ │ │ - 0x01146b10 6b616765 20746861 7420776f 756c6420 kage that would │ │ │ │ │ - 0x01146b20 62652069 6e737461 6c6c6564 20776974 be installed wit │ │ │ │ │ - 0x01146b30 68206361 62616c20 616e6420 776f756c h cabal and woul │ │ │ │ │ - 0x01146b40 64207072 6f626162 6c792069 6e636c75 d probably inclu │ │ │ │ │ - 0x01146b50 64652063 6f64652c 0a636f6e 66696720 de code,.config │ │ │ │ │ - 0x01146b60 66696c65 732c2048 544d4c20 74656d70 files, HTML temp │ │ │ │ │ - 0x01146b70 6c617465 732c2073 74796c65 73686565 lates, styleshee │ │ │ │ │ - 0x01146b80 74732c20 4a617661 53637269 70742c20 ts, JavaScript, │ │ │ │ │ - 0x01146b90 696d6167 65732c20 6574632e 20205468 images, etc. Th │ │ │ │ │ - 0x01146ba0 650a736e 61706c65 74277320 636f6465 e.snaplet's code │ │ │ │ │ - 0x01146bb0 20776f75 6c642070 726f7669 64652074 would provide t │ │ │ │ │ - 0x01146bc0 6865206e 65636573 73617279 20415049 he necessary API │ │ │ │ │ - 0x01146bd0 20746f20 6c657420 796f7572 20617070 to let your app │ │ │ │ │ - 0x01146be0 6c696361 74696f6e 0a696e74 65726163 lication.interac │ │ │ │ │ - 0x01146bf0 74207365 616d6c65 73736c79 20776974 t seamlessly wit │ │ │ │ │ - 0x01146c00 68207468 65207769 6b692066 756e6374 h the wiki funct │ │ │ │ │ - 0x01146c10 696f6e61 6c697479 2e202057 68656e20 ionality. When │ │ │ │ │ - 0x01146c20 796f7520 72756e20 796f7572 0a617070 you run your.app │ │ │ │ │ - 0x01146c30 6c696361 74696f6e 20666f72 20746865 lication for the │ │ │ │ │ - 0x01146c40 20666972 73742074 696d652c 20616c6c first time, all │ │ │ │ │ - 0x01146c50 206f6620 74686520 77696b69 20736e61 of the wiki sna │ │ │ │ │ - 0x01146c60 706c6574 27732066 696c6573 79737465 plet's filesyste │ │ │ │ │ - 0x01146c70 6d207265 736f7572 6365730a 77696c6c m resources.will │ │ │ │ │ - 0x01146c80 20617574 6f6d6174 6963616c 6c792062 automatically b │ │ │ │ │ - 0x01146c90 6520636f 70696564 20696e74 6f207468 e copied into th │ │ │ │ │ - 0x01146ca0 65206170 70726f70 72696174 6520706c e appropriate pl │ │ │ │ │ - 0x01146cb0 61636573 2e202054 68656e20 796f7520 aces. Then you │ │ │ │ │ - 0x01146cc0 77696c6c 0a696d6d 65646961 74656c79 will.immediately │ │ │ │ │ - 0x01146cd0 20626520 61626c65 20746f20 63757374 be able to cust │ │ │ │ │ - 0x01146ce0 6f6d697a 65207468 65207769 6b692074 omize the wiki t │ │ │ │ │ - 0x01146cf0 6f206669 7420796f 7572206e 65656473 o fit your needs │ │ │ │ │ - 0x01146d00 20627920 65646974 696e6720 636f6e66 by editing conf │ │ │ │ │ - 0x01146d10 69670a66 696c6573 2c207072 6f766964 ig.files, provid │ │ │ │ │ - 0x01146d20 696e6720 796f7572 206f776e 20737479 ing your own sty │ │ │ │ │ - 0x01146d30 6c657368 65657473 2c206574 632e2020 lesheets, etc. │ │ │ │ │ - 0x01146d40 57652077 696c6c20 64697363 75737320 We will discuss │ │ │ │ │ - 0x01146d50 74686973 20696e20 6d6f7265 0a646574 this in more.det │ │ │ │ │ - 0x01146d60 61696c20 6c617465 722e0a0a 4120736e ail later...A sn │ │ │ │ │ - 0x01146d70 61706c65 74206361 6e207265 70726573 aplet can repres │ │ │ │ │ - 0x01146d80 656e7420 616e7974 68696e67 2066726f ent anything fro │ │ │ │ │ - 0x01146d90 6d206261 636b656e 64204861 736b656c m backend Haskel │ │ │ │ │ - 0x01146da0 6c20696e 66726173 74727563 74757265 l infrastructure │ │ │ │ │ - 0x01146db0 20776974 68206e6f 0a757365 72206661 with no.user fa │ │ │ │ │ - 0x01146dc0 63696e67 2066756e 6374696f 6e616c69 cing functionali │ │ │ │ │ - 0x01146dd0 74792074 6f206120 736d616c 6c207769 ty to a small wi │ │ │ │ │ - 0x01146de0 64676574 206c696b 65206120 63686174 dget like a chat │ │ │ │ │ - 0x01146df0 20626f78 20746861 7420676f 65732069 box that goes i │ │ │ │ │ - 0x01146e00 6e207468 650a636f 726e6572 206f6620 n the.corner of │ │ │ │ │ - 0x01146e10 61207765 62207061 67652074 6f20616e a web page to an │ │ │ │ │ - 0x01146e20 20656e74 69726520 7374616e 64616c6f entire standalo │ │ │ │ │ - 0x01146e30 6e652077 65627369 7465206c 696b6520 ne website like │ │ │ │ │ - 0x01146e40 6120626c 6f67206f 7220666f 72756d2e a blog or forum. │ │ │ │ │ - 0x01146e50 0a546865 20706f73 73696269 6c697469 .The possibiliti │ │ │ │ │ - 0x01146e60 65732061 72652065 6e646c65 73732e20 es are endless. │ │ │ │ │ - 0x01146e70 20412073 6e61706c 65742069 73206120 A snaplet is a │ │ │ │ │ - 0x01146e80 77656220 6170706c 69636174 696f6e2c web application, │ │ │ │ │ - 0x01146e90 20616e64 20776562 0a617070 6c696361 and web.applica │ │ │ │ │ - 0x01146ea0 74696f6e 73206172 6520736e 61706c65 tions are snaple │ │ │ │ │ - 0x01146eb0 74732e20 20546869 73206d65 616e7320 ts. This means │ │ │ │ │ - 0x01146ec0 74686174 20757369 6e672073 6e61706c that using snapl │ │ │ │ │ - 0x01146ed0 65747320 616e6420 77726974 696e670a ets and writing. │ │ │ │ │ - 0x01146ee0 736e6170 6c657473 20617265 20616c6d snaplets are alm │ │ │ │ │ - 0x01146ef0 6f737420 74686520 73616d65 20746869 ost the same thi │ │ │ │ │ - 0x01146f00 6e672c20 616e6420 69742773 20747269 ng, and it's tri │ │ │ │ │ - 0x01146f10 7669616c 20746f20 64726f70 20612077 vial to drop a w │ │ │ │ │ - 0x01146f20 686f6c65 20776562 73697465 0a696e74 hole website.int │ │ │ │ │ - 0x01146f30 6f20616e 6f746865 72206f6e 652e0a0a o another one... │ │ │ │ │ - 0x01146f40 57652772 65207265 616c6c79 20657863 We're really exc │ │ │ │ │ - 0x01146f50 69746564 2061626f 75742074 68652070 ited about the p │ │ │ │ │ - 0x01146f60 6f737369 62696c69 74696573 20617661 ossibilities ava │ │ │ │ │ - 0x01146f70 696c6162 6c652077 69746820 736e6170 ilable with snap │ │ │ │ │ - 0x01146f80 6c657473 2e202049 6e0a6661 63742c20 lets. In.fact, │ │ │ │ │ - 0x01146f90 536e6170 20616c72 65616479 20736869 Snap already shi │ │ │ │ │ - 0x01146fa0 70732077 69746820 736e6170 6c657473 ps with snaplets │ │ │ │ │ - 0x01146fb0 20666f72 20736573 73696f6e 732c2061 for sessions, a │ │ │ │ │ - 0x01146fc0 75746865 6e746963 6174696f 6e2c2061 uthentication, a │ │ │ │ │ - 0x01146fd0 6e640a74 656d706c 6174696e 67202877 nd.templating (w │ │ │ │ │ - 0x01146fe0 69746820 48656973 74292c20 20546869 ith Heist), Thi │ │ │ │ │ - 0x01146ff0 73206769 76657320 796f7520 75736566 s gives you usef │ │ │ │ │ - 0x01147000 756c2066 756e6374 696f6e61 6c697479 ul functionality │ │ │ │ │ - 0x01147010 206f7574 206f6620 74686520 626f782c out of the box, │ │ │ │ │ - 0x01147020 0a616e64 206a756d 70207374 61727473 .and jump starts │ │ │ │ │ - 0x01147030 20796f75 72206f77 6e20736e 61706c65 your own snaple │ │ │ │ │ - 0x01147040 74206465 76656c6f 706d656e 74206279 t development by │ │ │ │ │ - 0x01147050 2064656d 6f6e7374 72617469 6e672073 demonstrating s │ │ │ │ │ - 0x01147060 6f6d6520 75736566 756c0a64 65736967 ome useful.desig │ │ │ │ │ - 0x01147070 6e207061 74746572 6e732e20 20536f20 n patterns. So │ │ │ │ │ - 0x01147080 77697468 6f757420 66757274 68657220 without further │ │ │ │ │ - 0x01147090 61646f2c 206c6574 27732067 65742073 ado, let's get s │ │ │ │ │ - 0x011470a0 74617274 65642e0a 0a536e61 706c6574 tarted...Snaplet │ │ │ │ │ - 0x011470b0 204f7665 72766965 770a3d3d 3d3d3d3d Overview.====== │ │ │ │ │ - 0x011470c0 3d3d3d3d 3d3d3d3d 3d3d0a0a 54686520 ==========..The │ │ │ │ │ - 0x011470d0 68656172 74206f66 20746865 20736e61 heart of the sna │ │ │ │ │ - 0x011470e0 706c6574 7320696e 66726173 74727563 plets infrastruc │ │ │ │ │ - 0x011470f0 74757265 20697320 73746174 65206d61 ture is state ma │ │ │ │ │ - 0x01147100 6e616765 6d656e74 2e20204d 6f737420 nagement. Most │ │ │ │ │ - 0x01147110 6e6f6e74 72697669 616c0a70 69656365 nontrivial.piece │ │ │ │ │ - 0x01147120 73206f66 20612077 65622061 7070206e s of a web app n │ │ │ │ │ - 0x01147130 65656420 736f6d65 206b696e 64206f66 eed some kind of │ │ │ │ │ - 0x01147140 20737461 7465206f 7220656e 7669726f state or enviro │ │ │ │ │ - 0x01147150 6e6d656e 74206461 74612e20 20436f6d nment data. Com │ │ │ │ │ - 0x01147160 706f6e65 6e74730a 74686174 20646f20 ponents.that do │ │ │ │ │ - 0x01147170 6e6f7420 6e656564 20616e79 206b696e not need any kin │ │ │ │ │ - 0x01147180 64206f66 20737461 7465206f 7220656e d of state or en │ │ │ │ │ - 0x01147190 7669726f 6e6d656e 74206172 65207072 vironment are pr │ │ │ │ │ - 0x011471a0 6f626162 6c79206d 6f72650a 61707072 obably more.appr │ │ │ │ │ - 0x011471b0 6f707269 61746520 61732061 20737461 opriate as a sta │ │ │ │ │ - 0x011471c0 6e64616c 6f6e6520 6c696272 61727920 ndalone library │ │ │ │ │ - 0x011471d0 7468616e 20617320 6120736e 61706c65 than as a snaple │ │ │ │ │ - 0x011471e0 742e0a0a 4265666f 72652077 6520636f t...Before we co │ │ │ │ │ - 0x011471f0 6e74696e 75652c20 7765206d 75737420 ntinue, we must │ │ │ │ │ - 0x01147200 636c6172 69667920 616e2069 6d706f72 clarify an impor │ │ │ │ │ - 0x01147210 74616e74 20706f69 6e742e20 20546865 tant point. The │ │ │ │ │ - 0x01147220 20536e61 70207765 62207365 72766572 Snap web server │ │ │ │ │ - 0x01147230 0a70726f 63657373 65732065 61636820 .processes each │ │ │ │ │ - 0x01147240 72657175 65737420 696e2069 7473206f request in its o │ │ │ │ │ - 0x01147250 776e2067 7265656e 20746872 6561642e wn green thread. │ │ │ │ │ - 0x01147260 20205468 6973206d 65616e73 20746861 This means tha │ │ │ │ │ - 0x01147270 74206561 63682072 65717565 73740a77 t each request.w │ │ │ │ │ - 0x01147280 696c6c20 72656365 69766520 61207365 ill receive a se │ │ │ │ │ - 0x01147290 70617261 74652063 6f707920 6f662074 parate copy of t │ │ │ │ │ - 0x011472a0 68652073 74617465 20646566 696e6564 he state defined │ │ │ │ │ - 0x011472b0 20627920 796f7572 20617070 6c696361 by your applica │ │ │ │ │ - 0x011472c0 74696f6e 20616e64 0a736e61 706c6574 tion and.snaplet │ │ │ │ │ - 0x011472d0 732c2061 6e64206d 6f646966 69636174 s, and modificat │ │ │ │ │ - 0x011472e0 696f6e73 20746f20 74686174 20737461 ions to that sta │ │ │ │ │ - 0x011472f0 7465206f 6e6c7920 61666665 63742074 te only affect t │ │ │ │ │ - 0x01147300 6865206c 6f63616c 20746872 65616420 he local thread │ │ │ │ │ - 0x01147310 74686174 0a67656e 65726174 65732061 that.generates a │ │ │ │ │ - 0x01147320 2073696e 676c6520 72657370 6f6e7365 single response │ │ │ │ │ - 0x01147330 2e202046 726f6d20 6e6f7720 6f6e2c20 . From now on, │ │ │ │ │ - 0x01147340 7768656e 20776520 74616c6b 2061626f when we talk abo │ │ │ │ │ - 0x01147350 75742073 74617465 20746869 73206973 ut state this is │ │ │ │ │ - 0x01147360 0a776861 74207765 20617265 2074616c .what we are tal │ │ │ │ │ - 0x01147370 6b696e67 2061626f 75742e20 20496620 king about. If │ │ │ │ │ - 0x01147380 796f7520 6e656564 20676c6f 62616c20 you need global │ │ │ │ │ - 0x01147390 6170706c 69636174 696f6e20 73746174 application stat │ │ │ │ │ - 0x011473a0 652c2079 6f752068 61766520 746f0a75 e, you have to.u │ │ │ │ │ - 0x011473b0 73652061 20746872 6561642d 73616665 se a thread-safe │ │ │ │ │ - 0x011473c0 20636f6e 73747275 63742073 75636820 construct such │ │ │ │ │ - 0x011473d0 61732061 6e204d56 6172206f 7220494f as an MVar or IO │ │ │ │ │ - 0x011473e0 5265662e 0a0a5468 69732070 6f737420 Ref...This post │ │ │ │ │ - 0x011473f0 69732077 72697474 656e2069 6e206c69 is written in li │ │ │ │ │ - 0x01147400 74657261 74652048 61736b65 6c6c2e20 terate Haskell. │ │ │ │ │ - 0x01147410 20497420 75736573 20612073 6d616c6c It uses a small │ │ │ │ │ - 0x01147420 20657874 65726e61 6c206d6f 64756c65 external module │ │ │ │ │ - 0x01147430 0a63616c 6c656420 50617274 32207468 .called Part2 th │ │ │ │ │ - 0x01147440 61742069 73205b61 7661696c 61626c65 at is [available │ │ │ │ │ - 0x01147450 0a686572 655d2868 74747073 3a2f2f67 .here](https://g │ │ │ │ │ - 0x01147460 69746875 622e636f 6d2f736e 61706672 ithub.com/snapfr │ │ │ │ │ - 0x01147470 616d6577 6f726b2f 736e6170 2d74656d amework/snap-tem │ │ │ │ │ - 0x01147480 706c6174 65732f62 6c6f622f 6d617374 plates/blob/mast │ │ │ │ │ - 0x01147490 65722f70 726f6a65 63745f74 656d706c er/project_templ │ │ │ │ │ - 0x011474a0 6174652f 7475746f 7269616c 2f737263 ate/tutorial/src │ │ │ │ │ - 0x011474b0 2f506172 74322e6c 6873292e 0a596f75 /Part2.lhs)..You │ │ │ │ │ - 0x011474c0 2063616e 20616c73 6f20696e 7374616c can also instal │ │ │ │ │ - 0x011474d0 6c207468 65206675 6c6c2063 6f646520 l the full code │ │ │ │ │ - 0x011474e0 696e2074 68652063 75727265 6e742064 in the current d │ │ │ │ │ - 0x011474f0 69726563 746f7279 20776974 68207468 irectory with th │ │ │ │ │ - 0x01147500 6520636f 6d6d616e 640a6073 6e617020 e command.`snap │ │ │ │ │ - 0x01147510 696e6974 20747574 6f726961 6c602e20 init tutorial`. │ │ │ │ │ - 0x01147520 20466972 73742077 65206e65 65642074 First we need t │ │ │ │ │ - 0x01147530 6f206765 7420696d 706f7274 73206f75 o get imports ou │ │ │ │ │ - 0x01147540 74206f66 20746865 20776179 2e0a0a3e t of the way...> │ │ │ │ │ - 0x01147550 207b2d23 204c414e 47554147 45205465 {-# LANGUAGE Te │ │ │ │ │ - 0x01147560 6d706c61 74654861 736b656c 6c20232d mplateHaskell #- │ │ │ │ │ - 0x01147570 7d0a3e20 7b2d2320 4c414e47 55414745 }.> {-# LANGUAGE │ │ │ │ │ - 0x01147580 204f7665 726c6f61 64656453 7472696e OverloadedStrin │ │ │ │ │ - 0x01147590 67732023 2d7d0a3e 0a3e206d 6f64756c gs #-}.>.> modul │ │ │ │ │ - 0x011475a0 65204d61 696e2077 68657265 0a3e0a3e e Main where.>.> │ │ │ │ │ - 0x011475b0 20696d70 6f727420 20202020 20202020 import │ │ │ │ │ - 0x011475c0 2020436f 6e74726f 6c2e4170 706c6963 Control.Applic │ │ │ │ │ - 0x011475d0 61746976 65202828 3c7c3e29 290a3e20 ative ((<|>)).> │ │ │ │ │ - 0x011475e0 696d706f 72742020 20202020 20202020 import │ │ │ │ │ - 0x011475f0 20436f6e 74726f6c 2e4c656e 732e5448 Control.Lens.TH │ │ │ │ │ - 0x01147600 0a3e2069 6d706f72 74202020 20202020 .> import │ │ │ │ │ - 0x01147610 20202020 436f6e74 726f6c2e 4d6f6e61 Control.Mona │ │ │ │ │ - 0x01147620 642e494f 2e436c61 73732028 6c696674 d.IO.Class (lift │ │ │ │ │ - 0x01147630 494f290a 3e20696d 706f7274 20202020 IO).> import │ │ │ │ │ - 0x01147640 20202020 20202043 6f6e7472 6f6c2e4d Control.M │ │ │ │ │ - 0x01147650 6f6e6164 2e537461 74652e43 6c617373 onad.State.Class │ │ │ │ │ - 0x01147660 20286765 7473290a 3e20696d 706f7274 (gets).> import │ │ │ │ │ - 0x01147670 20202020 20202020 20202044 6174612e Data. │ │ │ │ │ - 0x01147680 494f5265 660a3e20 696d706f 72742071 IORef.> import q │ │ │ │ │ - 0x01147690 75616c69 66696564 20446174 612e4279 ualified Data.By │ │ │ │ │ - 0x011476a0 74655374 72696e67 2e436861 72382061 teString.Char8 a │ │ │ │ │ - 0x011476b0 7320420a 3e20696d 706f7274 20202020 s B.> import │ │ │ │ │ - 0x011476c0 20202020 20202044 6174612e 4d617962 Data.Mayb │ │ │ │ │ - 0x011476d0 650a3e20 696d706f 72742020 20202020 e.> import │ │ │ │ │ - 0x011476e0 20202020 20536e61 700a3e20 696d706f Snap.> impo │ │ │ │ │ - 0x011476f0 72742020 20202020 20202020 20536e61 rt Sna │ │ │ │ │ - 0x01147700 702e536e 61706c65 742e4865 6973740a p.Snaplet.Heist. │ │ │ │ │ - 0x01147710 3e20696d 706f7274 20202020 20202020 > import │ │ │ │ │ - 0x01147720 20202050 61727432 0a0a5765 20737461 Part2..We sta │ │ │ │ │ - 0x01147730 7274206f 75722061 70706c69 63617469 rt our applicati │ │ │ │ │ - 0x01147740 6f6e2062 79206465 66696e69 6e672061 on by defining a │ │ │ │ │ - 0x01147750 20646174 61207374 72756374 75726520 data structure │ │ │ │ │ - 0x01147760 746f2068 6f6c6420 74686520 73746174 to hold the stat │ │ │ │ │ - 0x01147770 652e2020 54686973 0a646174 61207374 e. This.data st │ │ │ │ │ - 0x01147780 72756374 75726520 696e636c 75646573 ructure includes │ │ │ │ │ - 0x01147790 20746865 20737461 7465206f 6620616c the state of al │ │ │ │ │ - 0x011477a0 6c20736e 61706c65 74732028 77726170 l snaplets (wrap │ │ │ │ │ - 0x011477b0 70656420 696e2061 20536e61 706c6574 ped in a Snaplet │ │ │ │ │ - 0x011477c0 29207573 65640a62 79206f75 72206170 ) used.by our ap │ │ │ │ │ - 0x011477d0 706c6963 6174696f 6e206173 2077656c plication as wel │ │ │ │ │ - 0x011477e0 6c206173 20616e79 206f7468 65722073 l as any other s │ │ │ │ │ - 0x011477f0 74617465 20776520 6d696768 74207761 tate we might wa │ │ │ │ │ - 0x01147800 6e742e0a 0a3e2064 61746120 41707020 nt...> data App │ │ │ │ │ - 0x01147810 3d204170 700a3e20 20202020 7b205f68 = App.> { _h │ │ │ │ │ - 0x01147820 65697374 20202020 2020203a 3a20536e eist :: Sn │ │ │ │ │ - 0x01147830 61706c65 74202848 65697374 20417070 aplet (Heist App │ │ │ │ │ - 0x01147840 290a3e20 20202020 2c205f66 6f6f2020 ).> , _foo │ │ │ │ │ - 0x01147850 20202020 2020203a 3a20536e 61706c65 :: Snaple │ │ │ │ │ - 0x01147860 7420466f 6f0a3e20 20202020 2c205f62 t Foo.> , _b │ │ │ │ │ - 0x01147870 61722020 20202020 2020203a 3a20536e ar :: Sn │ │ │ │ │ - 0x01147880 61706c65 74204261 720a3e20 20202020 aplet Bar.> │ │ │ │ │ - 0x01147890 2c205f63 6f6d7061 6e794e61 6d65203a , _companyName : │ │ │ │ │ - 0x011478a0 3a20494f 52656620 422e4279 74655374 : IORef B.ByteSt │ │ │ │ │ - 0x011478b0 72696e67 0a3e2020 2020207d 0a3e0a3e ring.> }.>.> │ │ │ │ │ - 0x011478c0 206d616b 654c656e 73657320 27274170 makeLenses ''Ap │ │ │ │ │ - 0x011478d0 700a0a54 68652066 69656c64 206e616d p..The field nam │ │ │ │ │ - 0x011478e0 65732062 6567696e 20776974 6820616e es begin with an │ │ │ │ │ - 0x011478f0 20756e64 65727363 6f726520 62656361 underscore beca │ │ │ │ │ - 0x01147900 75736520 6f662073 6f6d6520 6d6f7265 use of some more │ │ │ │ │ - 0x01147910 20636f6d 706c6963 61746564 0a746869 complicated.thi │ │ │ │ │ - 0x01147920 6e677320 676f696e 67206f6e 20756e64 ngs going on und │ │ │ │ │ - 0x01147930 65722074 68652068 6f6f642e 2020486f er the hood. Ho │ │ │ │ │ - 0x01147940 77657665 722c2061 6c6c2079 6f75206e wever, all you n │ │ │ │ │ - 0x01147950 65656420 746f206b 6e6f7720 72696768 eed to know righ │ │ │ │ │ - 0x01147960 74206e6f 77206973 0a746861 7420796f t now is.that yo │ │ │ │ │ - 0x01147970 75207368 6f756c64 20707265 66697820 u should prefix │ │ │ │ │ - 0x01147980 7468696e 67732077 69746820 616e2075 things with an u │ │ │ │ │ - 0x01147990 6e646572 73636f72 6520616e 64207468 nderscore and th │ │ │ │ │ - 0x011479a0 656e2063 616c6c20 606d616b 654c656e en call `makeLen │ │ │ │ │ - 0x011479b0 73657360 2e0a5468 6973206c 65747320 ses`..This lets │ │ │ │ │ - 0x011479c0 796f7520 75736520 74686520 6e616d65 you use the name │ │ │ │ │ - 0x011479d0 73207769 74686f75 7420616e 20756e64 s without an und │ │ │ │ │ - 0x011479e0 65727363 6f726520 696e2074 68652072 erscore in the r │ │ │ │ │ - 0x011479f0 65737420 6f662079 6f75720a 6170706c est of your.appl │ │ │ │ │ - 0x01147a00 69636174 696f6e2e 0a0a5468 65206e65 ication...The ne │ │ │ │ │ - 0x01147a10 78742074 68696e67 20776520 6e656564 xt thing we need │ │ │ │ │ - 0x01147a20 20746f20 646f2069 73206465 66696e65 to do is define │ │ │ │ │ - 0x01147a30 20616e20 696e6974 69616c69 7a65722e an initializer. │ │ │ │ │ - 0x01147a40 0a0a3e20 61707049 6e697420 3a3a2053 ..> appInit :: S │ │ │ │ │ - 0x01147a50 6e61706c 6574496e 69742041 70702041 napletInit App A │ │ │ │ │ - 0x01147a60 70700a3e 20617070 496e6974 203d206d pp.> appInit = m │ │ │ │ │ - 0x01147a70 616b6553 6e61706c 65742022 6d796170 akeSnaplet "myap │ │ │ │ │ - 0x01147a80 70222022 4d792065 78616d70 6c652061 p" "My example a │ │ │ │ │ - 0x01147a90 70706c69 63617469 6f6e2220 4e6f7468 pplication" Noth │ │ │ │ │ - 0x01147aa0 696e6720 2420646f 0a3e2020 20202068 ing $ do.> h │ │ │ │ │ - 0x01147ab0 73203c2d 206e6573 74536e61 706c6574 s <- nestSnaplet │ │ │ │ │ - 0x01147ac0 20226865 69737422 20686569 73742024 "heist" heist $ │ │ │ │ │ - 0x01147ad0 20686569 7374496e 69742022 74656d70 heistInit "temp │ │ │ │ │ - 0x01147ae0 6c617465 73220a3e 20202020 20667320 lates".> fs │ │ │ │ │ - 0x01147af0 3c2d206e 65737453 6e61706c 65742022 <- nestSnaplet " │ │ │ │ │ - 0x01147b00 666f6f22 20666f6f 20242066 6f6f496e foo" foo $ fooIn │ │ │ │ │ - 0x01147b10 69740a3e 20202020 20627320 3c2d206e it.> bs <- n │ │ │ │ │ - 0x01147b20 65737453 6e61706c 65742022 22206261 estSnaplet "" ba │ │ │ │ │ - 0x01147b30 72202420 6e616d65 536e6170 6c657420 r $ nameSnaplet │ │ │ │ │ - 0x01147b40 226e6577 6e616d65 22202420 62617249 "newname" $ barI │ │ │ │ │ - 0x01147b50 6e697420 666f6f0a 3e202020 20206164 nit foo.> ad │ │ │ │ │ - 0x01147b60 64526f75 74657320 5b202822 68656c6c dRoutes [ ("hell │ │ │ │ │ - 0x01147b70 6f222c20 77726974 65546578 74202268 o", writeText "h │ │ │ │ │ - 0x01147b80 656c6c6f 20776f72 6c642229 0a3e2020 ello world").> │ │ │ │ │ - 0x01147b90 20202020 20202020 20202020 202c2028 , ( │ │ │ │ │ - 0x01147ba0 22666f6f 6e616d65 222c2077 69746820 "fooname", with │ │ │ │ │ - 0x01147bb0 666f6f20 6e616d65 50616765 290a3e20 foo namePage).> │ │ │ │ │ - 0x01147bc0 20202020 20202020 20202020 20202c20 , │ │ │ │ │ - 0x01147bd0 28226261 726e616d 65222c20 77697468 ("barname", with │ │ │ │ │ - 0x01147be0 20626172 206e616d 65506167 65290a3e bar namePage).> │ │ │ │ │ - 0x01147bf0 20202020 20202020 20202020 2020202c , │ │ │ │ │ - 0x01147c00 20282263 6f6d7061 6e79222c 20636f6d ("company", com │ │ │ │ │ - 0x01147c10 70616e79 48616e64 6c657229 0a3e2020 panyHandler).> │ │ │ │ │ - 0x01147c20 20202020 20202020 20202020 205d0a3e ].> │ │ │ │ │ - 0x01147c30 20202020 20777261 70536974 6520283c wrapSite (< │ │ │ │ │ - 0x01147c40 7c3e2068 65697374 53657276 65290a3e |> heistServe).> │ │ │ │ │ - 0x01147c50 20202020 20726566 203c2d20 6c696674 ref <- lift │ │ │ │ │ - 0x01147c60 494f2024 206e6577 494f5265 66202266 IO $ newIORef "f │ │ │ │ │ - 0x01147c70 6f6f436f 7270220a 3e202020 20207265 ooCorp".> re │ │ │ │ │ - 0x01147c80 7475726e 20242041 70702068 73206673 turn $ App hs fs │ │ │ │ │ - 0x01147c90 20627320 7265660a 0a466f72 206e6f77 bs ref..For now │ │ │ │ │ - 0x01147ca0 20646f6e 27742077 6f727279 2061626f don't worry abo │ │ │ │ │ - 0x01147cb0 75742061 6c6c2074 68652064 65746169 ut all the detai │ │ │ │ │ - 0x01147cc0 6c73206f 66207468 69732063 6f64652e ls of this code. │ │ │ │ │ - 0x01147cd0 20205765 276c6c20 776f726b 20746872 We'll work thr │ │ │ │ │ - 0x01147ce0 6f756768 20746865 0a696e64 69766964 ough the.individ │ │ │ │ │ - 0x01147cf0 75616c20 70696563 6573206f 6e652061 ual pieces one a │ │ │ │ │ - 0x01147d00 74206120 74696d65 2e202054 68652062 t a time. The b │ │ │ │ │ - 0x01147d10 61736963 20696465 61206865 72652069 asic idea here i │ │ │ │ │ - 0x01147d20 73207468 61742074 6f20696e 69746961 s that to initia │ │ │ │ │ - 0x01147d30 6c697a65 20616e0a 6170706c 69636174 lize an.applicat │ │ │ │ │ - 0x01147d40 696f6e2c 20776520 66697273 7420696e ion, we first in │ │ │ │ │ - 0x01147d50 69746961 6c697a65 20656163 68206f66 itialize each of │ │ │ │ │ - 0x01147d60 20746865 20736e61 706c6574 732c2061 the snaplets, a │ │ │ │ │ - 0x01147d70 64642073 6f6d6520 726f7574 65732c20 dd some routes, │ │ │ │ │ - 0x01147d80 72756e20 610a6675 6e637469 6f6e2077 run a.function w │ │ │ │ │ - 0x01147d90 72617070 696e6720 616c6c20 74686520 rapping all the │ │ │ │ │ - 0x01147da0 726f7574 65732c20 616e6420 72657475 routes, and retu │ │ │ │ │ - 0x01147db0 726e2074 68652072 6573756c 74696e67 rn the resulting │ │ │ │ │ - 0x01147dc0 20737461 74652064 6174610a 73747275 state data.stru │ │ │ │ │ - 0x01147dd0 63747572 652e2020 54686973 20657861 cture. This exa │ │ │ │ │ - 0x01147de0 6d706c65 2064656d 6f6e7374 72617465 mple demonstrate │ │ │ │ │ - 0x01147df0 73207468 65207573 65206f66 20612066 s the use of a f │ │ │ │ │ - 0x01147e00 6577206f 66207468 65206d6f 73742063 ew of the most c │ │ │ │ │ - 0x01147e10 6f6d6d6f 6e0a736e 61706c65 74206675 ommon.snaplet fu │ │ │ │ │ - 0x01147e20 6e637469 6f6e732e 0a0a6e65 7374536e nctions...nestSn │ │ │ │ │ - 0x01147e30 61706c65 740a2d2d 2d2d2d2d 2d2d2d2d aplet.---------- │ │ │ │ │ - 0x01147e40 2d0a0a41 6c6c2063 616c6c73 20746f20 -..All calls to │ │ │ │ │ - 0x01147e50 6368696c 6420736e 61706c65 7420696e child snaplet in │ │ │ │ │ - 0x01147e60 69746961 6c697a65 72206675 6e637469 itializer functi │ │ │ │ │ - 0x01147e70 6f6e7320 6d757374 20626520 77726170 ons must be wrap │ │ │ │ │ - 0x01147e80 70656420 696e2061 2063616c 6c20746f ped in a call to │ │ │ │ │ - 0x01147e90 0a6e6573 74536e61 706c6574 2e202054 .nestSnaplet. T │ │ │ │ │ - 0x01147ea0 68652066 69727374 20706172 616d6574 he first paramet │ │ │ │ │ - 0x01147eb0 65722069 73206120 55524c20 70617468 er is a URL path │ │ │ │ │ - 0x01147ec0 20736567 6d656e74 20746861 74206973 segment that is │ │ │ │ │ - 0x01147ed0 20757365 6420746f 20707265 6669780a used to prefix. │ │ │ │ │ - 0x01147ee0 616c6c20 726f7574 65732064 6566696e all routes defin │ │ │ │ │ - 0x01147ef0 65642062 79207468 6520736e 61706c65 ed by the snaple │ │ │ │ │ - 0x01147f00 742e2020 54686973 206c6574 7320796f t. This lets yo │ │ │ │ │ - 0x01147f10 7520656e 73757265 20746861 74207468 u ensure that th │ │ │ │ │ - 0x01147f20 65726520 77696c6c 20626520 6e6f0a70 ere will be no.p │ │ │ │ │ - 0x01147f30 726f626c 656d7320 77697468 20647570 roblems with dup │ │ │ │ │ - 0x01147f40 6c696361 74652072 6f757465 73206465 licate routes de │ │ │ │ │ - 0x01147f50 66696e65 6420696e 20646966 66657265 fined in differe │ │ │ │ │ - 0x01147f60 6e742073 6e61706c 6574732e 20204966 nt snaplets. If │ │ │ │ │ - 0x01147f70 20746865 20666f6f 0a736e61 706c6574 the foo.snaplet │ │ │ │ │ - 0x01147f80 20646566 696e6573 20612072 6f757465 defines a route │ │ │ │ │ - 0x01147f90 20602f66 6f6f7061 6765602c 20746865 `/foopage`, the │ │ │ │ │ - 0x01147fa0 6e20696e 20746865 2061626f 76652065 n in the above e │ │ │ │ │ - 0x01147fb0 78616d70 6c652c20 74686174 20706167 xample, that pag │ │ │ │ │ - 0x01147fc0 65207769 6c6c0a62 65206176 61696c61 e will.be availa │ │ │ │ │ - 0x01147fd0 626c6520 61742060 2f666f6f 2f666f6f ble at `/foo/foo │ │ │ │ │ - 0x01147fe0 70616765 602e2020 536f6d65 74696d65 page`. Sometime │ │ │ │ │ - 0x01147ff0 73207468 6f756768 2c20796f 75206d69 s though, you mi │ │ │ │ │ - 0x01148000 67687420 77616e74 20612073 6e61706c ght want a snapl │ │ │ │ │ - 0x01148010 65742773 0a726f75 74657320 746f2062 et's.routes to b │ │ │ │ │ - 0x01148020 65206176 61696c61 626c6520 61742074 e available at t │ │ │ │ │ - 0x01148030 68652074 6f70206c 6576656c 2e202054 he top level. T │ │ │ │ │ - 0x01148040 6f20646f 20746861 742c206a 75737420 o do that, just │ │ │ │ │ - 0x01148050 70617373 20616e20 656d7074 79207374 pass an empty st │ │ │ │ │ - 0x01148060 72696e67 0a746f20 6e657374 536e6170 ring.to nestSnap │ │ │ │ │ - 0x01148070 6c657420 61732073 686f776e 2061626f let as shown abo │ │ │ │ │ - 0x01148080 76652077 69746820 74686520 62617220 ve with the bar │ │ │ │ │ - 0x01148090 736e6170 6c65742e 0a0a496e 206f7572 snaplet...In our │ │ │ │ │ - 0x011480a0 20657861 6d706c65 2061626f 76652c20 example above, │ │ │ │ │ - 0x011480b0 74686520 62617220 736e6170 6c657420 the bar snaplet │ │ │ │ │ - 0x011480c0 646f6573 20736f6d 65746869 6e672074 does something t │ │ │ │ │ - 0x011480d0 68617420 6e656564 7320746f 206b6e6f hat needs to kno │ │ │ │ │ - 0x011480e0 77206162 6f75740a 74686520 666f6f20 w about.the foo │ │ │ │ │ - 0x011480f0 736e6170 6c65742e 20204d61 79626520 snaplet. Maybe │ │ │ │ │ - 0x01148100 666f6f20 69732061 20646174 61626173 foo is a databas │ │ │ │ │ - 0x01148110 6520736e 61706c65 7420616e 64206261 e snaplet and ba │ │ │ │ │ - 0x01148120 72207761 6e747320 746f2073 746f7265 r wants to store │ │ │ │ │ - 0x01148130 206f720a 72656164 20736f6d 65746869 or.read somethi │ │ │ │ │ - 0x01148140 6e672e20 20496e20 6f726465 7220746f ng. In order to │ │ │ │ │ - 0x01148150 206d616b 65207468 61742068 61707065 make that happe │ │ │ │ │ - 0x01148160 6e2c2069 74206e65 65647320 746f2068 n, it needs to h │ │ │ │ │ - 0x01148170 61766520 61202268 616e646c 65222074 ave a "handle" t │ │ │ │ │ - 0x01148180 6f0a7468 6520736e 61706c65 742e2020 o.the snaplet. │ │ │ │ │ - 0x01148190 4f757220 68616e64 6c657320 61726520 Our handles are │ │ │ │ │ - 0x011481a0 77686174 65766572 20666965 6c64206e whatever field n │ │ │ │ │ - 0x011481b0 616d6573 20776520 75736564 20696e20 ames we used in │ │ │ │ │ - 0x011481c0 74686520 41707020 64617461 0a737472 the App data.str │ │ │ │ │ - 0x011481d0 75637475 7265206d 696e7573 20746865 ucture minus the │ │ │ │ │ - 0x011481e0 20696e69 7469616c 20756e64 65727363 initial undersc │ │ │ │ │ - 0x011481f0 6f726520 63686172 61637465 722e2020 ore character. │ │ │ │ │ - 0x01148200 54686579 20617265 20617574 6f6d6174 They are automat │ │ │ │ │ - 0x01148210 6963616c 6c790a67 656e6572 61746564 ically.generated │ │ │ │ │ - 0x01148220 20627920 74686520 606d616b 654c656e by the `makeLen │ │ │ │ │ - 0x01148230 73657360 2066756e 6374696f 6e2e2020 ses` function. │ │ │ │ │ - 0x01148240 466f7220 6e6f7720 69742773 20737566 For now it's suf │ │ │ │ │ - 0x01148250 66696369 656e7420 746f2074 68696e6b ficient to think │ │ │ │ │ - 0x01148260 206f660a 7468656d 20617320 61206765 of.them as a ge │ │ │ │ │ - 0x01148270 74746572 20616e64 20612073 65747465 tter and a sette │ │ │ │ │ - 0x01148280 7220636f 6d62696e 65642028 746f2075 r combined (to u │ │ │ │ │ - 0x01148290 73652061 6e204f4f 206d6574 6170686f se an OO metapho │ │ │ │ │ - 0x011482a0 72292e0a 0a546865 20736563 6f6e6420 r)...The second │ │ │ │ │ - 0x011482b0 70617261 6d657465 7220746f 206e6573 parameter to nes │ │ │ │ │ - 0x011482c0 74536e61 706c6574 20697320 74686520 tSnaplet is the │ │ │ │ │ - 0x011482d0 6c656e73 20746f20 74686520 736e6170 lens to the snap │ │ │ │ │ - 0x011482e0 6c657420 796f7527 7265206e 65737469 let you're nesti │ │ │ │ │ - 0x011482f0 6e672e0a 496e206f 72646572 20746f20 ng..In order to │ │ │ │ │ - 0x01148300 706c6163 65206120 70696563 6520696e place a piece in │ │ │ │ │ - 0x01148310 746f2074 68652070 757a7a6c 652c2079 to the puzzle, y │ │ │ │ │ - 0x01148320 6f75206e 65656420 746f206b 6e6f7720 ou need to know │ │ │ │ │ - 0x01148330 77686572 65206974 20676f65 732e0a0a where it goes... │ │ │ │ │ - 0x01148340 6e616d65 536e6170 6c65740a 2d2d2d2d nameSnaplet.---- │ │ │ │ │ - 0x01148350 2d2d2d2d 2d2d2d0a 0a546865 20617574 -------..The aut │ │ │ │ │ - 0x01148360 686f7220 6f662061 20736e61 706c6574 hor of a snaplet │ │ │ │ │ - 0x01148370 20646566 696e6573 20612064 65666175 defines a defau │ │ │ │ │ - 0x01148380 6c74206e 616d6520 666f7220 74686520 lt name for the │ │ │ │ │ - 0x01148390 736e6170 6c657420 696e2074 68652066 snaplet in the f │ │ │ │ │ - 0x011483a0 69727374 0a617267 756d656e 7420746f irst.argument to │ │ │ │ │ - 0x011483b0 20746865 206d616b 65536e61 706c6574 the makeSnaplet │ │ │ │ │ - 0x011483c0 2066756e 6374696f 6e2e2020 54686973 function. This │ │ │ │ │ - 0x011483d0 206e616d 65206973 20757365 6420666f name is used fo │ │ │ │ │ - 0x011483e0 72207468 6520736e 61706c65 7427730a r the snaplet's. │ │ │ │ │ - 0x011483f0 64697265 63746f72 7920696e 20746865 directory in the │ │ │ │ │ - 0x01148400 2066696c 65737973 74656d2e 20204966 filesystem. If │ │ │ │ │ - 0x01148410 20796f75 20646f6e 27742077 616e7420 you don't want │ │ │ │ │ - 0x01148420 746f2075 73652074 68652064 65666175 to use the defau │ │ │ │ │ - 0x01148430 6c74206e 616d652c 20796f75 0a63616e lt name, you.can │ │ │ │ │ - 0x01148440 206f7665 72726964 65206974 20776974 override it wit │ │ │ │ │ - 0x01148450 68207468 6520606e 616d6553 6e61706c h the `nameSnapl │ │ │ │ │ - 0x01148460 65746020 66756e63 74696f6e 2e202041 et` function. A │ │ │ │ │ - 0x01148470 6c736f2c 20696620 796f7520 77616e74 lso, if you want │ │ │ │ │ - 0x01148480 20746f20 68617665 2074776f 0a696e73 to have two.ins │ │ │ │ │ - 0x01148490 74616e63 6573206f 66207468 65207361 tances of the sa │ │ │ │ │ - 0x011484a0 6d652073 6e61706c 65742c20 7468656e me snaplet, then │ │ │ │ │ - 0x011484b0 20796f75 2077696c 6c206e65 65642074 you will need t │ │ │ │ │ - 0x011484c0 6f207573 6520606e 616d6553 6e61706c o use `nameSnapl │ │ │ │ │ - 0x011484d0 65746020 746f2067 6976650a 6174206c et` to give.at l │ │ │ │ │ - 0x011484e0 65617374 206f6e65 206f6620 7468656d east one of them │ │ │ │ │ - 0x011484f0 20612075 6e697175 65206e61 6d652e0a a unique name.. │ │ │ │ │ - 0x01148500 0a616464 526f7574 65730a2d 2d2d2d2d .addRoutes.----- │ │ │ │ │ - 0x01148510 2d2d2d2d 0a0a5468 65206061 6464526f ----..The `addRo │ │ │ │ │ - 0x01148520 75746573 60206675 6e637469 6f6e2069 utes` function i │ │ │ │ │ - 0x01148530 7320686f 7720616e 20617070 6c696361 s how an applica │ │ │ │ │ - 0x01148540 74696f6e 20286f72 20736e61 706c6574 tion (or snaplet │ │ │ │ │ - 0x01148550 29206465 66696e65 73206974 730a726f ) defines its.ro │ │ │ │ │ - 0x01148560 75746573 2e202055 6e646572 20746865 utes. Under the │ │ │ │ │ - 0x01148570 20686f6f 64207468 6520736e 61706c65 hood the snaple │ │ │ │ │ - 0x01148580 7420696e 66726173 74727563 74757265 t infrastructure │ │ │ │ │ - 0x01148590 206d6572 67657320 616c6c20 74686520 merges all the │ │ │ │ │ - 0x011485a0 726f7574 65732066 726f6d0a 616c6c20 routes from.all │ │ │ │ │ - 0x011485b0 736e6170 6c657473 2c207072 6570656e snaplets, prepen │ │ │ │ │ - 0x011485c0 64732070 72656669 78657320 66726f6d ds prefixes from │ │ │ │ │ - 0x011485d0 20606e65 7374536e 61706c65 74602063 `nestSnaplet` c │ │ │ │ │ - 0x011485e0 616c6c73 2c20616e 64207061 73736573 alls, and passes │ │ │ │ │ - 0x011485f0 20746865 206c6973 740a746f 20536e61 the list.to Sna │ │ │ │ │ - 0x01148600 7027730a 5b726f75 74655d28 68747470 p's.[route](http │ │ │ │ │ - 0x01148610 3a2f2f68 61636b61 67652e68 61736b65 ://hackage.haske │ │ │ │ │ - 0x01148620 6c6c2e6f 72672f70 61636b61 6765732f ll.org/packages/ │ │ │ │ │ - 0x01148630 61726368 6976652f 736e6170 2d636f72 archive/snap-cor │ │ │ │ │ - 0x01148640 652f302e 352e312e 342f646f 632f6874 e/0.5.1.4/doc/ht │ │ │ │ │ - 0x01148650 6d6c2f53 6e61702d 54797065 732e6874 ml/Snap-Types.ht │ │ │ │ │ - 0x01148660 6d6c2376 3a726f75 7465290a 66756e63 ml#v:route).func │ │ │ │ │ - 0x01148670 74696f6e 2e0a0a41 20726f75 74652069 tion...A route i │ │ │ │ │ - 0x01148680 73206120 7475706c 65206f66 20612055 s a tuple of a U │ │ │ │ │ - 0x01148690 524c2061 6e642061 2068616e 646c6572 RL and a handler │ │ │ │ │ - 0x011486a0 2066756e 6374696f 6e207468 61742077 function that w │ │ │ │ │ - 0x011486b0 696c6c20 62652063 616c6c65 64207768 ill be called wh │ │ │ │ │ - 0x011486c0 656e0a74 68652055 524c2069 73207265 en.the URL is re │ │ │ │ │ - 0x011486d0 71756573 7465642e 20204861 6e646c65 quested. Handle │ │ │ │ │ - 0x011486e0 72206973 20612077 72617070 65722061 r is a wrapper a │ │ │ │ │ - 0x011486f0 726f756e 64207468 6520536e 6170206d round the Snap m │ │ │ │ │ - 0x01148700 6f6e6164 20746861 74206861 6e646c65 onad that handle │ │ │ │ │ - 0x01148710 730a7468 6520736e 61706c65 74277320 s.the snaplet's │ │ │ │ │ - 0x01148720 696e6672 61737472 75637475 72652e20 infrastructure. │ │ │ │ │ - 0x01148730 20447572 696e6720 696e6974 69616c69 During initiali │ │ │ │ │ - 0x01148740 7a617469 6f6e2c20 736e6170 6c657473 zation, snaplets │ │ │ │ │ - 0x01148750 20757365 20746865 0a60496e 69746961 use the.`Initia │ │ │ │ │ - 0x01148760 6c697a65 7260206d 6f6e6164 2e202044 lizer` monad. D │ │ │ │ │ - 0x01148770 7572696e 67207275 6e74696d 652c2074 uring runtime, t │ │ │ │ │ - 0x01148780 68657920 75736520 74686520 6048616e hey use the `Han │ │ │ │ │ - 0x01148790 646c6572 60206d6f 6e61642e 20205765 dler` monad. We │ │ │ │ │ - 0x011487a0 276c6c0a 64697363 75737320 6048616e 'll.discuss `Han │ │ │ │ │ - 0x011487b0 646c6572 6020696e 206d6f72 65206465 dler` in more de │ │ │ │ │ - 0x011487c0 7461696c 206c6174 65722e20 20496620 tail later. If │ │ │ │ │ - 0x011487d0 796f7527 72652066 616d696c 69617220 you're familiar │ │ │ │ │ - 0x011487e0 77697468 20536e61 70277320 6f6c640a with Snap's old. │ │ │ │ │ - 0x011487f0 65787465 6e73696f 6e207379 7374656d extension system │ │ │ │ │ - 0x01148800 2c20796f 75206361 6e207468 696e6b20 , you can think │ │ │ │ │ - 0x01148810 6f662069 74206173 20726f75 67686c79 of it as roughly │ │ │ │ │ - 0x01148820 20657175 6976616c 656e7420 746f2074 equivalent to t │ │ │ │ │ - 0x01148830 68652041 70706c69 63617469 6f6e0a6d he Application.m │ │ │ │ │ - 0x01148840 6f6e6164 2e202049 74206861 73206120 onad. It has a │ │ │ │ │ - 0x01148850 604d6f6e 61645374 61746560 20696e73 `MonadState` ins │ │ │ │ │ - 0x01148860 74616e63 65207468 6174206c 65747320 tance that lets │ │ │ │ │ - 0x01148870 796f7520 61636365 73732061 6e64206d you access and m │ │ │ │ │ - 0x01148880 6f646966 79207468 650a6375 7272656e odify the.curren │ │ │ │ │ - 0x01148890 7420736e 61706c65 74277320 73746174 t snaplet's stat │ │ │ │ │ - 0x011488a0 652c2061 6e642061 20604d6f 6e616453 e, and a `MonadS │ │ │ │ │ - 0x011488b0 6e617060 20696e73 74616e63 65207072 nap` instance pr │ │ │ │ │ - 0x011488c0 6f766964 696e6720 7468650a 72657175 oviding the.requ │ │ │ │ │ - 0x011488d0 6573742d 70726f63 65737369 6e672066 est-processing f │ │ │ │ │ - 0x011488e0 756e6374 696f6e73 20646566 696e6564 unctions defined │ │ │ │ │ - 0x011488f0 20696e20 536e6170 2e547970 65732e0a in Snap.Types.. │ │ │ │ │ - 0x01148900 0a777261 70536974 650a2d2d 2d2d2d2d .wrapSite.------ │ │ │ │ │ - 0x01148910 2d2d2d2d 2d2d0a0a 60777261 70536974 ------..`wrapSit │ │ │ │ │ - 0x01148920 65602061 6c6c6f77 7320796f 7520746f e` allows you to │ │ │ │ │ - 0x01148930 20617070 6c792061 6e206172 62697472 apply an arbitr │ │ │ │ │ - 0x01148940 61727920 6048616e 646c6572 60207472 ary `Handler` tr │ │ │ │ │ - 0x01148950 616e7366 6f726d61 74696f6e 20746f0a ansformation to. │ │ │ │ │ - 0x01148960 74686520 746f702d 6c657665 6c206861 the top-level ha │ │ │ │ │ - 0x01148970 6e646c65 722e2020 54686973 20697320 ndler. This is │ │ │ │ │ - 0x01148980 75736566 756c2069 6620796f 75207761 useful if you wa │ │ │ │ │ - 0x01148990 6e742074 6f20646f 20736f6d 65206765 nt to do some ge │ │ │ │ │ - 0x011489a0 6e657269 630a7072 6f636573 73696e67 neric.processing │ │ │ │ │ - 0x011489b0 20617420 74686520 62656769 6e6e696e at the beginnin │ │ │ │ │ - 0x011489c0 67206f72 20656e64 206f6620 65766572 g or end of ever │ │ │ │ │ - 0x011489d0 79207265 71756573 742e2020 466f7220 y request. For │ │ │ │ │ - 0x011489e0 696e7374 616e6365 2c206120 73657373 instance, a sess │ │ │ │ │ - 0x011489f0 696f6e0a 736e6170 6c657420 6d696768 ion.snaplet migh │ │ │ │ │ - 0x01148a00 74207573 65206974 20746f20 746f7563 t use it to touc │ │ │ │ │ - 0x01148a10 68206120 73657373 696f6e20 61637469 h a session acti │ │ │ │ │ - 0x01148a20 76697479 20746f6b 656e2062 65666f72 vity token befor │ │ │ │ │ - 0x01148a30 6520726f 7574696e 67206861 7070656e e routing happen │ │ │ │ │ - 0x01148a40 732e0a49 7420636f 756c6420 616c736f s..It could also │ │ │ │ │ - 0x01148a50 20626520 75736564 20746f20 696d706c be used to impl │ │ │ │ │ - 0x01148a60 656d656e 74206375 73746f6d 206c6f67 ement custom log │ │ │ │ │ - 0x01148a70 67696e67 2e202054 68652065 78616d70 ging. The examp │ │ │ │ │ - 0x01148a80 6c652061 626f7665 20757365 73206974 le above uses it │ │ │ │ │ - 0x01148a90 0a746f20 64656669 6e652068 65697374 .to define heist │ │ │ │ │ - 0x01148aa0 53657276 65202870 726f7669 64656420 Serve (provided │ │ │ │ │ - 0x01148ab0 62792074 68652048 65697374 20736e61 by the Heist sna │ │ │ │ │ - 0x01148ac0 706c6574 29206173 20746865 20646566 plet) as the def │ │ │ │ │ - 0x01148ad0 61756c74 2068616e 646c6572 20746f0a ault handler to. │ │ │ │ │ - 0x01148ae0 62652074 72696564 20696620 6e6f206f be tried if no o │ │ │ │ │ - 0x01148af0 74686572 2068616e 646c6572 206d6174 ther handler mat │ │ │ │ │ - 0x01148b00 63686564 2e202054 68697320 6d617920 ched. This may │ │ │ │ │ - 0x01148b10 7365656d 206c696b 6520616e 20656173 seem like an eas │ │ │ │ │ - 0x01148b20 79207761 7920746f 20646566 696e650a y way to define. │ │ │ │ │ - 0x01148b30 726f7574 65732c20 62757420 69662079 routes, but if y │ │ │ │ │ - 0x01148b40 6f752073 7472696e 67207468 656d2061 ou string them a │ │ │ │ │ - 0x01148b50 6c6c2074 6f676574 68657220 696e2074 ll together in t │ │ │ │ │ - 0x01148b60 68697320 77617920 65616368 2068616e his way each han │ │ │ │ │ - 0x01148b70 646c6572 2077696c 6c206265 0a657661 dler will be.eva │ │ │ │ │ - 0x01148b80 6c756174 65642073 65717565 6e746961 luated sequentia │ │ │ │ │ - 0x01148b90 6c6c7920 616e6420 796f7527 6c6c2067 lly and you'll g │ │ │ │ │ - 0x01148ba0 6574204f 286e2920 74696d65 20636f6d et O(n) time com │ │ │ │ │ - 0x01148bb0 706c6578 6974792c 20776865 72656173 plexity, whereas │ │ │ │ │ - 0x01148bc0 20726f75 7465730a 64656669 6e656420 routes.defined │ │ │ │ │ - 0x01148bd0 77697468 20606164 64526f75 74657360 with `addRoutes` │ │ │ │ │ - 0x01148be0 20686176 65204f28 6c6f6720 6e292074 have O(log n) t │ │ │ │ │ - 0x01148bf0 696d6520 636f6d70 6c657869 74792e20 ime complexity. │ │ │ │ │ - 0x01148c00 20546865 7265666f 72652c20 696e2061 Therefore, in a │ │ │ │ │ - 0x01148c10 0a726561 6c2d776f 726c6420 6170706c .real-world appl │ │ │ │ │ - 0x01148c20 69636174 696f6e20 796f7520 776f756c ication you woul │ │ │ │ │ - 0x01148c30 64207072 6f626162 6c792077 616e7420 d probably want │ │ │ │ │ - 0x01148c40 746f2068 61766520 60282222 2c206865 to have `("", he │ │ │ │ │ - 0x01148c50 69737453 65727665 29602069 6e0a7468 istServe)` in.th │ │ │ │ │ - 0x01148c60 65206c69 73742070 61737365 6420746f e list passed to │ │ │ │ │ - 0x01148c70 20606164 64526f75 74657360 2e0a0a77 `addRoutes`...w │ │ │ │ │ - 0x01148c80 6974680a 2d2d2d2d 0a0a5468 65206c61 ith.----..The la │ │ │ │ │ - 0x01148c90 73742075 6e66616d 696c6961 72206675 st unfamiliar fu │ │ │ │ │ - 0x01148ca0 6e637469 6f6e2069 6e207468 65206578 nction in the ex │ │ │ │ │ - 0x01148cb0 616d706c 65206973 20607769 7468602e ample is `with`. │ │ │ │ │ - 0x01148cc0 20204865 72652069 74206163 636f6d70 Here it accomp │ │ │ │ │ - 0x01148cd0 616e6965 7320610a 63616c6c 20746f20 anies a.call to │ │ │ │ │ - 0x01148ce0 74686520 66756e63 74696f6e 20606e61 the function `na │ │ │ │ │ - 0x01148cf0 6d655061 6765602e 2020606e 616d6550 mePage`. `nameP │ │ │ │ │ - 0x01148d00 61676560 20697320 61207369 6d706c65 age` is a simple │ │ │ │ │ - 0x01148d10 20657861 6d706c65 2068616e 646c6572 example handler │ │ │ │ │ - 0x01148d20 20616e64 0a6c6f6f 6b73206c 696b6520 and.looks like │ │ │ │ │ - 0x01148d30 74686973 2e0a0a3e 206e616d 65506167 this...> namePag │ │ │ │ │ - 0x01148d40 65203a3a 2048616e 646c6572 20622076 e :: Handler b v │ │ │ │ │ - 0x01148d50 2028290a 3e206e61 6d655061 6765203d ().> namePage = │ │ │ │ │ - 0x01148d60 20646f0a 3e202020 20206d6e 616d6520 do.> mname │ │ │ │ │ - 0x01148d70 3c2d2067 6574536e 61706c65 744e616d <- getSnapletNam │ │ │ │ │ - 0x01148d80 650a3e20 20202020 77726974 65546578 e.> writeTex │ │ │ │ │ - 0x01148d90 74202420 66726f6d 4d617962 65202254 t $ fromMaybe "T │ │ │ │ │ - 0x01148da0 68697320 73686f75 6c646e27 74206861 his shouldn't ha │ │ │ │ │ - 0x01148db0 7070656e 22206d6e 616d650a 0a546869 ppen" mname..Thi │ │ │ │ │ - 0x01148dc0 73206675 6e637469 6f6e2069 73206120 s function is a │ │ │ │ │ - 0x01148dd0 67656e65 72696320 68616e64 6c657220 generic handler │ │ │ │ │ - 0x01148de0 74686174 20676574 73207468 65206e61 that gets the na │ │ │ │ │ - 0x01148df0 6d65206f 66207468 65206375 7272656e me of the curren │ │ │ │ │ - 0x01148e00 7420736e 61706c65 740a616e 64207772 t snaplet.and wr │ │ │ │ │ - 0x01148e10 69746573 20697420 696e746f 20746865 ites it into the │ │ │ │ │ - 0x01148e20 20726573 706f6e73 65207769 74682074 response with t │ │ │ │ │ - 0x01148e30 68652060 77726974 65546578 74602066 he `writeText` f │ │ │ │ │ - 0x01148e40 756e6374 696f6e20 64656669 6e656420 unction defined │ │ │ │ │ - 0x01148e50 62792074 68650a73 6e61702d 636f7265 by the.snap-core │ │ │ │ │ - 0x01148e60 2070726f 6a656374 2e202054 68652074 project. The t │ │ │ │ │ - 0x01148e70 79706520 76617269 61626c65 73202762 ype variables 'b │ │ │ │ │ - 0x01148e80 2720616e 64202776 2720696e 64696361 ' and 'v' indica │ │ │ │ │ - 0x01148e90 74652074 68617420 74686973 2066756e te that this fun │ │ │ │ │ - 0x01148ea0 6374696f 6e0a7769 6c6c2077 6f726b20 ction.will work │ │ │ │ │ - 0x01148eb0 696e2061 6e792073 6e61706c 65742077 in any snaplet w │ │ │ │ │ - 0x01148ec0 69746820 616e7920 62617365 20617070 ith any base app │ │ │ │ │ - 0x01148ed0 6c696361 74696f6e 2e202054 68652027 lication. The ' │ │ │ │ │ - 0x01148ee0 77697468 27206675 6e637469 6f6e2069 with' function i │ │ │ │ │ - 0x01148ef0 730a7573 65642074 6f207275 6e20606e s.used to run `n │ │ │ │ │ - 0x01148f00 616d6550 61676560 20696e20 74686520 amePage` in the │ │ │ │ │ - 0x01148f10 636f6e74 65787420 6f662074 68652073 context of the s │ │ │ │ │ - 0x01148f20 6e61706c 65747320 666f6f20 616e6420 naplets foo and │ │ │ │ │ - 0x01148f30 62617220 666f7220 7468650a 636f7272 bar for the.corr │ │ │ │ │ - 0x01148f40 6573706f 6e64696e 6720726f 75746573 esponding routes │ │ │ │ │ - 0x01148f50 2e0a0a53 69746520 52656c6f 6164696e ...Site Reloadin │ │ │ │ │ - 0x01148f60 670a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d g.-------------- │ │ │ │ │ - 0x01148f70 0a0a536e 61706c65 7420496e 69746961 ..Snaplet Initia │ │ │ │ │ - 0x01148f80 6c697a65 72732073 65727665 20647561 lizers serve dua │ │ │ │ │ - 0x01148f90 6c207075 72706f73 65206173 20626f74 l purpose as bot │ │ │ │ │ - 0x01148fa0 6820696e 69746961 6c697a65 72732061 h initializers a │ │ │ │ │ - 0x01148fb0 6e642072 656c6f61 64657273 2e0a5265 nd reloaders..Re │ │ │ │ │ - 0x01148fc0 6c6f6164 73206172 65207472 69676765 loads are trigge │ │ │ │ │ - 0x01148fd0 72656420 62792061 20737065 6369616c red by a special │ │ │ │ │ - 0x01148fe0 2068616e 646c6572 20746861 74206973 handler that is │ │ │ │ │ - 0x01148ff0 20626f75 6e642074 6f207468 650a602f bound to the.`/ │ │ │ │ │ - 0x01149000 61646d69 6e2f7265 6c6f6164 6020726f admin/reload` ro │ │ │ │ │ - 0x01149010 7574652e 20205468 69732068 616e646c ute. This handl │ │ │ │ │ - 0x01149020 65722072 652d7275 6e732074 68652073 er re-runs the s │ │ │ │ │ - 0x01149030 69746520 696e6974 69616c69 7a657220 ite initializer │ │ │ │ │ - 0x01149040 616e6420 69662069 74206973 0a737563 and if it is.suc │ │ │ │ │ - 0x01149050 63657373 66756c2c 206c6f61 64732074 cessful, loads t │ │ │ │ │ - 0x01149060 6865206e 65776c79 2067656e 65726174 he newly generat │ │ │ │ │ - 0x01149070 65642069 6e2d6d65 6d6f7279 20737461 ed in-memory sta │ │ │ │ │ - 0x01149080 74652e20 20546f20 70726576 656e7420 te. To prevent │ │ │ │ │ - 0x01149090 64656e69 616c206f 660a7365 72766963 denial of.servic │ │ │ │ │ - 0x011490a0 65206174 7461636b 732c2074 68652072 e attacks, the r │ │ │ │ │ - 0x011490b0 656c6f61 6420726f 75746520 6973206f eload route is o │ │ │ │ │ - 0x011490c0 6e6c7920 61636365 73736962 6c652066 nly accessible f │ │ │ │ │ - 0x011490d0 726f6d20 6c6f6361 6c686f73 742e0a0a rom localhost... │ │ │ │ │ - 0x011490e0 49662074 68657265 20617265 20616e79 If there are any │ │ │ │ │ - 0x011490f0 20657272 6f727320 64757269 6e672072 errors during r │ │ │ │ │ - 0x01149100 656c6f61 642c2079 6f752077 6f756c64 eload, you would │ │ │ │ │ - 0x01149110 206e6174 7572616c 6c792077 616e7420 naturally want │ │ │ │ │ - 0x01149120 746f2073 65652074 68656d20 696e0a74 to see them in.t │ │ │ │ │ - 0x01149130 68652048 54545020 72657370 6f6e7365 he HTTP response │ │ │ │ │ - 0x01149140 20726574 75726e65 64206279 20746865 returned by the │ │ │ │ │ - 0x01149150 20736572 7665722e 2020486f 77657665 server. Howeve │ │ │ │ │ - 0x01149160 722c2077 68656e20 74686573 65207361 r, when these sa │ │ │ │ │ - 0x01149170 6d650a69 6e697469 616c697a 65727320 me.initializers │ │ │ │ │ - 0x01149180 61726520 72756e20 7768656e 20796f75 are run when you │ │ │ │ │ - 0x01149190 20666972 73742073 74617274 20796f75 first start you │ │ │ │ │ - 0x011491a0 72206170 702c2079 6f752077 696c6c20 r app, you will │ │ │ │ │ - 0x011491b0 77616e74 20746f20 7365650a 73746174 want to see.stat │ │ │ │ │ - 0x011491c0 7573206d 65737361 67657320 7072696e us messages prin │ │ │ │ │ - 0x011491d0 74656420 746f2074 68652063 6f6e736f ted to the conso │ │ │ │ │ - 0x011491e0 6c652e20 20546f20 6d616b65 20746869 le. To make thi │ │ │ │ │ - 0x011491f0 7320706f 73736962 6c652077 65207072 s possible we pr │ │ │ │ │ - 0x01149200 6f766964 65207468 650a6070 72696e74 ovide the.`print │ │ │ │ │ - 0x01149210 496e666f 60206675 6e637469 6f6e2e20 Info` function. │ │ │ │ │ - 0x01149220 20596f75 2073686f 756c6420 75736520 You should use │ │ │ │ │ - 0x01149230 69742074 6f206f75 74707574 20616e79 it to output any │ │ │ │ │ - 0x01149240 20696e66 6f726d61 74696f6e 616c206d informational m │ │ │ │ │ - 0x01149250 65737361 6765730a 67656e65 72617465 essages.generate │ │ │ │ │ - 0x01149260 64206279 20796f75 7220696e 69746961 d by your initia │ │ │ │ │ - 0x01149270 6c697a65 72732e20 20496620 796f7520 lizers. If you │ │ │ │ │ - 0x01149280 7072696e 74206469 72656374 6c792074 print directly t │ │ │ │ │ - 0x01149290 6f207374 616e6461 7264206f 75747075 o standard outpu │ │ │ │ │ - 0x011492a0 74206f72 0a737461 6e646172 64206572 t or.standard er │ │ │ │ │ - 0x011492b0 726f722c 20746865 6e207468 6f736520 ror, then those │ │ │ │ │ - 0x011492c0 6d657373 61676573 2077696c 6c206e6f messages will no │ │ │ │ │ - 0x011492d0 74206265 20617661 696c6162 6c652069 t be available i │ │ │ │ │ - 0x011492e0 6e20796f 75722062 726f7773 65722077 n your browser w │ │ │ │ │ - 0x011492f0 68656e0a 796f7520 72656c6f 61642074 hen.you reload t │ │ │ │ │ - 0x01149300 68652073 6974652e 0a0a576f 726b696e he site...Workin │ │ │ │ │ - 0x01149310 67207769 74682073 74617465 0a2d2d2d g with state.--- │ │ │ │ │ - 0x01149320 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ │ - 0x01149330 0a604861 6e646c65 72206220 76602068 .`Handler b v` h │ │ │ │ │ - 0x01149340 61732061 20604d6f 6e616453 74617465 as a `MonadState │ │ │ │ │ - 0x01149350 20766020 696e7374 616e6365 2e202054 v` instance. T │ │ │ │ │ - 0x01149360 68697320 6d65616e 73207468 61742079 his means that y │ │ │ │ │ - 0x01149370 6f752063 616e2061 63636573 730a616c ou can access.al │ │ │ │ │ - 0x01149380 6c20796f 75722073 6e61706c 65742073 l your snaplet s │ │ │ │ │ - 0x01149390 74617465 20746872 6f756768 20746865 tate through the │ │ │ │ │ - 0x011493a0 20676574 2c207075 742c2067 6574732c get, put, gets, │ │ │ │ │ - 0x011493b0 20616e64 206d6f64 69667920 66756e63 and modify func │ │ │ │ │ - 0x011493c0 74696f6e 73207468 61740a61 72652070 tions that.are p │ │ │ │ │ - 0x011493d0 726f6261 626c7920 66616d69 6c696172 robably familiar │ │ │ │ │ - 0x011493e0 2066726f 6d207468 65207374 61746520 from the state │ │ │ │ │ - 0x011493f0 6d6f6e61 642e2020 496e206f 75722065 monad. In our e │ │ │ │ │ - 0x01149400 78616d70 6c652061 70706c69 63617469 xample applicati │ │ │ │ │ - 0x01149410 6f6e2077 650a6465 6d6f6e73 74726174 on we.demonstrat │ │ │ │ │ - 0x01149420 65207468 69732077 69746820 60636f6d e this with `com │ │ │ │ │ - 0x01149430 70616e79 48616e64 6c657260 2e0a0a3e panyHandler`...> │ │ │ │ │ - 0x01149440 20636f6d 70616e79 48616e64 6c657220 companyHandler │ │ │ │ │ - 0x01149450 3a3a2048 616e646c 65722041 70702041 :: Handler App A │ │ │ │ │ - 0x01149460 70702028 290a3e20 636f6d70 616e7948 pp ().> companyH │ │ │ │ │ - 0x01149470 616e646c 6572203d 206d6574 686f6420 andler = method │ │ │ │ │ - 0x01149480 47455420 67657474 6572203c 7c3e206d GET getter <|> m │ │ │ │ │ - 0x01149490 6574686f 6420504f 53542073 65747465 ethod POST sette │ │ │ │ │ - 0x011494a0 720a3e20 20207768 6572650a 3e202020 r.> where.> │ │ │ │ │ - 0x011494b0 20206765 74746572 203d2064 6f0a3e20 getter = do.> │ │ │ │ │ - 0x011494c0 20202020 20202020 6e616d65 52656620 nameRef │ │ │ │ │ - 0x011494d0 3c2d2067 65747320 5f636f6d 70616e79 <- gets _company │ │ │ │ │ - 0x011494e0 4e616d65 0a3e2020 20202020 2020206e Name.> n │ │ │ │ │ - 0x011494f0 616d6520 3c2d206c 69667449 4f202420 ame <- liftIO $ │ │ │ │ │ - 0x01149500 72656164 494f5265 66206e61 6d655265 readIORef nameRe │ │ │ │ │ - 0x01149510 660a3e20 20202020 20202020 77726974 f.> writ │ │ │ │ │ - 0x01149520 65425320 6e616d65 0a3e2020 20202073 eBS name.> s │ │ │ │ │ - 0x01149530 65747465 72203d20 646f0a3e 20202020 etter = do.> │ │ │ │ │ - 0x01149540 20202020 206d6e61 6d65203c 2d206765 mname <- ge │ │ │ │ │ - 0x01149550 74506172 616d2022 6e616d65 220a3e20 tParam "name".> │ │ │ │ │ - 0x01149560 20202020 20202020 6e616d65 52656620 nameRef │ │ │ │ │ - 0x01149570 3c2d2067 65747320 5f636f6d 70616e79 <- gets _company │ │ │ │ │ - 0x01149580 4e616d65 0a3e2020 20202020 2020206c Name.> l │ │ │ │ │ - 0x01149590 69667449 4f202420 6d617962 65202872 iftIO $ maybe (r │ │ │ │ │ - 0x011495a0 65747572 6e202829 29202877 72697465 eturn ()) (write │ │ │ │ │ - 0x011495b0 494f5265 66206e61 6d655265 6629206d IORef nameRef) m │ │ │ │ │ - 0x011495c0 6e616d65 0a3e2020 20202020 20202067 name.> g │ │ │ │ │ - 0x011495d0 65747465 720a0a49 6620796f 75207365 etter..If you se │ │ │ │ │ - 0x011495e0 74206120 47455420 72657175 65737420 t a GET request │ │ │ │ │ - 0x011495f0 746f2060 2f636f6d 70616e79 602c2079 to `/company`, y │ │ │ │ │ - 0x01149600 6f75276c 6c206765 74207468 65207374 ou'll get the st │ │ │ │ │ - 0x01149610 72696e67 2022666f 6f436f72 70222062 ring "fooCorp" b │ │ │ │ │ - 0x01149620 61636b2e 0a496620 796f7520 73656e64 ack..If you send │ │ │ │ │ - 0x01149630 20612050 4f535420 72657175 6573742c a POST request, │ │ │ │ │ - 0x01149640 20697420 77696c6c 20736574 20746865 it will set the │ │ │ │ │ - 0x01149650 20494f52 65662068 656c6420 696e2074 IORef held in t │ │ │ │ │ - 0x01149660 68652060 5f636f6d 70616e79 4e616d65 he `_companyName │ │ │ │ │ - 0x01149670 600a6669 656c6420 696e2074 68652060 `.field in the ` │ │ │ │ │ - 0x01149680 41707060 20646174 61207374 72756374 App` data struct │ │ │ │ │ - 0x01149690 75726520 746f2074 68652076 616c7565 ure to the value │ │ │ │ │ - 0x011496a0 206f6620 74686520 606e616d 65602066 of the `name` f │ │ │ │ │ - 0x011496b0 69656c64 2e202054 68656e20 69740a63 ield. Then it.c │ │ │ │ │ - 0x011496c0 616c6c73 20746865 20676574 74657220 alls the getter │ │ │ │ │ - 0x011496d0 746f2072 65747572 6e207468 61742076 to return that v │ │ │ │ │ - 0x011496e0 616c7565 20626163 6b20746f 20796f75 alue back to you │ │ │ │ │ - 0x011496f0 20736f20 796f7520 63616e20 73656520 so you can see │ │ │ │ │ - 0x01149700 69742077 61730a61 63747561 6c6c7920 it was.actually │ │ │ │ │ - 0x01149710 6368616e 6765642e 20204167 61696e2c changed. Again, │ │ │ │ │ - 0x01149720 2072656d 656d6265 72207468 61742074 remember that t │ │ │ │ │ - 0x01149730 68697320 6368616e 6765206f 6e6c7920 his change only │ │ │ │ │ - 0x01149740 70657273 69737473 20616372 6f73730a persists across. │ │ │ │ │ - 0x01149750 72657175 65737473 20626563 61757365 requests because │ │ │ │ │ - 0x01149760 20776520 75736564 20616e20 494f5265 we used an IORe │ │ │ │ │ - 0x01149770 662e2020 49662060 5f636f6d 70616e79 f. If `_company │ │ │ │ │ - 0x01149780 4e616d65 60207761 73206a75 73742061 Name` was just a │ │ │ │ │ - 0x01149790 20706c61 696e2073 7472696e 670a616e plain string.an │ │ │ │ │ - 0x011497a0 64207765 20686164 20757365 64206d6f d we had used mo │ │ │ │ │ - 0x011497b0 64696679 2c207468 65206368 616e6765 dify, the change │ │ │ │ │ - 0x011497c0 64207265 73756c74 20776f75 6c64206f d result would o │ │ │ │ │ - 0x011497d0 6e6c7920 62652076 69736962 6c652069 nly be visible i │ │ │ │ │ - 0x011497e0 6e207468 65207265 73740a6f 66207468 n the rest.of th │ │ │ │ │ - 0x011497f0 65207072 6f636573 73696e67 20666f72 e processing for │ │ │ │ │ - 0x01149800 20746861 74207265 71756573 742e0a0a that request... │ │ │ │ │ - 0x01149810 54686520 48656973 7420536e 61706c65 The Heist Snaple │ │ │ │ │ - 0x01149820 740a3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d t.============== │ │ │ │ │ - 0x01149830 3d3d3d0a 0a546865 20617374 75746520 ===..The astute │ │ │ │ │ - 0x01149840 72656164 6572206d 69676874 2061736b reader might ask │ │ │ │ │ - 0x01149850 20776879 20746865 72652069 73206e6f why there is no │ │ │ │ │ - 0x01149860 20607769 74682068 65697374 6020696e `with heist` in │ │ │ │ │ - 0x01149870 2066726f 6e74206f 66207468 65206361 front of the ca │ │ │ │ │ - 0x01149880 6c6c0a74 6f206068 65697374 53657276 ll.to `heistServ │ │ │ │ │ - 0x01149890 65602e20 20416e64 20696e64 6565642c e`. And indeed, │ │ │ │ │ - 0x011498a0 20746861 7420776f 756c6420 6e6f726d that would norm │ │ │ │ │ - 0x011498b0 616c6c79 20626520 74686520 63617365 ally be the case │ │ │ │ │ - 0x011498c0 2e202042 75742077 65206465 63696465 . But we decide │ │ │ │ │ - 0x011498d0 640a7468 61742061 6e206170 706c6963 d.that an applic │ │ │ │ │ - 0x011498e0 6174696f 6e207769 6c6c206e 65766572 ation will never │ │ │ │ │ - 0x011498f0 206e6565 64206d6f 72652074 68616e20 need more than │ │ │ │ │ - 0x01149900 6f6e6520 696e7374 616e6365 206f6620 one instance of │ │ │ │ │ - 0x01149910 61204865 69737420 736e6170 6c65742e a Heist snaplet. │ │ │ │ │ - 0x01149920 0a536f20 77652070 726f7669 64656420 .So we provided │ │ │ │ │ - 0x01149930 61207479 70652063 6c617373 2063616c a type class cal │ │ │ │ │ - 0x01149940 6c656420 60486173 48656973 74602074 led `HasHeist` t │ │ │ │ │ - 0x01149950 68617420 616c6c6f 77732061 6e206170 hat allows an ap │ │ │ │ │ - 0x01149960 706c6963 6174696f 6e20746f 0a646566 plication to.def │ │ │ │ │ - 0x01149970 696e6520 74686520 676c6f62 616c2072 ine the global r │ │ │ │ │ - 0x01149980 65666572 656e6365 20746f20 69747320 eference to its │ │ │ │ │ - 0x01149990 48656973 7420736e 61706c65 74206279 Heist snaplet by │ │ │ │ │ - 0x011499a0 20777269 74696e67 20612060 48617348 writing a `HasH │ │ │ │ │ - 0x011499b0 65697374 600a696e 7374616e 63652e20 eist`.instance. │ │ │ │ │ - 0x011499c0 20496e20 74686973 20657861 6d706c65 In this example │ │ │ │ │ - 0x011499d0 20776520 64656669 6e652074 68652069 we define the i │ │ │ │ │ - 0x011499e0 6e737461 6e636520 61732066 6f6c6c6f nstance as follo │ │ │ │ │ - 0x011499f0 77733a0a 0a3e2069 6e737461 6e636520 ws:..> instance │ │ │ │ │ - 0x01149a00 48617348 65697374 20417070 20776865 HasHeist App whe │ │ │ │ │ - 0x01149a10 72652068 65697374 4c656e73 203d2073 re heistLens = s │ │ │ │ │ - 0x01149a20 7562536e 61706c65 74206865 6973740a ubSnaplet heist. │ │ │ │ │ - 0x01149a30 0a4e6f77 20616c6c 20776520 6e656564 .Now all we need │ │ │ │ │ - 0x01149a40 20697320 61207369 6d706c65 206d6169 is a simple mai │ │ │ │ │ - 0x01149a50 6e206675 6e637469 6f6e2074 6f207365 n function to se │ │ │ │ │ - 0x01149a60 72766520 6f757220 6170706c 69636174 rve our applicat │ │ │ │ │ - 0x01149a70 696f6e2e 0a0a3e20 6d61696e 203a3a20 ion...> main :: │ │ │ │ │ - 0x01149a80 494f2028 290a3e20 6d61696e 203d2073 IO ().> main = s │ │ │ │ │ - 0x01149a90 65727665 536e6170 6c657420 64656661 erveSnaplet defa │ │ │ │ │ - 0x01149aa0 756c7443 6f6e6669 67206170 70496e69 ultConfig appIni │ │ │ │ │ - 0x01149ab0 740a0a54 68697320 636f6d70 6c657465 t..This complete │ │ │ │ │ - 0x01149ac0 73206120 66756c6c 20776f72 6b696e67 s a full working │ │ │ │ │ - 0x01149ad0 20617070 6c696361 74696f6e 2e202057 application. W │ │ │ │ │ - 0x01149ae0 65206469 64206c65 61766520 6f757420 e did leave out │ │ │ │ │ - 0x01149af0 61206c69 74746c65 2064756d 6d790a63 a little dummy.c │ │ │ │ │ - 0x01149b00 6f646520 666f7220 74686520 466f6f20 ode for the Foo │ │ │ │ │ - 0x01149b10 616e6420 42617220 736e6170 6c657473 and Bar snaplets │ │ │ │ │ - 0x01149b20 2e202054 68697320 636f6465 20697320 . This code is │ │ │ │ │ - 0x01149b30 696e636c 75646564 20696e20 50617274 included in Part │ │ │ │ │ - 0x01149b40 322e6873 2e202046 6f720a6d 6f726520 2.hs. For.more │ │ │ │ │ - 0x01149b50 696e666f 726d6174 696f6e20 6c6f6f6b information look │ │ │ │ │ - 0x01149b60 20696e20 6f757220 5b415049 0a646f63 in our [API.doc │ │ │ │ │ - 0x01149b70 756d656e 74617469 6f6e5d28 68747470 umentation](http │ │ │ │ │ - 0x01149b80 3a2f2f68 61636b61 67652e68 61736b65 ://hackage.haske │ │ │ │ │ - 0x01149b90 6c6c2e6f 72672f70 61636b61 67652f73 ll.org/package/s │ │ │ │ │ - 0x01149ba0 6e617029 2c207370 65636966 6963616c nap), specifical │ │ │ │ │ - 0x01149bb0 6c792074 68650a53 6e61702e 536e6170 ly the.Snap.Snap │ │ │ │ │ - 0x01149bc0 6c657420 6d6f6475 6c652e20 204e6f20 let module. No │ │ │ │ │ - 0x01149bd0 7265616c 6c792c20 74686174 20776173 really, that was │ │ │ │ │ - 0x01149be0 6e277420 61206a6f 6b652e20 20546865 n't a joke. The │ │ │ │ │ - 0x01149bf0 20415049 20646f63 73206172 65207772 API docs are wr │ │ │ │ │ - 0x01149c00 69747465 6e0a6173 2070726f 73652e20 itten.as prose. │ │ │ │ │ - 0x01149c10 20546865 79207368 6f756c64 20626520 They should be │ │ │ │ │ - 0x01149c20 76657279 20656173 7920746f 20726561 very easy to rea │ │ │ │ │ - 0x01149c30 642c2077 68696c65 20686176 696e6720 d, while having │ │ │ │ │ - 0x01149c40 74686520 62656e65 66697420 6f660a69 the benefit of.i │ │ │ │ │ - 0x01149c50 6e636c75 64696e67 20616c6c 20746865 ncluding all the │ │ │ │ │ - 0x01149c60 20616374 75616c20 74797065 20736967 actual type sig │ │ │ │ │ - 0x01149c70 6e617475 7265732e 0a0a4669 6c657379 natures...Filesy │ │ │ │ │ - 0x01149c80 7374656d 20446174 6120616e 64204175 stem Data and Au │ │ │ │ │ - 0x01149c90 746f6d61 74696320 496e7374 616c6c61 tomatic Installa │ │ │ │ │ - 0x01149ca0 74696f6e 0a3d3d3d 3d3d3d3d 3d3d3d3d tion.=========== │ │ │ │ │ - 0x01149cb0 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================ │ │ │ │ │ - 0x01149cc0 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d0a ===============. │ │ │ │ │ - 0x01149cd0 0a536f6d 6520736e 61706c65 74732077 .Some snaplets w │ │ │ │ │ - 0x01149ce0 696c6c20 68617665 20646174 61207374 ill have data st │ │ │ │ │ - 0x01149cf0 6f726564 20696e20 74686520 66696c65 ored in the file │ │ │ │ │ - 0x01149d00 73797374 656d2074 68617420 73686f75 system that shou │ │ │ │ │ - 0x01149d10 6c642062 6520696e 7374616c 6c65640a ld be installed. │ │ │ │ │ - 0x01149d20 696e746f 20746865 20646972 6563746f into the directo │ │ │ │ │ - 0x01149d30 7279206f 6620616e 79207072 6f6a6563 ry of any projec │ │ │ │ │ - 0x01149d40 74207468 61742075 73657320 69742e20 t that uses it. │ │ │ │ │ - 0x01149d50 20486572 65277320 616e2065 78616d70 Here's an examp │ │ │ │ │ - 0x01149d60 6c65206f 66207768 61742061 0a736e61 le of what a.sna │ │ │ │ │ - 0x01149d70 706c6574 2066696c 65737973 74656d20 plet filesystem │ │ │ │ │ - 0x01149d80 6c61796f 7574206d 69676874 206c6f6f layout might loo │ │ │ │ │ - 0x01149d90 6b206c69 6b653a0a 0a202020 20666f6f k like:.. foo │ │ │ │ │ - 0x01149da0 736e6170 6c65742f 0a202020 2020207c snaplet/. | │ │ │ │ │ - 0x01149db0 2d2d202a 64657665 6c2e6366 672a0a20 -- *devel.cfg*. │ │ │ │ │ - 0x01149dc0 20202020 207c2d2d 2064622e 6366670a |-- db.cfg. │ │ │ │ │ - 0x01149dd0 20202020 20207c2d 2d207075 626c6963 |-- public │ │ │ │ │ - 0x01149de0 2f0a2020 20202020 20202020 7c2d2d20 /. |-- │ │ │ │ │ - 0x01149df0 7374796c 65736865 6574732f 0a202020 stylesheets/. │ │ │ │ │ - 0x01149e00 20202020 2020207c 2d2d2069 6d616765 |-- image │ │ │ │ │ - 0x01149e10 732f0a20 20202020 20202020 207c2d2d s/. |-- │ │ │ │ │ - 0x01149e20 206a732f 0a202020 2020207c 2d2d202a js/. |-- * │ │ │ │ │ - 0x01149e30 736e6170 6c657473 2f2a0a20 20202020 snaplets/*. │ │ │ │ │ - 0x01149e40 20202020 207c2d2d 202a6865 6973742f |-- *heist/ │ │ │ │ │ - 0x01149e50 2a0a2020 20202020 20202020 20202020 *. │ │ │ │ │ - 0x01149e60 7c2d2d20 74656d70 6c617465 732f0a20 |-- templates/. │ │ │ │ │ - 0x01149e70 20202020 20202020 207c2d2d 20737562 |-- sub │ │ │ │ │ - 0x01149e80 736e6170 6c657431 2f0a2020 20202020 snaplet1/. │ │ │ │ │ - 0x01149e90 20202020 7c2d2d20 73756273 6e61706c |-- subsnapl │ │ │ │ │ - 0x01149ea0 6574322f 0a0a4f6e 6c792074 68652073 et2/..Only the s │ │ │ │ │ - 0x01149eb0 74617272 65642069 74656d73 20617265 tarred items are │ │ │ │ │ - 0x01149ec0 20616374 75616c6c 7920656e 666f7263 actually enforc │ │ │ │ │ - 0x01149ed0 65642062 79206375 7272656e 7420636f ed by current co │ │ │ │ │ - 0x01149ee0 64652c20 62757420 77652077 616e7420 de, but we want │ │ │ │ │ - 0x01149ef0 746f0a65 73746162 6c697368 20746865 to.establish the │ │ │ │ │ - 0x01149f00 206f7468 65727320 61732061 20636f6e others as a con │ │ │ │ │ - 0x01149f10 76656e74 696f6e2e 20205468 65206669 vention. The fi │ │ │ │ │ - 0x01149f20 6c652064 6576656c 2e636667 20697320 le devel.cfg is │ │ │ │ │ - 0x01149f30 6175746f 6d617469 63616c6c 790a7265 automatically.re │ │ │ │ │ - 0x01149f40 61642062 79207468 6520736e 61706c65 ad by the snaple │ │ │ │ │ - 0x01149f50 7420696e 66726173 74727563 74757265 t infrastructure │ │ │ │ │ - 0x01149f60 2e202049 74206973 20617661 696c6162 . It is availab │ │ │ │ │ - 0x01149f70 6c652074 6f20796f 75207669 61207468 le to you via th │ │ │ │ │ - 0x01149f80 650a6067 6574536e 61706c65 74557365 e.`getSnapletUse │ │ │ │ │ - 0x01149f90 72436f6e 66696760 2066756e 6374696f rConfig` functio │ │ │ │ │ - 0x01149fa0 6e2e2020 436f6e66 69672066 696c6573 n. Config files │ │ │ │ │ - 0x01149fb0 20757365 20746865 20666f72 6d617420 use the format │ │ │ │ │ - 0x01149fc0 64656669 6e656420 62792042 7279616e defined by Bryan │ │ │ │ │ - 0x01149fd0 0a4f2753 756c6c69 76616e27 73206578 .O'Sullivan's ex │ │ │ │ │ - 0x01149fe0 63656c6c 656e7420 5b636f6e 66696775 cellent [configu │ │ │ │ │ - 0x01149ff0 7261746f 720a7061 636b6167 655d2868 rator.package](h │ │ │ │ │ - 0x0114a000 7474703a 2f2f6861 636b6167 652e6861 ttp://hackage.ha │ │ │ │ │ - 0x0114a010 736b656c 6c2e6f72 672f7061 636b6167 skell.org/packag │ │ │ │ │ - 0x0114a020 652f636f 6e666967 75726174 6f72292e e/configurator). │ │ │ │ │ - 0x0114a030 2020496e 20746869 73206578 616d706c In this exampl │ │ │ │ │ - 0x0114a040 652c0a74 68652075 73657220 68617320 e,.the user has │ │ │ │ │ - 0x0114a050 63686f73 656e2074 6f207075 74206462 chosen to put db │ │ │ │ │ - 0x0114a060 20636f6e 66696720 6974656d 7320696e config items in │ │ │ │ │ - 0x0114a070 20612073 65706172 61746520 66696c65 a separate file │ │ │ │ │ - 0x0114a080 20616e64 20757365 0a636f6e 66696775 and use.configu │ │ │ │ │ - 0x0114a090 7261746f 72277320 696d706f 72742066 rator's import f │ │ │ │ │ - 0x0114a0a0 756e6374 696f6e61 6c697479 20746f20 unctionality to │ │ │ │ │ - 0x0114a0b0 696e636c 75646520 69742069 6e206465 include it in de │ │ │ │ │ - 0x0114a0c0 76656c2e 6366672e 20204966 0a666f6f vel.cfg. If.foo │ │ │ │ │ - 0x0114a0d0 736e6170 6c657420 75736573 20606e65 snaplet uses `ne │ │ │ │ │ - 0x0114a0e0 7374536e 61706c65 7460206f 72206065 stSnaplet` or `e │ │ │ │ │ - 0x0114a0f0 6d626564 536e6170 6c657460 20746f20 mbedSnaplet` to │ │ │ │ │ - 0x0114a100 696e636c 75646520 616e7920 6f746865 include any othe │ │ │ │ │ - 0x0114a110 7220736e 61706c65 74732c0a 7468656e r snaplets,.then │ │ │ │ │ - 0x0114a120 2066696c 65737973 74656d20 64617461 filesystem data │ │ │ │ │ - 0x0114a130 20646566 696e6564 20627920 74686f73 defined by thos │ │ │ │ │ - 0x0114a140 6520736e 61706c65 74732077 696c6c20 e snaplets will │ │ │ │ │ - 0x0114a150 62652069 6e636c75 64656420 696e0a73 be included in.s │ │ │ │ │ - 0x0114a160 75626469 72656374 6f726965 7320756e ubdirectories un │ │ │ │ │ - 0x0114a170 64657220 74686520 60736e61 706c6574 der the `snaplet │ │ │ │ │ - 0x0114a180 732f6020 64697265 63746f72 792e0a0a s/` directory... │ │ │ │ │ - 0x0114a190 536f2068 6f772064 6f20796f 75207465 So how do you te │ │ │ │ │ - 0x0114a1a0 6c6c2074 68652073 6e61706c 65742069 ll the snaplet i │ │ │ │ │ - 0x0114a1b0 6e667261 73747275 63747572 65207468 nfrastructure th │ │ │ │ │ - 0x0114a1c0 61742079 6f757220 736e6170 6c657420 at your snaplet │ │ │ │ │ - 0x0114a1d0 68617320 66696c65 73797374 656d0a64 has filesystem.d │ │ │ │ │ - 0x0114a1e0 61746120 74686174 2073686f 756c6420 ata that should │ │ │ │ │ - 0x0114a1f0 62652069 6e737461 6c6c6564 3f20204c be installed? L │ │ │ │ │ - 0x0114a200 6f6f6b20 61742074 68652064 6566696e ook at the defin │ │ │ │ │ - 0x0114a210 6974696f 6e206f66 20617070 496e6974 ition of appInit │ │ │ │ │ - 0x0114a220 2061626f 76652e20 20546865 0a746869 above. The.thi │ │ │ │ │ - 0x0114a230 72642061 7267756d 656e7420 746f2074 rd argument to t │ │ │ │ │ - 0x0114a240 6865206d 616b6553 6e61706c 65742066 he makeSnaplet f │ │ │ │ │ - 0x0114a250 756e6374 696f6e20 69732077 68657265 unction is where │ │ │ │ │ - 0x0114a260 20776520 73706563 69667920 74686520 we specify the │ │ │ │ │ - 0x0114a270 66696c65 73797374 656d0a64 69726563 filesystem.direc │ │ │ │ │ - 0x0114a280 746f7279 20746861 74207368 6f756c64 tory that should │ │ │ │ │ - 0x0114a290 20626520 696e7374 616c6c65 642e2020 be installed. │ │ │ │ │ - 0x0114a2a0 54686174 20617267 756d656e 74206861 That argument ha │ │ │ │ │ - 0x0114a2b0 73207468 65207479 70652060 4d617962 s the type `Mayb │ │ │ │ │ - 0x0114a2c0 65202849 4f0a4669 6c655061 74682960 e (IO.FilePath)` │ │ │ │ │ - 0x0114a2d0 2e202049 6e207468 69732063 61736520 . In this case │ │ │ │ │ - 0x0114a2e0 77652075 73656420 604e6f74 68696e67 we used `Nothing │ │ │ │ │ - 0x0114a2f0 60206265 63617573 65206f75 72207369 ` because our si │ │ │ │ │ - 0x0114a300 6d706c65 20657861 6d706c65 20646f65 mple example doe │ │ │ │ │ - 0x0114a310 736e2774 0a686176 6520616e 79206669 sn't.have any fi │ │ │ │ │ - 0x0114a320 6c657379 7374656d 20646174 612e2020 lesystem data. │ │ │ │ │ - 0x0114a330 41732061 6e206578 616d706c 652c206c As an example, l │ │ │ │ │ - 0x0114a340 65742773 20736179 20796f75 20617265 et's say you are │ │ │ │ │ - 0x0114a350 20637265 6174696e 67206120 736e6170 creating a snap │ │ │ │ │ - 0x0114a360 6c65740a 63616c6c 6564206b 696c6c65 let.called kille │ │ │ │ │ - 0x0114a370 72617070 20746861 74207769 6c6c2062 rapp that will b │ │ │ │ │ - 0x0114a380 65206469 73747269 62757465 64206173 e distributed as │ │ │ │ │ - 0x0114a390 20612068 61636b61 67652070 726f6a65 a hackage proje │ │ │ │ │ - 0x0114a3a0 63742063 616c6c65 640a736e 61706c65 ct called.snaple │ │ │ │ │ - 0x0114a3b0 742d6b69 6c6c6572 6170702e 2020596f t-killerapp. Yo │ │ │ │ │ - 0x0114a3c0 75722070 726f6a65 63742064 69726563 ur project direc │ │ │ │ │ - 0x0114a3d0 746f7279 20737472 75637475 72652077 tory structure w │ │ │ │ │ - 0x0114a3e0 696c6c20 6c6f6f6b 20736f6d 65746869 ill look somethi │ │ │ │ │ - 0x0114a3f0 6e67206c 696b650a 74686973 3a0a0a20 ng like.this:.. │ │ │ │ │ - 0x0114a400 20202073 6e61706c 65742d6b 696c6c65 snaplet-kille │ │ │ │ │ - 0x0114a410 72617070 2f0a2020 20202020 7c2d2d20 rapp/. |-- │ │ │ │ │ - 0x0114a420 7265736f 75726365 732f0a20 20202020 resources/. │ │ │ │ │ - 0x0114a430 207c2d2d 20736e61 706c6574 2d6b696c |-- snaplet-kil │ │ │ │ │ - 0x0114a440 6c657261 70702e63 6162616c 0a202020 lerapp.cabal. │ │ │ │ │ - 0x0114a450 2020207c 2d2d2073 72632f0a 0a416c6c |-- src/..All │ │ │ │ │ - 0x0114a460 206f6620 74686520 66696c65 7320616e of the files an │ │ │ │ │ - 0x0114a470 64206469 72656374 6f726965 73206c69 d directories li │ │ │ │ │ - 0x0114a480 73746564 2061626f 76652075 6e646572 sted above under │ │ │ │ │ - 0x0114a490 20666f6f 736e6170 6c65742f 2077696c foosnaplet/ wil │ │ │ │ │ - 0x0114a4a0 6c206265 20696e0a 7265736f 75726365 l be in.resource │ │ │ │ │ - 0x0114a4b0 732f2e20 20536f6d 65776865 72652069 s/. Somewhere i │ │ │ │ │ - 0x0114a4c0 6e207468 6520636f 64652079 6f752077 n the code you w │ │ │ │ │ - 0x0114a4d0 696c6c20 64656669 6e652061 6e20696e ill define an in │ │ │ │ │ - 0x0114a4e0 69746961 6c697a65 7220666f 72207468 itializer for th │ │ │ │ │ - 0x0114a4f0 650a736e 61706c65 74207468 61742077 e.snaplet that w │ │ │ │ │ - 0x0114a500 696c6c20 6c6f6f6b 206c696b 65207468 ill look like th │ │ │ │ │ - 0x0114a510 69733a0a 0a202020 206b696c 6c657249 is:.. killerI │ │ │ │ │ - 0x0114a520 6e697420 3d206d61 6b65536e 61706c65 nit = makeSnaple │ │ │ │ │ - 0x0114a530 7420226b 696c6c65 72617070 22202234 t "killerapp" "4 │ │ │ │ │ - 0x0114a540 32222028 4a757374 20646174 61446972 2" (Just dataDir │ │ │ │ │ - 0x0114a550 29202420 646f0a0a 54686520 7072696d ) $ do..The prim │ │ │ │ │ - 0x0114a560 61727920 66756e63 74696f6e 206f6620 ary function of │ │ │ │ │ - 0x0114a570 43616261 6c206973 20746f20 696e7374 Cabal is to inst │ │ │ │ │ - 0x0114a580 616c6c20 636f6465 2e202042 75742069 all code. But i │ │ │ │ │ - 0x0114a590 74206861 73207468 65206162 696c6974 t has the abilit │ │ │ │ │ - 0x0114a5a0 7920746f 0a696e73 74616c6c 20646174 y to.install dat │ │ │ │ │ - 0x0114a5b0 61206669 6c657320 616e6420 70726f76 a files and prov │ │ │ │ │ - 0x0114a5c0 69646573 20612066 756e6374 696f6e20 ides a function │ │ │ │ │ - 0x0114a5d0 63616c6c 65642060 67657444 61746144 called `getDataD │ │ │ │ │ - 0x0114a5e0 69726020 666f7220 72657472 69657669 ir` for retrievi │ │ │ │ │ - 0x0114a5f0 6e670a74 6865206c 6f636174 696f6e20 ng.the location │ │ │ │ │ - 0x0114a600 6f662074 68657365 2066696c 65732e20 of these files. │ │ │ │ │ - 0x0114a610 2053696e 63652069 74207265 7475726e Since it return │ │ │ │ │ - 0x0114a620 73206120 64696666 6572656e 74207265 s a different re │ │ │ │ │ - 0x0114a630 73756c74 20646570 656e6469 6e67206f sult depending o │ │ │ │ │ - 0x0114a640 6e0a7768 6174206d 61636869 6e652079 n.what machine y │ │ │ │ │ - 0x0114a650 6f752772 65207573 696e672c 20746865 ou're using, the │ │ │ │ │ - 0x0114a660 20746869 72642061 7267756d 656e7420 third argument │ │ │ │ │ - 0x0114a670 746f2060 6d616b65 536e6170 6c657460 to `makeSnaplet` │ │ │ │ │ - 0x0114a680 20686173 20746f20 62652060 4d617962 has to be `Mayb │ │ │ │ │ - 0x0114a690 650a2849 4f204669 6c655061 74682960 e.(IO FilePath)` │ │ │ │ │ - 0x0114a6a0 20696e73 74656164 206f6620 74686520 instead of the │ │ │ │ │ - 0x0114a6b0 6d6f7265 206e6174 7572616c 20707572 more natural pur │ │ │ │ │ - 0x0114a6c0 65207665 7273696f 6e2e2020 546f206d e version. To m │ │ │ │ │ - 0x0114a6d0 616b6520 7468696e 6773206d 6f72650a ake things more. │ │ │ │ │ - 0x0114a6e0 6f726761 6e697a65 642c2077 65207573 organized, we us │ │ │ │ │ - 0x0114a6f0 65207468 6520636f 6e76656e 74696f6e e the convention │ │ │ │ │ - 0x0114a700 206f6620 70757474 696e6720 616c6c20 of putting all │ │ │ │ │ - 0x0114a710 796f7572 20736e61 706c6574 27732064 your snaplet's d │ │ │ │ │ - 0x0114a720 61746120 66696c65 7320696e 20610a73 ata files in a.s │ │ │ │ │ - 0x0114a730 75626469 72656374 6f727920 63616c6c ubdirectory call │ │ │ │ │ - 0x0114a740 65642072 65736f75 72636573 2e202053 ed resources. S │ │ │ │ │ - 0x0114a750 6f207765 206e6565 6420746f 20637265 o we need to cre │ │ │ │ │ - 0x0114a760 61746520 6120736d 616c6c20 66756e63 ate a small func │ │ │ │ │ - 0x0114a770 74696f6e 20746861 740a6170 70656e64 tion that.append │ │ │ │ │ - 0x0114a780 7320602f 7265736f 75726365 73602074 s `/resources` t │ │ │ │ │ - 0x0114a790 6f207468 65207265 73756c74 206f6620 o the result of │ │ │ │ │ - 0x0114a7a0 60676574 44617461 44697260 2e0a0a20 `getDataDir`... │ │ │ │ │ - 0x0114a7b0 20202069 6d706f72 74205061 7468735f import Paths_ │ │ │ │ │ - 0x0114a7c0 736e6170 6c65745f 6b696c6c 65726170 snaplet_killerap │ │ │ │ │ - 0x0114a7d0 700a2020 20206461 74614469 72203d20 p. dataDir = │ │ │ │ │ - 0x0114a7e0 6c696674 4d20282b 2b222f72 65736f75 liftM (++"/resou │ │ │ │ │ - 0x0114a7f0 72636573 22292067 65744461 74614469 rces") getDataDi │ │ │ │ │ - 0x0114a800 720a0a49 66206f75 72207072 6f6a6563 r..If our projec │ │ │ │ │ - 0x0114a810 74206973 206e616d 65642073 6e61706c t is named snapl │ │ │ │ │ - 0x0114a820 65742d6b 696c6c65 72617070 2c207468 et-killerapp, th │ │ │ │ │ - 0x0114a830 65206067 65744461 74614469 72602066 e `getDataDir` f │ │ │ │ │ - 0x0114a840 756e6374 696f6e20 69730a64 6566696e unction is.defin │ │ │ │ │ - 0x0114a850 65642069 6e207468 65206d6f 64756c65 ed in the module │ │ │ │ │ - 0x0114a860 20506174 68735f73 6e61706c 65745f6b Paths_snaplet_k │ │ │ │ │ - 0x0114a870 696c6c65 72617070 2c207768 69636820 illerapp, which │ │ │ │ │ - 0x0114a880 77652068 61766520 746f2069 6d706f72 we have to impor │ │ │ │ │ - 0x0114a890 742e2020 546f0a6d 616b6520 65766572 t. To.make ever │ │ │ │ │ - 0x0114a8a0 79746869 6e672077 6f726b2c 20796f75 ything work, you │ │ │ │ │ - 0x0114a8b0 20686176 6520746f 2074656c 6c204361 have to tell Ca │ │ │ │ │ - 0x0114a8c0 62616c20 61626f75 7420796f 75722064 bal about your d │ │ │ │ │ - 0x0114a8d0 61746120 66696c65 73206279 0a696e63 ata files by.inc │ │ │ │ │ - 0x0114a8e0 6c756469 6e672061 20736563 74696f6e luding a section │ │ │ │ │ - 0x0114a8f0 206c696b 65207468 6520666f 6c6c6f77 like the follow │ │ │ │ │ - 0x0114a900 696e6720 696e2073 6e61706c 65742d6b ing in snaplet-k │ │ │ │ │ - 0x0114a910 696c6c65 72617070 2e636162 616c3a0a illerapp.cabal:. │ │ │ │ │ - 0x0114a920 0a202020 20646174 612d6669 6c65733a . data-files: │ │ │ │ │ - 0x0114a930 0a202020 20202072 65736f75 72636573 . resources │ │ │ │ │ - 0x0114a940 2f646576 656c2e63 66672c0a 20202020 /devel.cfg,. │ │ │ │ │ - 0x0114a950 20207265 736f7572 6365732f 7075626c resources/publ │ │ │ │ │ - 0x0114a960 69632f73 74796c65 73686565 74732f73 ic/stylesheets/s │ │ │ │ │ - 0x0114a970 74796c65 2e637373 2c0a2020 20202020 tyle.css,. │ │ │ │ │ - 0x0114a980 7265736f 75726365 732f736e 61706c65 resources/snaple │ │ │ │ │ - 0x0114a990 74732f68 65697374 2f74656d 706c6174 ts/heist/templat │ │ │ │ │ - 0x0114a9a0 65732f70 6167652e 74706c0a 0a4e6f77 es/page.tpl..Now │ │ │ │ │ - 0x0114a9b0 20776865 6e657665 7220796f 75722073 whenever your s │ │ │ │ │ - 0x0114a9c0 6e61706c 65742069 73207573 65642c20 naplet is used, │ │ │ │ │ - 0x0114a9d0 69747320 66696c65 73797374 656d2064 its filesystem d │ │ │ │ │ - 0x0114a9e0 61746120 77696c6c 20626520 6175746f ata will be auto │ │ │ │ │ - 0x0114a9f0 6d616769 63616c6c 790a636f 70696564 magically.copied │ │ │ │ │ - 0x0114aa00 20696e74 6f207468 65206c6f 63616c20 into the local │ │ │ │ │ - 0x0114aa10 70726f6a 65637420 74686174 20697320 project that is │ │ │ │ │ - 0x0114aa20 7573696e 67206974 2c207768 656e6576 using it, whenev │ │ │ │ │ - 0x0114aa30 65722074 68652061 70706c69 63617469 er the applicati │ │ │ │ │ - 0x0114aa40 6f6e2069 730a7275 6e20616e 64206974 on is.run and it │ │ │ │ │ - 0x0114aa50 20736565 73207468 61742074 68652073 sees that the s │ │ │ │ │ - 0x0114aa60 6e61706c 65742773 20646972 6563746f naplet's directo │ │ │ │ │ - 0x0114aa70 72792064 6f657320 6e6f7420 616c7265 ry does not alre │ │ │ │ │ - 0x0114aa80 61647920 65786973 742e2020 49662074 ady exist. If t │ │ │ │ │ - 0x0114aa90 68650a75 73657220 75706772 61646573 he.user upgrades │ │ │ │ │ - 0x0114aaa0 20746f20 61206e65 77207665 7273696f to a new versio │ │ │ │ │ - 0x0114aab0 6e206f66 20746865 20736e61 706c6574 n of the snaplet │ │ │ │ │ - 0x0114aac0 20616e64 20746865 206e6577 20766572 and the new ver │ │ │ │ │ - 0x0114aad0 73696f6e 206d6164 65206368 616e6765 sion made change │ │ │ │ │ - 0x0114aae0 730a746f 20746865 2066696c 65737973 s.to the filesys │ │ │ │ │ - 0x0114aaf0 74656d20 7265736f 75726365 732c2074 tem resources, t │ │ │ │ │ - 0x0114ab00 686f7365 20726573 6f757263 65732077 hose resources w │ │ │ │ │ - 0x0114ab10 696c6c20 4e4f5420 62652061 75746f6d ill NOT be autom │ │ │ │ │ - 0x0114ab20 61746963 616c6c79 20636f70 6965640a atically copied. │ │ │ │ │ - 0x0114ab30 696e2062 79206465 6661756c 742e2020 in by default. │ │ │ │ │ - 0x0114ab40 5265736f 75726365 20696e73 74616c6c Resource install │ │ │ │ │ - 0x0114ab50 6174696f 6e202a6f 6e6c792a 20686170 ation *only* hap │ │ │ │ │ - 0x0114ab60 70656e73 20776865 6e207468 65206073 pens when the `s │ │ │ │ │ - 0x0114ab70 6e61706c 6574732f 666f6f60 0a646972 naplets/foo`.dir │ │ │ │ │ - 0x0114ab80 6563746f 72792064 6f657320 6e6f7420 ectory does not │ │ │ │ │ - 0x0114ab90 65786973 742e2020 49662079 6f752077 exist. If you w │ │ │ │ │ - 0x0114aba0 616e7420 746f2067 65742074 6865206c ant to get the l │ │ │ │ │ - 0x0114abb0 61746573 74207665 7273696f 6e206f66 atest version of │ │ │ │ │ - 0x0114abc0 20746865 0a66696c 65737973 74656d20 the.filesystem │ │ │ │ │ - 0x0114abd0 7265736f 75726365 732c2072 656d6f76 resources, remov │ │ │ │ │ - 0x0114abe0 65207468 65206073 6e61706c 6574732f e the `snaplets/ │ │ │ │ │ - 0x0114abf0 666f6f60 20646972 6563746f 72792c20 foo` directory, │ │ │ │ │ - 0x0114ac00 616e6420 72657374 61727420 796f7572 and restart your │ │ │ │ │ - 0x0114ac10 0a617070 2e0a002e 2f737263 2f547574 .app..../src/Tut │ │ │ │ │ - 0x0114ac20 6f726961 6c2e6c68 73004e61 6d653a20 orial.lhs.Name: │ │ │ │ │ + 0x01146760 6b737461 72746572 00576861 74204172 kstarter.What Ar │ │ │ │ │ + 0x01146770 6520536e 61706c65 74733f0a 3d3d3d3d e Snaplets?.==== │ │ │ │ │ + 0x01146780 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d0a0a ==============.. │ │ │ │ │ + 0x01146790 4120736e 61706c65 74206973 20612063 A snaplet is a c │ │ │ │ │ + 0x011467a0 6f6d706f 7361626c 65207765 62206170 omposable web ap │ │ │ │ │ + 0x011467b0 706c6963 6174696f 6e2e2020 536e6170 plication. Snap │ │ │ │ │ + 0x011467c0 6c657473 20616c6c 6f772079 6f752074 lets allow you t │ │ │ │ │ + 0x011467d0 6f206275 696c640a 73656c66 2d636f6e o build.self-con │ │ │ │ │ + 0x011467e0 7461696e 65642070 69656365 73206f66 tained pieces of │ │ │ │ │ + 0x011467f0 2066756e 6374696f 6e616c69 74792061 functionality a │ │ │ │ │ + 0x01146800 6e642067 6c756520 7468656d 20746f67 nd glue them tog │ │ │ │ │ + 0x01146810 65746865 7220746f 206d616b 65206c61 ether to make la │ │ │ │ │ + 0x01146820 72676572 0a617070 6c696361 74696f6e rger.application │ │ │ │ │ + 0x01146830 732e2020 48657265 20617265 20736f6d s. Here are som │ │ │ │ │ + 0x01146840 65206f66 20746865 20746869 6e677320 e of the things │ │ │ │ │ + 0x01146850 70726f76 69646564 20627920 74686520 provided by the │ │ │ │ │ + 0x01146860 736e6170 6c657420 4150493a 0a0a2020 snaplet API:.. │ │ │ │ │ + 0x01146870 2d20496e 66726173 74727563 74757265 - Infrastructure │ │ │ │ │ + 0x01146880 20666f72 20617070 6c696361 74696f6e for application │ │ │ │ │ + 0x01146890 20737461 74652f65 6e766972 6f6e6d65 state/environme │ │ │ │ │ + 0x011468a0 6e740a0a 20202d20 536e6170 6c657420 nt.. - Snaplet │ │ │ │ │ + 0x011468b0 696e6974 69616c69 7a617469 6f6e2c20 initialization, │ │ │ │ │ + 0x011468c0 72656c6f 61642c20 616e6420 636c6561 reload, and clea │ │ │ │ │ + 0x011468d0 6e75700a 0a20202d 204d616e 6167656d nup.. - Managem │ │ │ │ │ + 0x011468e0 656e7420 6f662066 696c6573 79737465 ent of filesyste │ │ │ │ │ + 0x011468f0 6d206461 74612061 6e642061 75746f6d m data and autom │ │ │ │ │ + 0x01146900 61746963 20736e61 706c6574 20696e73 atic snaplet ins │ │ │ │ │ + 0x01146910 74616c6c 6174696f 6e0a0a20 202d2055 tallation.. - U │ │ │ │ │ + 0x01146920 6e696669 65642063 6f6e6669 67206669 nified config fi │ │ │ │ │ + 0x01146930 6c652069 6e667261 73747275 63747572 le infrastructur │ │ │ │ │ + 0x01146940 650a0a4f 6e652065 78616d70 6c65206d e..One example m │ │ │ │ │ + 0x01146950 69676874 20626520 61207769 6b692073 ight be a wiki s │ │ │ │ │ + 0x01146960 6e61706c 65742e20 20497420 776f756c naplet. It woul │ │ │ │ │ + 0x01146970 64206265 20646973 74726962 75746564 d be distributed │ │ │ │ │ + 0x01146980 20617320 61206861 736b656c 6c0a7061 as a haskell.pa │ │ │ │ │ + 0x01146990 636b6167 65207468 61742077 6f756c64 ckage that would │ │ │ │ │ + 0x011469a0 20626520 696e7374 616c6c65 64207769 be installed wi │ │ │ │ │ + 0x011469b0 74682063 6162616c 20616e64 20776f75 th cabal and wou │ │ │ │ │ + 0x011469c0 6c642070 726f6261 626c7920 696e636c ld probably incl │ │ │ │ │ + 0x011469d0 75646520 636f6465 2c0a636f 6e666967 ude code,.config │ │ │ │ │ + 0x011469e0 2066696c 65732c20 48544d4c 2074656d files, HTML tem │ │ │ │ │ + 0x011469f0 706c6174 65732c20 7374796c 65736865 plates, styleshe │ │ │ │ │ + 0x01146a00 6574732c 204a6176 61536372 6970742c ets, JavaScript, │ │ │ │ │ + 0x01146a10 20696d61 6765732c 20657463 2e202054 images, etc. T │ │ │ │ │ + 0x01146a20 68650a73 6e61706c 65742773 20636f64 he.snaplet's cod │ │ │ │ │ + 0x01146a30 6520776f 756c6420 70726f76 69646520 e would provide │ │ │ │ │ + 0x01146a40 74686520 6e656365 73736172 79204150 the necessary AP │ │ │ │ │ + 0x01146a50 4920746f 206c6574 20796f75 72206170 I to let your ap │ │ │ │ │ + 0x01146a60 706c6963 6174696f 6e0a696e 74657261 plication.intera │ │ │ │ │ + 0x01146a70 63742073 65616d6c 6573736c 79207769 ct seamlessly wi │ │ │ │ │ + 0x01146a80 74682074 68652077 696b6920 66756e63 th the wiki func │ │ │ │ │ + 0x01146a90 74696f6e 616c6974 792e2020 5768656e tionality. When │ │ │ │ │ + 0x01146aa0 20796f75 2072756e 20796f75 720a6170 you run your.ap │ │ │ │ │ + 0x01146ab0 706c6963 6174696f 6e20666f 72207468 plication for th │ │ │ │ │ + 0x01146ac0 65206669 72737420 74696d65 2c20616c e first time, al │ │ │ │ │ + 0x01146ad0 6c206f66 20746865 2077696b 6920736e l of the wiki sn │ │ │ │ │ + 0x01146ae0 61706c65 74277320 66696c65 73797374 aplet's filesyst │ │ │ │ │ + 0x01146af0 656d2072 65736f75 72636573 0a77696c em resources.wil │ │ │ │ │ + 0x01146b00 6c206175 746f6d61 74696361 6c6c7920 l automatically │ │ │ │ │ + 0x01146b10 62652063 6f706965 6420696e 746f2074 be copied into t │ │ │ │ │ + 0x01146b20 68652061 7070726f 70726961 74652070 he appropriate p │ │ │ │ │ + 0x01146b30 6c616365 732e2020 5468656e 20796f75 laces. Then you │ │ │ │ │ + 0x01146b40 2077696c 6c0a696d 6d656469 6174656c will.immediatel │ │ │ │ │ + 0x01146b50 79206265 2061626c 6520746f 20637573 y be able to cus │ │ │ │ │ + 0x01146b60 746f6d69 7a652074 68652077 696b6920 tomize the wiki │ │ │ │ │ + 0x01146b70 746f2066 69742079 6f757220 6e656564 to fit your need │ │ │ │ │ + 0x01146b80 73206279 20656469 74696e67 20636f6e s by editing con │ │ │ │ │ + 0x01146b90 6669670a 66696c65 732c2070 726f7669 fig.files, provi │ │ │ │ │ + 0x01146ba0 64696e67 20796f75 72206f77 6e207374 ding your own st │ │ │ │ │ + 0x01146bb0 796c6573 68656574 732c2065 74632e20 ylesheets, etc. │ │ │ │ │ + 0x01146bc0 20576520 77696c6c 20646973 63757373 We will discuss │ │ │ │ │ + 0x01146bd0 20746869 7320696e 206d6f72 650a6465 this in more.de │ │ │ │ │ + 0x01146be0 7461696c 206c6174 65722e0a 0a412073 tail later...A s │ │ │ │ │ + 0x01146bf0 6e61706c 65742063 616e2072 65707265 naplet can repre │ │ │ │ │ + 0x01146c00 73656e74 20616e79 7468696e 67206672 sent anything fr │ │ │ │ │ + 0x01146c10 6f6d2062 61636b65 6e642048 61736b65 om backend Haske │ │ │ │ │ + 0x01146c20 6c6c2069 6e667261 73747275 63747572 ll infrastructur │ │ │ │ │ + 0x01146c30 65207769 7468206e 6f0a7573 65722066 e with no.user f │ │ │ │ │ + 0x01146c40 6163696e 67206675 6e637469 6f6e616c acing functional │ │ │ │ │ + 0x01146c50 69747920 746f2061 20736d61 6c6c2077 ity to a small w │ │ │ │ │ + 0x01146c60 69646765 74206c69 6b652061 20636861 idget like a cha │ │ │ │ │ + 0x01146c70 7420626f 78207468 61742067 6f657320 t box that goes │ │ │ │ │ + 0x01146c80 696e2074 68650a63 6f726e65 72206f66 in the.corner of │ │ │ │ │ + 0x01146c90 20612077 65622070 61676520 746f2061 a web page to a │ │ │ │ │ + 0x01146ca0 6e20656e 74697265 20737461 6e64616c n entire standal │ │ │ │ │ + 0x01146cb0 6f6e6520 77656273 69746520 6c696b65 one website like │ │ │ │ │ + 0x01146cc0 20612062 6c6f6720 6f722066 6f72756d a blog or forum │ │ │ │ │ + 0x01146cd0 2e0a5468 6520706f 73736962 696c6974 ..The possibilit │ │ │ │ │ + 0x01146ce0 69657320 61726520 656e646c 6573732e ies are endless. │ │ │ │ │ + 0x01146cf0 20204120 736e6170 6c657420 69732061 A snaplet is a │ │ │ │ │ + 0x01146d00 20776562 20617070 6c696361 74696f6e web application │ │ │ │ │ + 0x01146d10 2c20616e 64207765 620a6170 706c6963 , and web.applic │ │ │ │ │ + 0x01146d20 6174696f 6e732061 72652073 6e61706c ations are snapl │ │ │ │ │ + 0x01146d30 6574732e 20205468 6973206d 65616e73 ets. This means │ │ │ │ │ + 0x01146d40 20746861 74207573 696e6720 736e6170 that using snap │ │ │ │ │ + 0x01146d50 6c657473 20616e64 20777269 74696e67 lets and writing │ │ │ │ │ + 0x01146d60 0a736e61 706c6574 73206172 6520616c .snaplets are al │ │ │ │ │ + 0x01146d70 6d6f7374 20746865 2073616d 65207468 most the same th │ │ │ │ │ + 0x01146d80 696e672c 20616e64 20697427 73207472 ing, and it's tr │ │ │ │ │ + 0x01146d90 69766961 6c20746f 2064726f 70206120 ivial to drop a │ │ │ │ │ + 0x01146da0 77686f6c 65207765 62736974 650a696e whole website.in │ │ │ │ │ + 0x01146db0 746f2061 6e6f7468 6572206f 6e652e0a to another one.. │ │ │ │ │ + 0x01146dc0 0a576527 72652072 65616c6c 79206578 .We're really ex │ │ │ │ │ + 0x01146dd0 63697465 64206162 6f757420 74686520 cited about the │ │ │ │ │ + 0x01146de0 706f7373 6962696c 69746965 73206176 possibilities av │ │ │ │ │ + 0x01146df0 61696c61 626c6520 77697468 20736e61 ailable with sna │ │ │ │ │ + 0x01146e00 706c6574 732e2020 496e0a66 6163742c plets. In.fact, │ │ │ │ │ + 0x01146e10 20536e61 7020616c 72656164 79207368 Snap already sh │ │ │ │ │ + 0x01146e20 69707320 77697468 20736e61 706c6574 ips with snaplet │ │ │ │ │ + 0x01146e30 7320666f 72207365 7373696f 6e732c20 s for sessions, │ │ │ │ │ + 0x01146e40 61757468 656e7469 63617469 6f6e2c20 authentication, │ │ │ │ │ + 0x01146e50 616e640a 74656d70 6c617469 6e672028 and.templating ( │ │ │ │ │ + 0x01146e60 77697468 20486569 7374292c 20205468 with Heist), Th │ │ │ │ │ + 0x01146e70 69732067 69766573 20796f75 20757365 is gives you use │ │ │ │ │ + 0x01146e80 66756c20 66756e63 74696f6e 616c6974 ful functionalit │ │ │ │ │ + 0x01146e90 79206f75 74206f66 20746865 20626f78 y out of the box │ │ │ │ │ + 0x01146ea0 2c0a616e 64206a75 6d702073 74617274 ,.and jump start │ │ │ │ │ + 0x01146eb0 7320796f 7572206f 776e2073 6e61706c s your own snapl │ │ │ │ │ + 0x01146ec0 65742064 6576656c 6f706d65 6e742062 et development b │ │ │ │ │ + 0x01146ed0 79206465 6d6f6e73 74726174 696e6720 y demonstrating │ │ │ │ │ + 0x01146ee0 736f6d65 20757365 66756c0a 64657369 some useful.desi │ │ │ │ │ + 0x01146ef0 676e2070 61747465 726e732e 2020536f gn patterns. So │ │ │ │ │ + 0x01146f00 20776974 686f7574 20667572 74686572 without further │ │ │ │ │ + 0x01146f10 2061646f 2c206c65 74277320 67657420 ado, let's get │ │ │ │ │ + 0x01146f20 73746172 7465642e 0a0a536e 61706c65 started...Snaple │ │ │ │ │ + 0x01146f30 74204f76 65727669 65770a3d 3d3d3d3d t Overview.===== │ │ │ │ │ + 0x01146f40 3d3d3d3d 3d3d3d3d 3d3d3d0a 0a546865 ===========..The │ │ │ │ │ + 0x01146f50 20686561 7274206f 66207468 6520736e heart of the sn │ │ │ │ │ + 0x01146f60 61706c65 74732069 6e667261 73747275 aplets infrastru │ │ │ │ │ + 0x01146f70 63747572 65206973 20737461 7465206d cture is state m │ │ │ │ │ + 0x01146f80 616e6167 656d656e 742e2020 4d6f7374 anagement. Most │ │ │ │ │ + 0x01146f90 206e6f6e 74726976 69616c0a 70696563 nontrivial.piec │ │ │ │ │ + 0x01146fa0 6573206f 66206120 77656220 61707020 es of a web app │ │ │ │ │ + 0x01146fb0 6e656564 20736f6d 65206b69 6e64206f need some kind o │ │ │ │ │ + 0x01146fc0 66207374 61746520 6f722065 6e766972 f state or envir │ │ │ │ │ + 0x01146fd0 6f6e6d65 6e742064 6174612e 2020436f onment data. Co │ │ │ │ │ + 0x01146fe0 6d706f6e 656e7473 0a746861 7420646f mponents.that do │ │ │ │ │ + 0x01146ff0 206e6f74 206e6565 6420616e 79206b69 not need any ki │ │ │ │ │ + 0x01147000 6e64206f 66207374 61746520 6f722065 nd of state or e │ │ │ │ │ + 0x01147010 6e766972 6f6e6d65 6e742061 72652070 nvironment are p │ │ │ │ │ + 0x01147020 726f6261 626c7920 6d6f7265 0a617070 robably more.app │ │ │ │ │ + 0x01147030 726f7072 69617465 20617320 61207374 ropriate as a st │ │ │ │ │ + 0x01147040 616e6461 6c6f6e65 206c6962 72617279 andalone library │ │ │ │ │ + 0x01147050 20746861 6e206173 20612073 6e61706c than as a snapl │ │ │ │ │ + 0x01147060 65742e0a 0a426566 6f726520 77652063 et...Before we c │ │ │ │ │ + 0x01147070 6f6e7469 6e75652c 20776520 6d757374 ontinue, we must │ │ │ │ │ + 0x01147080 20636c61 72696679 20616e20 696d706f clarify an impo │ │ │ │ │ + 0x01147090 7274616e 7420706f 696e742e 20205468 rtant point. Th │ │ │ │ │ + 0x011470a0 6520536e 61702077 65622073 65727665 e Snap web serve │ │ │ │ │ + 0x011470b0 720a7072 6f636573 73657320 65616368 r.processes each │ │ │ │ │ + 0x011470c0 20726571 75657374 20696e20 69747320 request in its │ │ │ │ │ + 0x011470d0 6f776e20 67726565 6e207468 72656164 own green thread │ │ │ │ │ + 0x011470e0 2e202054 68697320 6d65616e 73207468 . This means th │ │ │ │ │ + 0x011470f0 61742065 61636820 72657175 6573740a at each request. │ │ │ │ │ + 0x01147100 77696c6c 20726563 65697665 20612073 will receive a s │ │ │ │ │ + 0x01147110 65706172 61746520 636f7079 206f6620 eparate copy of │ │ │ │ │ + 0x01147120 74686520 73746174 65206465 66696e65 the state define │ │ │ │ │ + 0x01147130 64206279 20796f75 72206170 706c6963 d by your applic │ │ │ │ │ + 0x01147140 6174696f 6e20616e 640a736e 61706c65 ation and.snaple │ │ │ │ │ + 0x01147150 74732c20 616e6420 6d6f6469 66696361 ts, and modifica │ │ │ │ │ + 0x01147160 74696f6e 7320746f 20746861 74207374 tions to that st │ │ │ │ │ + 0x01147170 61746520 6f6e6c79 20616666 65637420 ate only affect │ │ │ │ │ + 0x01147180 74686520 6c6f6361 6c207468 72656164 the local thread │ │ │ │ │ + 0x01147190 20746861 740a6765 6e657261 74657320 that.generates │ │ │ │ │ + 0x011471a0 61207369 6e676c65 20726573 706f6e73 a single respons │ │ │ │ │ + 0x011471b0 652e2020 46726f6d 206e6f77 206f6e2c e. From now on, │ │ │ │ │ + 0x011471c0 20776865 6e207765 2074616c 6b206162 when we talk ab │ │ │ │ │ + 0x011471d0 6f757420 73746174 65207468 69732069 out state this i │ │ │ │ │ + 0x011471e0 730a7768 61742077 65206172 65207461 s.what we are ta │ │ │ │ │ + 0x011471f0 6c6b696e 67206162 6f75742e 20204966 lking about. If │ │ │ │ │ + 0x01147200 20796f75 206e6565 6420676c 6f62616c you need global │ │ │ │ │ + 0x01147210 20617070 6c696361 74696f6e 20737461 application sta │ │ │ │ │ + 0x01147220 74652c20 796f7520 68617665 20746f0a te, you have to. │ │ │ │ │ + 0x01147230 75736520 61207468 72656164 2d736166 use a thread-saf │ │ │ │ │ + 0x01147240 6520636f 6e737472 75637420 73756368 e construct such │ │ │ │ │ + 0x01147250 20617320 616e204d 56617220 6f722049 as an MVar or I │ │ │ │ │ + 0x01147260 4f526566 2e0a0a54 68697320 706f7374 ORef...This post │ │ │ │ │ + 0x01147270 20697320 77726974 74656e20 696e206c is written in l │ │ │ │ │ + 0x01147280 69746572 61746520 4861736b 656c6c2e iterate Haskell. │ │ │ │ │ + 0x01147290 20204974 20757365 73206120 736d616c It uses a smal │ │ │ │ │ + 0x011472a0 6c206578 7465726e 616c206d 6f64756c l external modul │ │ │ │ │ + 0x011472b0 650a6361 6c6c6564 20506172 74322074 e.called Part2 t │ │ │ │ │ + 0x011472c0 68617420 6973205b 61766169 6c61626c hat is [availabl │ │ │ │ │ + 0x011472d0 650a6865 72655d28 68747470 733a2f2f e.here](https:// │ │ │ │ │ + 0x011472e0 67697468 75622e63 6f6d2f73 6e617066 github.com/snapf │ │ │ │ │ + 0x011472f0 72616d65 776f726b 2f736e61 702d7465 ramework/snap-te │ │ │ │ │ + 0x01147300 6d706c61 7465732f 626c6f62 2f6d6173 mplates/blob/mas │ │ │ │ │ + 0x01147310 7465722f 70726f6a 6563745f 74656d70 ter/project_temp │ │ │ │ │ + 0x01147320 6c617465 2f747574 6f726961 6c2f7372 late/tutorial/sr │ │ │ │ │ + 0x01147330 632f5061 7274322e 6c687329 2e0a596f c/Part2.lhs)..Yo │ │ │ │ │ + 0x01147340 75206361 6e20616c 736f2069 6e737461 u can also insta │ │ │ │ │ + 0x01147350 6c6c2074 68652066 756c6c20 636f6465 ll the full code │ │ │ │ │ + 0x01147360 20696e20 74686520 63757272 656e7420 in the current │ │ │ │ │ + 0x01147370 64697265 63746f72 79207769 74682074 directory with t │ │ │ │ │ + 0x01147380 68652063 6f6d6d61 6e640a60 736e6170 he command.`snap │ │ │ │ │ + 0x01147390 20696e69 74207475 746f7269 616c602e init tutorial`. │ │ │ │ │ + 0x011473a0 20204669 72737420 7765206e 65656420 First we need │ │ │ │ │ + 0x011473b0 746f2067 65742069 6d706f72 7473206f to get imports o │ │ │ │ │ + 0x011473c0 7574206f 66207468 65207761 792e0a0a ut of the way... │ │ │ │ │ + 0x011473d0 3e207b2d 23204c41 4e475541 47452054 > {-# LANGUAGE T │ │ │ │ │ + 0x011473e0 656d706c 61746548 61736b65 6c6c2023 emplateHaskell # │ │ │ │ │ + 0x011473f0 2d7d0a3e 207b2d23 204c414e 47554147 -}.> {-# LANGUAG │ │ │ │ │ + 0x01147400 45204f76 65726c6f 61646564 53747269 E OverloadedStri │ │ │ │ │ + 0x01147410 6e677320 232d7d0a 3e0a3e20 6d6f6475 ngs #-}.>.> modu │ │ │ │ │ + 0x01147420 6c65204d 61696e20 77686572 650a3e0a le Main where.>. │ │ │ │ │ + 0x01147430 3e20696d 706f7274 20202020 20202020 > import │ │ │ │ │ + 0x01147440 20202043 6f6e7472 6f6c2e41 70706c69 Control.Appli │ │ │ │ │ + 0x01147450 63617469 76652028 283c7c3e 29290a3e cative ((<|>)).> │ │ │ │ │ + 0x01147460 20696d70 6f727420 20202020 20202020 import │ │ │ │ │ + 0x01147470 2020436f 6e74726f 6c2e4c65 6e732e54 Control.Lens.T │ │ │ │ │ + 0x01147480 480a3e20 696d706f 72742020 20202020 H.> import │ │ │ │ │ + 0x01147490 20202020 20436f6e 74726f6c 2e4d6f6e Control.Mon │ │ │ │ │ + 0x011474a0 61642e49 4f2e436c 61737320 286c6966 ad.IO.Class (lif │ │ │ │ │ + 0x011474b0 74494f29 0a3e2069 6d706f72 74202020 tIO).> import │ │ │ │ │ + 0x011474c0 20202020 20202020 436f6e74 726f6c2e Control. │ │ │ │ │ + 0x011474d0 4d6f6e61 642e5374 6174652e 436c6173 Monad.State.Clas │ │ │ │ │ + 0x011474e0 73202867 65747329 0a3e2069 6d706f72 s (gets).> impor │ │ │ │ │ + 0x011474f0 74202020 20202020 20202020 44617461 t Data │ │ │ │ │ + 0x01147500 2e494f52 65660a3e 20696d70 6f727420 .IORef.> import │ │ │ │ │ + 0x01147510 7175616c 69666965 64204461 74612e42 qualified Data.B │ │ │ │ │ + 0x01147520 79746553 7472696e 672e4368 61723820 yteString.Char8 │ │ │ │ │ + 0x01147530 61732042 0a3e2069 6d706f72 74202020 as B.> import │ │ │ │ │ + 0x01147540 20202020 20202020 44617461 2e4d6179 Data.May │ │ │ │ │ + 0x01147550 62650a3e 20696d70 6f727420 20202020 be.> import │ │ │ │ │ + 0x01147560 20202020 2020536e 61700a3e 20696d70 Snap.> imp │ │ │ │ │ + 0x01147570 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ │ + 0x01147580 61702e53 6e61706c 65742e48 65697374 ap.Snaplet.Heist │ │ │ │ │ + 0x01147590 0a3e2069 6d706f72 74202020 20202020 .> import │ │ │ │ │ + 0x011475a0 20202020 50617274 320a0a57 65207374 Part2..We st │ │ │ │ │ + 0x011475b0 61727420 6f757220 6170706c 69636174 art our applicat │ │ │ │ │ + 0x011475c0 696f6e20 62792064 6566696e 696e6720 ion by defining │ │ │ │ │ + 0x011475d0 61206461 74612073 74727563 74757265 a data structure │ │ │ │ │ + 0x011475e0 20746f20 686f6c64 20746865 20737461 to hold the sta │ │ │ │ │ + 0x011475f0 74652e20 20546869 730a6461 74612073 te. This.data s │ │ │ │ │ + 0x01147600 74727563 74757265 20696e63 6c756465 tructure include │ │ │ │ │ + 0x01147610 73207468 65207374 61746520 6f662061 s the state of a │ │ │ │ │ + 0x01147620 6c6c2073 6e61706c 65747320 28777261 ll snaplets (wra │ │ │ │ │ + 0x01147630 70706564 20696e20 6120536e 61706c65 pped in a Snaple │ │ │ │ │ + 0x01147640 74292075 7365640a 6279206f 75722061 t) used.by our a │ │ │ │ │ + 0x01147650 70706c69 63617469 6f6e2061 73207765 pplication as we │ │ │ │ │ + 0x01147660 6c6c2061 7320616e 79206f74 68657220 ll as any other │ │ │ │ │ + 0x01147670 73746174 65207765 206d6967 68742077 state we might w │ │ │ │ │ + 0x01147680 616e742e 0a0a3e20 64617461 20417070 ant...> data App │ │ │ │ │ + 0x01147690 203d2041 70700a3e 20202020 207b205f = App.> { _ │ │ │ │ │ + 0x011476a0 68656973 74202020 20202020 3a3a2053 heist :: S │ │ │ │ │ + 0x011476b0 6e61706c 65742028 48656973 74204170 naplet (Heist Ap │ │ │ │ │ + 0x011476c0 70290a3e 20202020 202c205f 666f6f20 p).> , _foo │ │ │ │ │ + 0x011476d0 20202020 20202020 3a3a2053 6e61706c :: Snapl │ │ │ │ │ + 0x011476e0 65742046 6f6f0a3e 20202020 202c205f et Foo.> , _ │ │ │ │ │ + 0x011476f0 62617220 20202020 20202020 3a3a2053 bar :: S │ │ │ │ │ + 0x01147700 6e61706c 65742042 61720a3e 20202020 naplet Bar.> │ │ │ │ │ + 0x01147710 202c205f 636f6d70 616e794e 616d6520 , _companyName │ │ │ │ │ + 0x01147720 3a3a2049 4f526566 20422e42 79746553 :: IORef B.ByteS │ │ │ │ │ + 0x01147730 7472696e 670a3e20 20202020 7d0a3e0a tring.> }.>. │ │ │ │ │ + 0x01147740 3e206d61 6b654c65 6e736573 20272741 > makeLenses ''A │ │ │ │ │ + 0x01147750 70700a0a 54686520 6669656c 64206e61 pp..The field na │ │ │ │ │ + 0x01147760 6d657320 62656769 6e207769 74682061 mes begin with a │ │ │ │ │ + 0x01147770 6e20756e 64657273 636f7265 20626563 n underscore bec │ │ │ │ │ + 0x01147780 61757365 206f6620 736f6d65 206d6f72 ause of some mor │ │ │ │ │ + 0x01147790 6520636f 6d706c69 63617465 640a7468 e complicated.th │ │ │ │ │ + 0x011477a0 696e6773 20676f69 6e67206f 6e20756e ings going on un │ │ │ │ │ + 0x011477b0 64657220 74686520 686f6f64 2e202048 der the hood. H │ │ │ │ │ + 0x011477c0 6f776576 65722c20 616c6c20 796f7520 owever, all you │ │ │ │ │ + 0x011477d0 6e656564 20746f20 6b6e6f77 20726967 need to know rig │ │ │ │ │ + 0x011477e0 6874206e 6f772069 730a7468 61742079 ht now is.that y │ │ │ │ │ + 0x011477f0 6f752073 686f756c 64207072 65666978 ou should prefix │ │ │ │ │ + 0x01147800 20746869 6e677320 77697468 20616e20 things with an │ │ │ │ │ + 0x01147810 756e6465 7273636f 72652061 6e642074 underscore and t │ │ │ │ │ + 0x01147820 68656e20 63616c6c 20606d61 6b654c65 hen call `makeLe │ │ │ │ │ + 0x01147830 6e736573 602e0a54 68697320 6c657473 nses`..This lets │ │ │ │ │ + 0x01147840 20796f75 20757365 20746865 206e616d you use the nam │ │ │ │ │ + 0x01147850 65732077 6974686f 75742061 6e20756e es without an un │ │ │ │ │ + 0x01147860 64657273 636f7265 20696e20 74686520 derscore in the │ │ │ │ │ + 0x01147870 72657374 206f6620 796f7572 0a617070 rest of your.app │ │ │ │ │ + 0x01147880 6c696361 74696f6e 2e0a0a54 6865206e lication...The n │ │ │ │ │ + 0x01147890 65787420 7468696e 67207765 206e6565 ext thing we nee │ │ │ │ │ + 0x011478a0 6420746f 20646f20 69732064 6566696e d to do is defin │ │ │ │ │ + 0x011478b0 6520616e 20696e69 7469616c 697a6572 e an initializer │ │ │ │ │ + 0x011478c0 2e0a0a3e 20617070 496e6974 203a3a20 ...> appInit :: │ │ │ │ │ + 0x011478d0 536e6170 6c657449 6e697420 41707020 SnapletInit App │ │ │ │ │ + 0x011478e0 4170700a 3e206170 70496e69 74203d20 App.> appInit = │ │ │ │ │ + 0x011478f0 6d616b65 536e6170 6c657420 226d7961 makeSnaplet "mya │ │ │ │ │ + 0x01147900 70702220 224d7920 6578616d 706c6520 pp" "My example │ │ │ │ │ + 0x01147910 6170706c 69636174 696f6e22 204e6f74 application" Not │ │ │ │ │ + 0x01147920 68696e67 20242064 6f0a3e20 20202020 hing $ do.> │ │ │ │ │ + 0x01147930 6873203c 2d206e65 7374536e 61706c65 hs <- nestSnaple │ │ │ │ │ + 0x01147940 74202268 65697374 22206865 69737420 t "heist" heist │ │ │ │ │ + 0x01147950 24206865 69737449 6e697420 2274656d $ heistInit "tem │ │ │ │ │ + 0x01147960 706c6174 6573220a 3e202020 20206673 plates".> fs │ │ │ │ │ + 0x01147970 203c2d20 6e657374 536e6170 6c657420 <- nestSnaplet │ │ │ │ │ + 0x01147980 22666f6f 2220666f 6f202420 666f6f49 "foo" foo $ fooI │ │ │ │ │ + 0x01147990 6e69740a 3e202020 20206273 203c2d20 nit.> bs <- │ │ │ │ │ + 0x011479a0 6e657374 536e6170 6c657420 22222062 nestSnaplet "" b │ │ │ │ │ + 0x011479b0 61722024 206e616d 65536e61 706c6574 ar $ nameSnaplet │ │ │ │ │ + 0x011479c0 20226e65 776e616d 65222024 20626172 "newname" $ bar │ │ │ │ │ + 0x011479d0 496e6974 20666f6f 0a3e2020 20202061 Init foo.> a │ │ │ │ │ + 0x011479e0 6464526f 75746573 205b2028 2268656c ddRoutes [ ("hel │ │ │ │ │ + 0x011479f0 6c6f222c 20777269 74655465 78742022 lo", writeText " │ │ │ │ │ + 0x01147a00 68656c6c 6f20776f 726c6422 290a3e20 hello world").> │ │ │ │ │ + 0x01147a10 20202020 20202020 20202020 20202c20 , │ │ │ │ │ + 0x01147a20 2822666f 6f6e616d 65222c20 77697468 ("fooname", with │ │ │ │ │ + 0x01147a30 20666f6f 206e616d 65506167 65290a3e foo namePage).> │ │ │ │ │ + 0x01147a40 20202020 20202020 20202020 2020202c , │ │ │ │ │ + 0x01147a50 20282262 61726e61 6d65222c 20776974 ("barname", wit │ │ │ │ │ + 0x01147a60 68206261 72206e61 6d655061 6765290a h bar namePage). │ │ │ │ │ + 0x01147a70 3e202020 20202020 20202020 20202020 > │ │ │ │ │ + 0x01147a80 2c202822 636f6d70 616e7922 2c20636f , ("company", co │ │ │ │ │ + 0x01147a90 6d70616e 7948616e 646c6572 290a3e20 mpanyHandler).> │ │ │ │ │ + 0x01147aa0 20202020 20202020 20202020 20205d0a ]. │ │ │ │ │ + 0x01147ab0 3e202020 20207772 61705369 74652028 > wrapSite ( │ │ │ │ │ + 0x01147ac0 3c7c3e20 68656973 74536572 7665290a <|> heistServe). │ │ │ │ │ + 0x01147ad0 3e202020 20207265 66203c2d 206c6966 > ref <- lif │ │ │ │ │ + 0x01147ae0 74494f20 24206e65 77494f52 65662022 tIO $ newIORef " │ │ │ │ │ + 0x01147af0 666f6f43 6f727022 0a3e2020 20202072 fooCorp".> r │ │ │ │ │ + 0x01147b00 65747572 6e202420 41707020 68732066 eturn $ App hs f │ │ │ │ │ + 0x01147b10 73206273 20726566 0a0a466f 72206e6f s bs ref..For no │ │ │ │ │ + 0x01147b20 7720646f 6e277420 776f7272 79206162 w don't worry ab │ │ │ │ │ + 0x01147b30 6f757420 616c6c20 74686520 64657461 out all the deta │ │ │ │ │ + 0x01147b40 696c7320 6f662074 68697320 636f6465 ils of this code │ │ │ │ │ + 0x01147b50 2e202057 65276c6c 20776f72 6b207468 . We'll work th │ │ │ │ │ + 0x01147b60 726f7567 68207468 650a696e 64697669 rough the.indivi │ │ │ │ │ + 0x01147b70 6475616c 20706965 63657320 6f6e6520 dual pieces one │ │ │ │ │ + 0x01147b80 61742061 2074696d 652e2020 54686520 at a time. The │ │ │ │ │ + 0x01147b90 62617369 63206964 65612068 65726520 basic idea here │ │ │ │ │ + 0x01147ba0 69732074 68617420 746f2069 6e697469 is that to initi │ │ │ │ │ + 0x01147bb0 616c697a 6520616e 0a617070 6c696361 alize an.applica │ │ │ │ │ + 0x01147bc0 74696f6e 2c207765 20666972 73742069 tion, we first i │ │ │ │ │ + 0x01147bd0 6e697469 616c697a 65206561 6368206f nitialize each o │ │ │ │ │ + 0x01147be0 66207468 6520736e 61706c65 74732c20 f the snaplets, │ │ │ │ │ + 0x01147bf0 61646420 736f6d65 20726f75 7465732c add some routes, │ │ │ │ │ + 0x01147c00 2072756e 20610a66 756e6374 696f6e20 run a.function │ │ │ │ │ + 0x01147c10 77726170 70696e67 20616c6c 20746865 wrapping all the │ │ │ │ │ + 0x01147c20 20726f75 7465732c 20616e64 20726574 routes, and ret │ │ │ │ │ + 0x01147c30 75726e20 74686520 72657375 6c74696e urn the resultin │ │ │ │ │ + 0x01147c40 67207374 61746520 64617461 0a737472 g state data.str │ │ │ │ │ + 0x01147c50 75637475 72652e20 20546869 73206578 ucture. This ex │ │ │ │ │ + 0x01147c60 616d706c 65206465 6d6f6e73 74726174 ample demonstrat │ │ │ │ │ + 0x01147c70 65732074 68652075 7365206f 66206120 es the use of a │ │ │ │ │ + 0x01147c80 66657720 6f662074 6865206d 6f737420 few of the most │ │ │ │ │ + 0x01147c90 636f6d6d 6f6e0a73 6e61706c 65742066 common.snaplet f │ │ │ │ │ + 0x01147ca0 756e6374 696f6e73 2e0a0a6e 65737453 unctions...nestS │ │ │ │ │ + 0x01147cb0 6e61706c 65740a2d 2d2d2d2d 2d2d2d2d naplet.--------- │ │ │ │ │ + 0x01147cc0 2d2d0a0a 416c6c20 63616c6c 7320746f --..All calls to │ │ │ │ │ + 0x01147cd0 20636869 6c642073 6e61706c 65742069 child snaplet i │ │ │ │ │ + 0x01147ce0 6e697469 616c697a 65722066 756e6374 nitializer funct │ │ │ │ │ + 0x01147cf0 696f6e73 206d7573 74206265 20777261 ions must be wra │ │ │ │ │ + 0x01147d00 70706564 20696e20 61206361 6c6c2074 pped in a call t │ │ │ │ │ + 0x01147d10 6f0a6e65 7374536e 61706c65 742e2020 o.nestSnaplet. │ │ │ │ │ + 0x01147d20 54686520 66697273 74207061 72616d65 The first parame │ │ │ │ │ + 0x01147d30 74657220 69732061 2055524c 20706174 ter is a URL pat │ │ │ │ │ + 0x01147d40 68207365 676d656e 74207468 61742069 h segment that i │ │ │ │ │ + 0x01147d50 73207573 65642074 6f207072 65666978 s used to prefix │ │ │ │ │ + 0x01147d60 0a616c6c 20726f75 74657320 64656669 .all routes defi │ │ │ │ │ + 0x01147d70 6e656420 62792074 68652073 6e61706c ned by the snapl │ │ │ │ │ + 0x01147d80 65742e20 20546869 73206c65 74732079 et. This lets y │ │ │ │ │ + 0x01147d90 6f752065 6e737572 65207468 61742074 ou ensure that t │ │ │ │ │ + 0x01147da0 68657265 2077696c 6c206265 206e6f0a here will be no. │ │ │ │ │ + 0x01147db0 70726f62 6c656d73 20776974 68206475 problems with du │ │ │ │ │ + 0x01147dc0 706c6963 61746520 726f7574 65732064 plicate routes d │ │ │ │ │ + 0x01147dd0 6566696e 65642069 6e206469 66666572 efined in differ │ │ │ │ │ + 0x01147de0 656e7420 736e6170 6c657473 2e202049 ent snaplets. I │ │ │ │ │ + 0x01147df0 66207468 6520666f 6f0a736e 61706c65 f the foo.snaple │ │ │ │ │ + 0x01147e00 74206465 66696e65 73206120 726f7574 t defines a rout │ │ │ │ │ + 0x01147e10 6520602f 666f6f70 61676560 2c207468 e `/foopage`, th │ │ │ │ │ + 0x01147e20 656e2069 6e207468 65206162 6f766520 en in the above │ │ │ │ │ + 0x01147e30 6578616d 706c652c 20746861 74207061 example, that pa │ │ │ │ │ + 0x01147e40 67652077 696c6c0a 62652061 7661696c ge will.be avail │ │ │ │ │ + 0x01147e50 61626c65 20617420 602f666f 6f2f666f able at `/foo/fo │ │ │ │ │ + 0x01147e60 6f706167 65602e20 20536f6d 6574696d opage`. Sometim │ │ │ │ │ + 0x01147e70 65732074 686f7567 682c2079 6f75206d es though, you m │ │ │ │ │ + 0x01147e80 69676874 2077616e 74206120 736e6170 ight want a snap │ │ │ │ │ + 0x01147e90 6c657427 730a726f 75746573 20746f20 let's.routes to │ │ │ │ │ + 0x01147ea0 62652061 7661696c 61626c65 20617420 be available at │ │ │ │ │ + 0x01147eb0 74686520 746f7020 6c657665 6c2e2020 the top level. │ │ │ │ │ + 0x01147ec0 546f2064 6f207468 61742c20 6a757374 To do that, just │ │ │ │ │ + 0x01147ed0 20706173 7320616e 20656d70 74792073 pass an empty s │ │ │ │ │ + 0x01147ee0 7472696e 670a746f 206e6573 74536e61 tring.to nestSna │ │ │ │ │ + 0x01147ef0 706c6574 20617320 73686f77 6e206162 plet as shown ab │ │ │ │ │ + 0x01147f00 6f766520 77697468 20746865 20626172 ove with the bar │ │ │ │ │ + 0x01147f10 20736e61 706c6574 2e0a0a49 6e206f75 snaplet...In ou │ │ │ │ │ + 0x01147f20 72206578 616d706c 65206162 6f76652c r example above, │ │ │ │ │ + 0x01147f30 20746865 20626172 20736e61 706c6574 the bar snaplet │ │ │ │ │ + 0x01147f40 20646f65 7320736f 6d657468 696e6720 does something │ │ │ │ │ + 0x01147f50 74686174 206e6565 64732074 6f206b6e that needs to kn │ │ │ │ │ + 0x01147f60 6f772061 626f7574 0a746865 20666f6f ow about.the foo │ │ │ │ │ + 0x01147f70 20736e61 706c6574 2e20204d 61796265 snaplet. Maybe │ │ │ │ │ + 0x01147f80 20666f6f 20697320 61206461 74616261 foo is a databa │ │ │ │ │ + 0x01147f90 73652073 6e61706c 65742061 6e642062 se snaplet and b │ │ │ │ │ + 0x01147fa0 61722077 616e7473 20746f20 73746f72 ar wants to stor │ │ │ │ │ + 0x01147fb0 65206f72 0a726561 6420736f 6d657468 e or.read someth │ │ │ │ │ + 0x01147fc0 696e672e 2020496e 206f7264 65722074 ing. In order t │ │ │ │ │ + 0x01147fd0 6f206d61 6b652074 68617420 68617070 o make that happ │ │ │ │ │ + 0x01147fe0 656e2c20 6974206e 65656473 20746f20 en, it needs to │ │ │ │ │ + 0x01147ff0 68617665 20612022 68616e64 6c652220 have a "handle" │ │ │ │ │ + 0x01148000 746f0a74 68652073 6e61706c 65742e20 to.the snaplet. │ │ │ │ │ + 0x01148010 204f7572 2068616e 646c6573 20617265 Our handles are │ │ │ │ │ + 0x01148020 20776861 74657665 72206669 656c6420 whatever field │ │ │ │ │ + 0x01148030 6e616d65 73207765 20757365 6420696e names we used in │ │ │ │ │ + 0x01148040 20746865 20417070 20646174 610a7374 the App data.st │ │ │ │ │ + 0x01148050 72756374 75726520 6d696e75 73207468 ructure minus th │ │ │ │ │ + 0x01148060 6520696e 69746961 6c20756e 64657273 e initial unders │ │ │ │ │ + 0x01148070 636f7265 20636861 72616374 65722e20 core character. │ │ │ │ │ + 0x01148080 20546865 79206172 65206175 746f6d61 They are automa │ │ │ │ │ + 0x01148090 74696361 6c6c790a 67656e65 72617465 tically.generate │ │ │ │ │ + 0x011480a0 64206279 20746865 20606d61 6b654c65 d by the `makeLe │ │ │ │ │ + 0x011480b0 6e736573 60206675 6e637469 6f6e2e20 nses` function. │ │ │ │ │ + 0x011480c0 20466f72 206e6f77 20697427 73207375 For now it's su │ │ │ │ │ + 0x011480d0 66666963 69656e74 20746f20 7468696e fficient to thin │ │ │ │ │ + 0x011480e0 6b206f66 0a746865 6d206173 20612067 k of.them as a g │ │ │ │ │ + 0x011480f0 65747465 7220616e 64206120 73657474 etter and a sett │ │ │ │ │ + 0x01148100 65722063 6f6d6269 6e656420 28746f20 er combined (to │ │ │ │ │ + 0x01148110 75736520 616e204f 4f206d65 74617068 use an OO metaph │ │ │ │ │ + 0x01148120 6f72292e 0a0a5468 65207365 636f6e64 or)...The second │ │ │ │ │ + 0x01148130 20706172 616d6574 65722074 6f206e65 parameter to ne │ │ │ │ │ + 0x01148140 7374536e 61706c65 74206973 20746865 stSnaplet is the │ │ │ │ │ + 0x01148150 206c656e 7320746f 20746865 20736e61 lens to the sna │ │ │ │ │ + 0x01148160 706c6574 20796f75 27726520 6e657374 plet you're nest │ │ │ │ │ + 0x01148170 696e672e 0a496e20 6f726465 7220746f ing..In order to │ │ │ │ │ + 0x01148180 20706c61 63652061 20706965 63652069 place a piece i │ │ │ │ │ + 0x01148190 6e746f20 74686520 70757a7a 6c652c20 nto the puzzle, │ │ │ │ │ + 0x011481a0 796f7520 6e656564 20746f20 6b6e6f77 you need to know │ │ │ │ │ + 0x011481b0 20776865 72652069 7420676f 65732e0a where it goes.. │ │ │ │ │ + 0x011481c0 0a6e616d 65536e61 706c6574 0a2d2d2d .nameSnaplet.--- │ │ │ │ │ + 0x011481d0 2d2d2d2d 2d2d2d2d 0a0a5468 65206175 --------..The au │ │ │ │ │ + 0x011481e0 74686f72 206f6620 6120736e 61706c65 thor of a snaple │ │ │ │ │ + 0x011481f0 74206465 66696e65 73206120 64656661 t defines a defa │ │ │ │ │ + 0x01148200 756c7420 6e616d65 20666f72 20746865 ult name for the │ │ │ │ │ + 0x01148210 20736e61 706c6574 20696e20 74686520 snaplet in the │ │ │ │ │ + 0x01148220 66697273 740a6172 67756d65 6e742074 first.argument t │ │ │ │ │ + 0x01148230 6f207468 65206d61 6b65536e 61706c65 o the makeSnaple │ │ │ │ │ + 0x01148240 74206675 6e637469 6f6e2e20 20546869 t function. Thi │ │ │ │ │ + 0x01148250 73206e61 6d652069 73207573 65642066 s name is used f │ │ │ │ │ + 0x01148260 6f722074 68652073 6e61706c 65742773 or the snaplet's │ │ │ │ │ + 0x01148270 0a646972 6563746f 72792069 6e207468 .directory in th │ │ │ │ │ + 0x01148280 65206669 6c657379 7374656d 2e202049 e filesystem. I │ │ │ │ │ + 0x01148290 6620796f 7520646f 6e277420 77616e74 f you don't want │ │ │ │ │ + 0x011482a0 20746f20 75736520 74686520 64656661 to use the defa │ │ │ │ │ + 0x011482b0 756c7420 6e616d65 2c20796f 750a6361 ult name, you.ca │ │ │ │ │ + 0x011482c0 6e206f76 65727269 64652069 74207769 n override it wi │ │ │ │ │ + 0x011482d0 74682074 68652060 6e616d65 536e6170 th the `nameSnap │ │ │ │ │ + 0x011482e0 6c657460 2066756e 6374696f 6e2e2020 let` function. │ │ │ │ │ + 0x011482f0 416c736f 2c206966 20796f75 2077616e Also, if you wan │ │ │ │ │ + 0x01148300 7420746f 20686176 65207477 6f0a696e t to have two.in │ │ │ │ │ + 0x01148310 7374616e 63657320 6f662074 68652073 stances of the s │ │ │ │ │ + 0x01148320 616d6520 736e6170 6c65742c 20746865 ame snaplet, the │ │ │ │ │ + 0x01148330 6e20796f 75207769 6c6c206e 65656420 n you will need │ │ │ │ │ + 0x01148340 746f2075 73652060 6e616d65 536e6170 to use `nameSnap │ │ │ │ │ + 0x01148350 6c657460 20746f20 67697665 0a617420 let` to give.at │ │ │ │ │ + 0x01148360 6c656173 74206f6e 65206f66 20746865 least one of the │ │ │ │ │ + 0x01148370 6d206120 756e6971 7565206e 616d652e m a unique name. │ │ │ │ │ + 0x01148380 0a0a6164 64526f75 7465730a 2d2d2d2d ..addRoutes.---- │ │ │ │ │ + 0x01148390 2d2d2d2d 2d0a0a54 68652060 61646452 -----..The `addR │ │ │ │ │ + 0x011483a0 6f757465 73602066 756e6374 696f6e20 outes` function │ │ │ │ │ + 0x011483b0 69732068 6f772061 6e206170 706c6963 is how an applic │ │ │ │ │ + 0x011483c0 6174696f 6e20286f 7220736e 61706c65 ation (or snaple │ │ │ │ │ + 0x011483d0 74292064 6566696e 65732069 74730a72 t) defines its.r │ │ │ │ │ + 0x011483e0 6f757465 732e2020 556e6465 72207468 outes. Under th │ │ │ │ │ + 0x011483f0 6520686f 6f642074 68652073 6e61706c e hood the snapl │ │ │ │ │ + 0x01148400 65742069 6e667261 73747275 63747572 et infrastructur │ │ │ │ │ + 0x01148410 65206d65 72676573 20616c6c 20746865 e merges all the │ │ │ │ │ + 0x01148420 20726f75 74657320 66726f6d 0a616c6c routes from.all │ │ │ │ │ + 0x01148430 20736e61 706c6574 732c2070 72657065 snaplets, prepe │ │ │ │ │ + 0x01148440 6e647320 70726566 69786573 2066726f nds prefixes fro │ │ │ │ │ + 0x01148450 6d20606e 65737453 6e61706c 65746020 m `nestSnaplet` │ │ │ │ │ + 0x01148460 63616c6c 732c2061 6e642070 61737365 calls, and passe │ │ │ │ │ + 0x01148470 73207468 65206c69 73740a74 6f20536e s the list.to Sn │ │ │ │ │ + 0x01148480 61702773 0a5b726f 7574655d 28687474 ap's.[route](htt │ │ │ │ │ + 0x01148490 703a2f2f 6861636b 6167652e 6861736b p://hackage.hask │ │ │ │ │ + 0x011484a0 656c6c2e 6f72672f 7061636b 61676573 ell.org/packages │ │ │ │ │ + 0x011484b0 2f617263 68697665 2f736e61 702d636f /archive/snap-co │ │ │ │ │ + 0x011484c0 72652f30 2e352e31 2e342f64 6f632f68 re/0.5.1.4/doc/h │ │ │ │ │ + 0x011484d0 746d6c2f 536e6170 2d547970 65732e68 tml/Snap-Types.h │ │ │ │ │ + 0x011484e0 746d6c23 763a726f 75746529 0a66756e tml#v:route).fun │ │ │ │ │ + 0x011484f0 6374696f 6e2e0a0a 4120726f 75746520 ction...A route │ │ │ │ │ + 0x01148500 69732061 20747570 6c65206f 66206120 is a tuple of a │ │ │ │ │ + 0x01148510 55524c20 616e6420 61206861 6e646c65 URL and a handle │ │ │ │ │ + 0x01148520 72206675 6e637469 6f6e2074 68617420 r function that │ │ │ │ │ + 0x01148530 77696c6c 20626520 63616c6c 65642077 will be called w │ │ │ │ │ + 0x01148540 68656e0a 74686520 55524c20 69732072 hen.the URL is r │ │ │ │ │ + 0x01148550 65717565 73746564 2e202048 616e646c equested. Handl │ │ │ │ │ + 0x01148560 65722069 73206120 77726170 70657220 er is a wrapper │ │ │ │ │ + 0x01148570 61726f75 6e642074 68652053 6e617020 around the Snap │ │ │ │ │ + 0x01148580 6d6f6e61 64207468 61742068 616e646c monad that handl │ │ │ │ │ + 0x01148590 65730a74 68652073 6e61706c 65742773 es.the snaplet's │ │ │ │ │ + 0x011485a0 20696e66 72617374 72756374 7572652e infrastructure. │ │ │ │ │ + 0x011485b0 20204475 72696e67 20696e69 7469616c During initial │ │ │ │ │ + 0x011485c0 697a6174 696f6e2c 20736e61 706c6574 ization, snaplet │ │ │ │ │ + 0x011485d0 73207573 65207468 650a6049 6e697469 s use the.`Initi │ │ │ │ │ + 0x011485e0 616c697a 65726020 6d6f6e61 642e2020 alizer` monad. │ │ │ │ │ + 0x011485f0 44757269 6e672072 756e7469 6d652c20 During runtime, │ │ │ │ │ + 0x01148600 74686579 20757365 20746865 20604861 they use the `Ha │ │ │ │ │ + 0x01148610 6e646c65 7260206d 6f6e6164 2e202057 ndler` monad. W │ │ │ │ │ + 0x01148620 65276c6c 0a646973 63757373 20604861 e'll.discuss `Ha │ │ │ │ │ + 0x01148630 6e646c65 72602069 6e206d6f 72652064 ndler` in more d │ │ │ │ │ + 0x01148640 65746169 6c206c61 7465722e 20204966 etail later. If │ │ │ │ │ + 0x01148650 20796f75 27726520 66616d69 6c696172 you're familiar │ │ │ │ │ + 0x01148660 20776974 6820536e 61702773 206f6c64 with Snap's old │ │ │ │ │ + 0x01148670 0a657874 656e7369 6f6e2073 79737465 .extension syste │ │ │ │ │ + 0x01148680 6d2c2079 6f752063 616e2074 68696e6b m, you can think │ │ │ │ │ + 0x01148690 206f6620 69742061 7320726f 7567686c of it as roughl │ │ │ │ │ + 0x011486a0 79206571 75697661 6c656e74 20746f20 y equivalent to │ │ │ │ │ + 0x011486b0 74686520 4170706c 69636174 696f6e0a the Application. │ │ │ │ │ + 0x011486c0 6d6f6e61 642e2020 49742068 61732061 monad. It has a │ │ │ │ │ + 0x011486d0 20604d6f 6e616453 74617465 6020696e `MonadState` in │ │ │ │ │ + 0x011486e0 7374616e 63652074 68617420 6c657473 stance that lets │ │ │ │ │ + 0x011486f0 20796f75 20616363 65737320 616e6420 you access and │ │ │ │ │ + 0x01148700 6d6f6469 66792074 68650a63 75727265 modify the.curre │ │ │ │ │ + 0x01148710 6e742073 6e61706c 65742773 20737461 nt snaplet's sta │ │ │ │ │ + 0x01148720 74652c20 616e6420 6120604d 6f6e6164 te, and a `Monad │ │ │ │ │ + 0x01148730 536e6170 6020696e 7374616e 63652070 Snap` instance p │ │ │ │ │ + 0x01148740 726f7669 64696e67 20746865 0a726571 roviding the.req │ │ │ │ │ + 0x01148750 75657374 2d70726f 63657373 696e6720 uest-processing │ │ │ │ │ + 0x01148760 66756e63 74696f6e 73206465 66696e65 functions define │ │ │ │ │ + 0x01148770 6420696e 20536e61 702e5479 7065732e d in Snap.Types. │ │ │ │ │ + 0x01148780 0a0a7772 61705369 74650a2d 2d2d2d2d ..wrapSite.----- │ │ │ │ │ + 0x01148790 2d2d2d2d 2d2d2d0a 0a607772 61705369 -------..`wrapSi │ │ │ │ │ + 0x011487a0 74656020 616c6c6f 77732079 6f752074 te` allows you t │ │ │ │ │ + 0x011487b0 6f206170 706c7920 616e2061 72626974 o apply an arbit │ │ │ │ │ + 0x011487c0 72617279 20604861 6e646c65 72602074 rary `Handler` t │ │ │ │ │ + 0x011487d0 72616e73 666f726d 6174696f 6e20746f ransformation to │ │ │ │ │ + 0x011487e0 0a746865 20746f70 2d6c6576 656c2068 .the top-level h │ │ │ │ │ + 0x011487f0 616e646c 65722e20 20546869 73206973 andler. This is │ │ │ │ │ + 0x01148800 20757365 66756c20 69662079 6f752077 useful if you w │ │ │ │ │ + 0x01148810 616e7420 746f2064 6f20736f 6d652067 ant to do some g │ │ │ │ │ + 0x01148820 656e6572 69630a70 726f6365 7373696e eneric.processin │ │ │ │ │ + 0x01148830 67206174 20746865 20626567 696e6e69 g at the beginni │ │ │ │ │ + 0x01148840 6e67206f 7220656e 64206f66 20657665 ng or end of eve │ │ │ │ │ + 0x01148850 72792072 65717565 73742e20 20466f72 ry request. For │ │ │ │ │ + 0x01148860 20696e73 74616e63 652c2061 20736573 instance, a ses │ │ │ │ │ + 0x01148870 73696f6e 0a736e61 706c6574 206d6967 sion.snaplet mig │ │ │ │ │ + 0x01148880 68742075 73652069 7420746f 20746f75 ht use it to tou │ │ │ │ │ + 0x01148890 63682061 20736573 73696f6e 20616374 ch a session act │ │ │ │ │ + 0x011488a0 69766974 7920746f 6b656e20 6265666f ivity token befo │ │ │ │ │ + 0x011488b0 72652072 6f757469 6e672068 61707065 re routing happe │ │ │ │ │ + 0x011488c0 6e732e0a 49742063 6f756c64 20616c73 ns..It could als │ │ │ │ │ + 0x011488d0 6f206265 20757365 6420746f 20696d70 o be used to imp │ │ │ │ │ + 0x011488e0 6c656d65 6e742063 7573746f 6d206c6f lement custom lo │ │ │ │ │ + 0x011488f0 6767696e 672e2020 54686520 6578616d gging. The exam │ │ │ │ │ + 0x01148900 706c6520 61626f76 65207573 65732069 ple above uses i │ │ │ │ │ + 0x01148910 740a746f 20646566 696e6520 68656973 t.to define heis │ │ │ │ │ + 0x01148920 74536572 76652028 70726f76 69646564 tServe (provided │ │ │ │ │ + 0x01148930 20627920 74686520 48656973 7420736e by the Heist sn │ │ │ │ │ + 0x01148940 61706c65 74292061 73207468 65206465 aplet) as the de │ │ │ │ │ + 0x01148950 6661756c 74206861 6e646c65 7220746f fault handler to │ │ │ │ │ + 0x01148960 0a626520 74726965 64206966 206e6f20 .be tried if no │ │ │ │ │ + 0x01148970 6f746865 72206861 6e646c65 72206d61 other handler ma │ │ │ │ │ + 0x01148980 74636865 642e2020 54686973 206d6179 tched. This may │ │ │ │ │ + 0x01148990 20736565 6d206c69 6b652061 6e206561 seem like an ea │ │ │ │ │ + 0x011489a0 73792077 61792074 6f206465 66696e65 sy way to define │ │ │ │ │ + 0x011489b0 0a726f75 7465732c 20627574 20696620 .routes, but if │ │ │ │ │ + 0x011489c0 796f7520 73747269 6e672074 68656d20 you string them │ │ │ │ │ + 0x011489d0 616c6c20 746f6765 74686572 20696e20 all together in │ │ │ │ │ + 0x011489e0 74686973 20776179 20656163 68206861 this way each ha │ │ │ │ │ + 0x011489f0 6e646c65 72207769 6c6c2062 650a6576 ndler will be.ev │ │ │ │ │ + 0x01148a00 616c7561 74656420 73657175 656e7469 aluated sequenti │ │ │ │ │ + 0x01148a10 616c6c79 20616e64 20796f75 276c6c20 ally and you'll │ │ │ │ │ + 0x01148a20 67657420 4f286e29 2074696d 6520636f get O(n) time co │ │ │ │ │ + 0x01148a30 6d706c65 78697479 2c207768 65726561 mplexity, wherea │ │ │ │ │ + 0x01148a40 7320726f 75746573 0a646566 696e6564 s routes.defined │ │ │ │ │ + 0x01148a50 20776974 68206061 6464526f 75746573 with `addRoutes │ │ │ │ │ + 0x01148a60 60206861 7665204f 286c6f67 206e2920 ` have O(log n) │ │ │ │ │ + 0x01148a70 74696d65 20636f6d 706c6578 6974792e time complexity. │ │ │ │ │ + 0x01148a80 20205468 65726566 6f72652c 20696e20 Therefore, in │ │ │ │ │ + 0x01148a90 610a7265 616c2d77 6f726c64 20617070 a.real-world app │ │ │ │ │ + 0x01148aa0 6c696361 74696f6e 20796f75 20776f75 lication you wou │ │ │ │ │ + 0x01148ab0 6c642070 726f6261 626c7920 77616e74 ld probably want │ │ │ │ │ + 0x01148ac0 20746f20 68617665 20602822 222c2068 to have `("", h │ │ │ │ │ + 0x01148ad0 65697374 53657276 65296020 696e0a74 eistServe)` in.t │ │ │ │ │ + 0x01148ae0 6865206c 69737420 70617373 65642074 he list passed t │ │ │ │ │ + 0x01148af0 6f206061 6464526f 75746573 602e0a0a o `addRoutes`... │ │ │ │ │ + 0x01148b00 77697468 0a2d2d2d 2d0a0a54 6865206c with.----..The l │ │ │ │ │ + 0x01148b10 61737420 756e6661 6d696c69 61722066 ast unfamiliar f │ │ │ │ │ + 0x01148b20 756e6374 696f6e20 696e2074 68652065 unction in the e │ │ │ │ │ + 0x01148b30 78616d70 6c652069 73206077 69746860 xample is `with` │ │ │ │ │ + 0x01148b40 2e202048 65726520 69742061 63636f6d . Here it accom │ │ │ │ │ + 0x01148b50 70616e69 65732061 0a63616c 6c20746f panies a.call to │ │ │ │ │ + 0x01148b60 20746865 2066756e 6374696f 6e20606e the function `n │ │ │ │ │ + 0x01148b70 616d6550 61676560 2e202060 6e616d65 amePage`. `name │ │ │ │ │ + 0x01148b80 50616765 60206973 20612073 696d706c Page` is a simpl │ │ │ │ │ + 0x01148b90 65206578 616d706c 65206861 6e646c65 e example handle │ │ │ │ │ + 0x01148ba0 7220616e 640a6c6f 6f6b7320 6c696b65 r and.looks like │ │ │ │ │ + 0x01148bb0 20746869 732e0a0a 3e206e61 6d655061 this...> namePa │ │ │ │ │ + 0x01148bc0 6765203a 3a204861 6e646c65 72206220 ge :: Handler b │ │ │ │ │ + 0x01148bd0 76202829 0a3e206e 616d6550 61676520 v ().> namePage │ │ │ │ │ + 0x01148be0 3d20646f 0a3e2020 2020206d 6e616d65 = do.> mname │ │ │ │ │ + 0x01148bf0 203c2d20 67657453 6e61706c 65744e61 <- getSnapletNa │ │ │ │ │ + 0x01148c00 6d650a3e 20202020 20777269 74655465 me.> writeTe │ │ │ │ │ + 0x01148c10 78742024 2066726f 6d4d6179 62652022 xt $ fromMaybe " │ │ │ │ │ + 0x01148c20 54686973 2073686f 756c646e 27742068 This shouldn't h │ │ │ │ │ + 0x01148c30 61707065 6e22206d 6e616d65 0a0a5468 appen" mname..Th │ │ │ │ │ + 0x01148c40 69732066 756e6374 696f6e20 69732061 is function is a │ │ │ │ │ + 0x01148c50 2067656e 65726963 2068616e 646c6572 generic handler │ │ │ │ │ + 0x01148c60 20746861 74206765 74732074 6865206e that gets the n │ │ │ │ │ + 0x01148c70 616d6520 6f662074 68652063 75727265 ame of the curre │ │ │ │ │ + 0x01148c80 6e742073 6e61706c 65740a61 6e642077 nt snaplet.and w │ │ │ │ │ + 0x01148c90 72697465 73206974 20696e74 6f207468 rites it into th │ │ │ │ │ + 0x01148ca0 65207265 73706f6e 73652077 69746820 e response with │ │ │ │ │ + 0x01148cb0 74686520 60777269 74655465 78746020 the `writeText` │ │ │ │ │ + 0x01148cc0 66756e63 74696f6e 20646566 696e6564 function defined │ │ │ │ │ + 0x01148cd0 20627920 7468650a 736e6170 2d636f72 by the.snap-cor │ │ │ │ │ + 0x01148ce0 65207072 6f6a6563 742e2020 54686520 e project. The │ │ │ │ │ + 0x01148cf0 74797065 20766172 6961626c 65732027 type variables ' │ │ │ │ │ + 0x01148d00 62272061 6e642027 76272069 6e646963 b' and 'v' indic │ │ │ │ │ + 0x01148d10 61746520 74686174 20746869 73206675 ate that this fu │ │ │ │ │ + 0x01148d20 6e637469 6f6e0a77 696c6c20 776f726b nction.will work │ │ │ │ │ + 0x01148d30 20696e20 616e7920 736e6170 6c657420 in any snaplet │ │ │ │ │ + 0x01148d40 77697468 20616e79 20626173 65206170 with any base ap │ │ │ │ │ + 0x01148d50 706c6963 6174696f 6e2e2020 54686520 plication. The │ │ │ │ │ + 0x01148d60 27776974 68272066 756e6374 696f6e20 'with' function │ │ │ │ │ + 0x01148d70 69730a75 73656420 746f2072 756e2060 is.used to run ` │ │ │ │ │ + 0x01148d80 6e616d65 50616765 6020696e 20746865 namePage` in the │ │ │ │ │ + 0x01148d90 20636f6e 74657874 206f6620 74686520 context of the │ │ │ │ │ + 0x01148da0 736e6170 6c657473 20666f6f 20616e64 snaplets foo and │ │ │ │ │ + 0x01148db0 20626172 20666f72 20746865 0a636f72 bar for the.cor │ │ │ │ │ + 0x01148dc0 72657370 6f6e6469 6e672072 6f757465 responding route │ │ │ │ │ + 0x01148dd0 732e0a0a 53697465 2052656c 6f616469 s...Site Reloadi │ │ │ │ │ + 0x01148de0 6e670a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ng.------------- │ │ │ │ │ + 0x01148df0 2d0a0a53 6e61706c 65742049 6e697469 -..Snaplet Initi │ │ │ │ │ + 0x01148e00 616c697a 65727320 73657276 65206475 alizers serve du │ │ │ │ │ + 0x01148e10 616c2070 7572706f 73652061 7320626f al purpose as bo │ │ │ │ │ + 0x01148e20 74682069 6e697469 616c697a 65727320 th initializers │ │ │ │ │ + 0x01148e30 616e6420 72656c6f 61646572 732e0a52 and reloaders..R │ │ │ │ │ + 0x01148e40 656c6f61 64732061 72652074 72696767 eloads are trigg │ │ │ │ │ + 0x01148e50 65726564 20627920 61207370 65636961 ered by a specia │ │ │ │ │ + 0x01148e60 6c206861 6e646c65 72207468 61742069 l handler that i │ │ │ │ │ + 0x01148e70 7320626f 756e6420 746f2074 68650a60 s bound to the.` │ │ │ │ │ + 0x01148e80 2f61646d 696e2f72 656c6f61 64602072 /admin/reload` r │ │ │ │ │ + 0x01148e90 6f757465 2e202054 68697320 68616e64 oute. This hand │ │ │ │ │ + 0x01148ea0 6c657220 72652d72 756e7320 74686520 ler re-runs the │ │ │ │ │ + 0x01148eb0 73697465 20696e69 7469616c 697a6572 site initializer │ │ │ │ │ + 0x01148ec0 20616e64 20696620 69742069 730a7375 and if it is.su │ │ │ │ │ + 0x01148ed0 63636573 7366756c 2c206c6f 61647320 ccessful, loads │ │ │ │ │ + 0x01148ee0 74686520 6e65776c 79206765 6e657261 the newly genera │ │ │ │ │ + 0x01148ef0 74656420 696e2d6d 656d6f72 79207374 ted in-memory st │ │ │ │ │ + 0x01148f00 6174652e 2020546f 20707265 76656e74 ate. To prevent │ │ │ │ │ + 0x01148f10 2064656e 69616c20 6f660a73 65727669 denial of.servi │ │ │ │ │ + 0x01148f20 63652061 74746163 6b732c20 74686520 ce attacks, the │ │ │ │ │ + 0x01148f30 72656c6f 61642072 6f757465 20697320 reload route is │ │ │ │ │ + 0x01148f40 6f6e6c79 20616363 65737369 626c6520 only accessible │ │ │ │ │ + 0x01148f50 66726f6d 206c6f63 616c686f 73742e0a from localhost.. │ │ │ │ │ + 0x01148f60 0a496620 74686572 65206172 6520616e .If there are an │ │ │ │ │ + 0x01148f70 79206572 726f7273 20647572 696e6720 y errors during │ │ │ │ │ + 0x01148f80 72656c6f 61642c20 796f7520 776f756c reload, you woul │ │ │ │ │ + 0x01148f90 64206e61 74757261 6c6c7920 77616e74 d naturally want │ │ │ │ │ + 0x01148fa0 20746f20 73656520 7468656d 20696e0a to see them in. │ │ │ │ │ + 0x01148fb0 74686520 48545450 20726573 706f6e73 the HTTP respons │ │ │ │ │ + 0x01148fc0 65207265 7475726e 65642062 79207468 e returned by th │ │ │ │ │ + 0x01148fd0 65207365 72766572 2e202048 6f776576 e server. Howev │ │ │ │ │ + 0x01148fe0 65722c20 7768656e 20746865 73652073 er, when these s │ │ │ │ │ + 0x01148ff0 616d650a 696e6974 69616c69 7a657273 ame.initializers │ │ │ │ │ + 0x01149000 20617265 2072756e 20776865 6e20796f are run when yo │ │ │ │ │ + 0x01149010 75206669 72737420 73746172 7420796f u first start yo │ │ │ │ │ + 0x01149020 75722061 70702c20 796f7520 77696c6c ur app, you will │ │ │ │ │ + 0x01149030 2077616e 7420746f 20736565 0a737461 want to see.sta │ │ │ │ │ + 0x01149040 74757320 6d657373 61676573 20707269 tus messages pri │ │ │ │ │ + 0x01149050 6e746564 20746f20 74686520 636f6e73 nted to the cons │ │ │ │ │ + 0x01149060 6f6c652e 2020546f 206d616b 65207468 ole. To make th │ │ │ │ │ + 0x01149070 69732070 6f737369 626c6520 77652070 is possible we p │ │ │ │ │ + 0x01149080 726f7669 64652074 68650a60 7072696e rovide the.`prin │ │ │ │ │ + 0x01149090 74496e66 6f602066 756e6374 696f6e2e tInfo` function. │ │ │ │ │ + 0x011490a0 2020596f 75207368 6f756c64 20757365 You should use │ │ │ │ │ + 0x011490b0 20697420 746f206f 75747075 7420616e it to output an │ │ │ │ │ + 0x011490c0 7920696e 666f726d 6174696f 6e616c20 y informational │ │ │ │ │ + 0x011490d0 6d657373 61676573 0a67656e 65726174 messages.generat │ │ │ │ │ + 0x011490e0 65642062 7920796f 75722069 6e697469 ed by your initi │ │ │ │ │ + 0x011490f0 616c697a 6572732e 20204966 20796f75 alizers. If you │ │ │ │ │ + 0x01149100 20707269 6e742064 69726563 746c7920 print directly │ │ │ │ │ + 0x01149110 746f2073 74616e64 61726420 6f757470 to standard outp │ │ │ │ │ + 0x01149120 7574206f 720a7374 616e6461 72642065 ut or.standard e │ │ │ │ │ + 0x01149130 72726f72 2c207468 656e2074 686f7365 rror, then those │ │ │ │ │ + 0x01149140 206d6573 73616765 73207769 6c6c206e messages will n │ │ │ │ │ + 0x01149150 6f742062 65206176 61696c61 626c6520 ot be available │ │ │ │ │ + 0x01149160 696e2079 6f757220 62726f77 73657220 in your browser │ │ │ │ │ + 0x01149170 7768656e 0a796f75 2072656c 6f616420 when.you reload │ │ │ │ │ + 0x01149180 74686520 73697465 2e0a0a57 6f726b69 the site...Worki │ │ │ │ │ + 0x01149190 6e672077 69746820 73746174 650a2d2d ng with state.-- │ │ │ │ │ + 0x011491a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x011491b0 0a0a6048 616e646c 65722062 20766020 ..`Handler b v` │ │ │ │ │ + 0x011491c0 68617320 6120604d 6f6e6164 53746174 has a `MonadStat │ │ │ │ │ + 0x011491d0 65207660 20696e73 74616e63 652e2020 e v` instance. │ │ │ │ │ + 0x011491e0 54686973 206d6561 6e732074 68617420 This means that │ │ │ │ │ + 0x011491f0 796f7520 63616e20 61636365 73730a61 you can access.a │ │ │ │ │ + 0x01149200 6c6c2079 6f757220 736e6170 6c657420 ll your snaplet │ │ │ │ │ + 0x01149210 73746174 65207468 726f7567 68207468 state through th │ │ │ │ │ + 0x01149220 65206765 742c2070 75742c20 67657473 e get, put, gets │ │ │ │ │ + 0x01149230 2c20616e 64206d6f 64696679 2066756e , and modify fun │ │ │ │ │ + 0x01149240 6374696f 6e732074 6861740a 61726520 ctions that.are │ │ │ │ │ + 0x01149250 70726f62 61626c79 2066616d 696c6961 probably familia │ │ │ │ │ + 0x01149260 72206672 6f6d2074 68652073 74617465 r from the state │ │ │ │ │ + 0x01149270 206d6f6e 61642e20 20496e20 6f757220 monad. In our │ │ │ │ │ + 0x01149280 6578616d 706c6520 6170706c 69636174 example applicat │ │ │ │ │ + 0x01149290 696f6e20 77650a64 656d6f6e 73747261 ion we.demonstra │ │ │ │ │ + 0x011492a0 74652074 68697320 77697468 2060636f te this with `co │ │ │ │ │ + 0x011492b0 6d70616e 7948616e 646c6572 602e0a0a mpanyHandler`... │ │ │ │ │ + 0x011492c0 3e20636f 6d70616e 7948616e 646c6572 > companyHandler │ │ │ │ │ + 0x011492d0 203a3a20 48616e64 6c657220 41707020 :: Handler App │ │ │ │ │ + 0x011492e0 41707020 28290a3e 20636f6d 70616e79 App ().> company │ │ │ │ │ + 0x011492f0 48616e64 6c657220 3d206d65 74686f64 Handler = method │ │ │ │ │ + 0x01149300 20474554 20676574 74657220 3c7c3e20 GET getter <|> │ │ │ │ │ + 0x01149310 6d657468 6f642050 4f535420 73657474 method POST sett │ │ │ │ │ + 0x01149320 65720a3e 20202077 68657265 0a3e2020 er.> where.> │ │ │ │ │ + 0x01149330 20202067 65747465 72203d20 646f0a3e getter = do.> │ │ │ │ │ + 0x01149340 20202020 20202020 206e616d 65526566 nameRef │ │ │ │ │ + 0x01149350 203c2d20 67657473 205f636f 6d70616e <- gets _compan │ │ │ │ │ + 0x01149360 794e616d 650a3e20 20202020 20202020 yName.> │ │ │ │ │ + 0x01149370 6e616d65 203c2d20 6c696674 494f2024 name <- liftIO $ │ │ │ │ │ + 0x01149380 20726561 64494f52 6566206e 616d6552 readIORef nameR │ │ │ │ │ + 0x01149390 65660a3e 20202020 20202020 20777269 ef.> wri │ │ │ │ │ + 0x011493a0 74654253 206e616d 650a3e20 20202020 teBS name.> │ │ │ │ │ + 0x011493b0 73657474 6572203d 20646f0a 3e202020 setter = do.> │ │ │ │ │ + 0x011493c0 20202020 20206d6e 616d6520 3c2d2067 mname <- g │ │ │ │ │ + 0x011493d0 65745061 72616d20 226e616d 65220a3e etParam "name".> │ │ │ │ │ + 0x011493e0 20202020 20202020 206e616d 65526566 nameRef │ │ │ │ │ + 0x011493f0 203c2d20 67657473 205f636f 6d70616e <- gets _compan │ │ │ │ │ + 0x01149400 794e616d 650a3e20 20202020 20202020 yName.> │ │ │ │ │ + 0x01149410 6c696674 494f2024 206d6179 62652028 liftIO $ maybe ( │ │ │ │ │ + 0x01149420 72657475 726e2028 29292028 77726974 return ()) (writ │ │ │ │ │ + 0x01149430 65494f52 6566206e 616d6552 65662920 eIORef nameRef) │ │ │ │ │ + 0x01149440 6d6e616d 650a3e20 20202020 20202020 mname.> │ │ │ │ │ + 0x01149450 67657474 65720a0a 49662079 6f752073 getter..If you s │ │ │ │ │ + 0x01149460 65742061 20474554 20726571 75657374 et a GET request │ │ │ │ │ + 0x01149470 20746f20 602f636f 6d70616e 79602c20 to `/company`, │ │ │ │ │ + 0x01149480 796f7527 6c6c2067 65742074 68652073 you'll get the s │ │ │ │ │ + 0x01149490 7472696e 67202266 6f6f436f 72702220 tring "fooCorp" │ │ │ │ │ + 0x011494a0 6261636b 2e0a4966 20796f75 2073656e back..If you sen │ │ │ │ │ + 0x011494b0 64206120 504f5354 20726571 75657374 d a POST request │ │ │ │ │ + 0x011494c0 2c206974 2077696c 6c207365 74207468 , it will set th │ │ │ │ │ + 0x011494d0 6520494f 52656620 68656c64 20696e20 e IORef held in │ │ │ │ │ + 0x011494e0 74686520 605f636f 6d70616e 794e616d the `_companyNam │ │ │ │ │ + 0x011494f0 65600a66 69656c64 20696e20 74686520 e`.field in the │ │ │ │ │ + 0x01149500 60417070 60206461 74612073 74727563 `App` data struc │ │ │ │ │ + 0x01149510 74757265 20746f20 74686520 76616c75 ture to the valu │ │ │ │ │ + 0x01149520 65206f66 20746865 20606e61 6d656020 e of the `name` │ │ │ │ │ + 0x01149530 6669656c 642e2020 5468656e 2069740a field. Then it. │ │ │ │ │ + 0x01149540 63616c6c 73207468 65206765 74746572 calls the getter │ │ │ │ │ + 0x01149550 20746f20 72657475 726e2074 68617420 to return that │ │ │ │ │ + 0x01149560 76616c75 65206261 636b2074 6f20796f value back to yo │ │ │ │ │ + 0x01149570 7520736f 20796f75 2063616e 20736565 u so you can see │ │ │ │ │ + 0x01149580 20697420 7761730a 61637475 616c6c79 it was.actually │ │ │ │ │ + 0x01149590 20636861 6e676564 2e202041 6761696e changed. Again │ │ │ │ │ + 0x011495a0 2c207265 6d656d62 65722074 68617420 , remember that │ │ │ │ │ + 0x011495b0 74686973 20636861 6e676520 6f6e6c79 this change only │ │ │ │ │ + 0x011495c0 20706572 73697374 73206163 726f7373 persists across │ │ │ │ │ + 0x011495d0 0a726571 75657374 73206265 63617573 .requests becaus │ │ │ │ │ + 0x011495e0 65207765 20757365 6420616e 20494f52 e we used an IOR │ │ │ │ │ + 0x011495f0 65662e20 20496620 605f636f 6d70616e ef. If `_compan │ │ │ │ │ + 0x01149600 794e616d 65602077 6173206a 75737420 yName` was just │ │ │ │ │ + 0x01149610 6120706c 61696e20 73747269 6e670a61 a plain string.a │ │ │ │ │ + 0x01149620 6e642077 65206861 64207573 6564206d nd we had used m │ │ │ │ │ + 0x01149630 6f646966 792c2074 68652063 68616e67 odify, the chang │ │ │ │ │ + 0x01149640 65642072 6573756c 7420776f 756c6420 ed result would │ │ │ │ │ + 0x01149650 6f6e6c79 20626520 76697369 626c6520 only be visible │ │ │ │ │ + 0x01149660 696e2074 68652072 6573740a 6f662074 in the rest.of t │ │ │ │ │ + 0x01149670 68652070 726f6365 7373696e 6720666f he processing fo │ │ │ │ │ + 0x01149680 72207468 61742072 65717565 73742e0a r that request.. │ │ │ │ │ + 0x01149690 0a546865 20486569 73742053 6e61706c .The Heist Snapl │ │ │ │ │ + 0x011496a0 65740a3d 3d3d3d3d 3d3d3d3d 3d3d3d3d et.============= │ │ │ │ │ + 0x011496b0 3d3d3d3d 0a0a5468 65206173 74757465 ====..The astute │ │ │ │ │ + 0x011496c0 20726561 64657220 6d696768 74206173 reader might as │ │ │ │ │ + 0x011496d0 6b207768 79207468 65726520 6973206e k why there is n │ │ │ │ │ + 0x011496e0 6f206077 69746820 68656973 74602069 o `with heist` i │ │ │ │ │ + 0x011496f0 6e206672 6f6e7420 6f662074 68652063 n front of the c │ │ │ │ │ + 0x01149700 616c6c0a 746f2060 68656973 74536572 all.to `heistSer │ │ │ │ │ + 0x01149710 7665602e 2020416e 6420696e 64656564 ve`. And indeed │ │ │ │ │ + 0x01149720 2c207468 61742077 6f756c64 206e6f72 , that would nor │ │ │ │ │ + 0x01149730 6d616c6c 79206265 20746865 20636173 mally be the cas │ │ │ │ │ + 0x01149740 652e2020 42757420 77652064 65636964 e. But we decid │ │ │ │ │ + 0x01149750 65640a74 68617420 616e2061 70706c69 ed.that an appli │ │ │ │ │ + 0x01149760 63617469 6f6e2077 696c6c20 6e657665 cation will neve │ │ │ │ │ + 0x01149770 72206e65 6564206d 6f726520 7468616e r need more than │ │ │ │ │ + 0x01149780 206f6e65 20696e73 74616e63 65206f66 one instance of │ │ │ │ │ + 0x01149790 20612048 65697374 20736e61 706c6574 a Heist snaplet │ │ │ │ │ + 0x011497a0 2e0a536f 20776520 70726f76 69646564 ..So we provided │ │ │ │ │ + 0x011497b0 20612074 79706520 636c6173 73206361 a type class ca │ │ │ │ │ + 0x011497c0 6c6c6564 20604861 73486569 73746020 lled `HasHeist` │ │ │ │ │ + 0x011497d0 74686174 20616c6c 6f777320 616e2061 that allows an a │ │ │ │ │ + 0x011497e0 70706c69 63617469 6f6e2074 6f0a6465 pplication to.de │ │ │ │ │ + 0x011497f0 66696e65 20746865 20676c6f 62616c20 fine the global │ │ │ │ │ + 0x01149800 72656665 72656e63 6520746f 20697473 reference to its │ │ │ │ │ + 0x01149810 20486569 73742073 6e61706c 65742062 Heist snaplet b │ │ │ │ │ + 0x01149820 79207772 6974696e 67206120 60486173 y writing a `Has │ │ │ │ │ + 0x01149830 48656973 74600a69 6e737461 6e63652e Heist`.instance. │ │ │ │ │ + 0x01149840 2020496e 20746869 73206578 616d706c In this exampl │ │ │ │ │ + 0x01149850 65207765 20646566 696e6520 74686520 e we define the │ │ │ │ │ + 0x01149860 696e7374 616e6365 20617320 666f6c6c instance as foll │ │ │ │ │ + 0x01149870 6f77733a 0a0a3e20 696e7374 616e6365 ows:..> instance │ │ │ │ │ + 0x01149880 20486173 48656973 74204170 70207768 HasHeist App wh │ │ │ │ │ + 0x01149890 65726520 68656973 744c656e 73203d20 ere heistLens = │ │ │ │ │ + 0x011498a0 73756253 6e61706c 65742068 65697374 subSnaplet heist │ │ │ │ │ + 0x011498b0 0a0a4e6f 7720616c 6c207765 206e6565 ..Now all we nee │ │ │ │ │ + 0x011498c0 64206973 20612073 696d706c 65206d61 d is a simple ma │ │ │ │ │ + 0x011498d0 696e2066 756e6374 696f6e20 746f2073 in function to s │ │ │ │ │ + 0x011498e0 65727665 206f7572 20617070 6c696361 erve our applica │ │ │ │ │ + 0x011498f0 74696f6e 2e0a0a3e 206d6169 6e203a3a tion...> main :: │ │ │ │ │ + 0x01149900 20494f20 28290a3e 206d6169 6e203d20 IO ().> main = │ │ │ │ │ + 0x01149910 73657276 65536e61 706c6574 20646566 serveSnaplet def │ │ │ │ │ + 0x01149920 61756c74 436f6e66 69672061 7070496e aultConfig appIn │ │ │ │ │ + 0x01149930 69740a0a 54686973 20636f6d 706c6574 it..This complet │ │ │ │ │ + 0x01149940 65732061 2066756c 6c20776f 726b696e es a full workin │ │ │ │ │ + 0x01149950 67206170 706c6963 6174696f 6e2e2020 g application. │ │ │ │ │ + 0x01149960 57652064 6964206c 65617665 206f7574 We did leave out │ │ │ │ │ + 0x01149970 2061206c 6974746c 65206475 6d6d790a a little dummy. │ │ │ │ │ + 0x01149980 636f6465 20666f72 20746865 20466f6f code for the Foo │ │ │ │ │ + 0x01149990 20616e64 20426172 20736e61 706c6574 and Bar snaplet │ │ │ │ │ + 0x011499a0 732e2020 54686973 20636f64 65206973 s. This code is │ │ │ │ │ + 0x011499b0 20696e63 6c756465 6420696e 20506172 included in Par │ │ │ │ │ + 0x011499c0 74322e68 732e2020 466f720a 6d6f7265 t2.hs. For.more │ │ │ │ │ + 0x011499d0 20696e66 6f726d61 74696f6e 206c6f6f information loo │ │ │ │ │ + 0x011499e0 6b20696e 206f7572 205b4150 490a646f k in our [API.do │ │ │ │ │ + 0x011499f0 63756d65 6e746174 696f6e5d 28687474 cumentation](htt │ │ │ │ │ + 0x01149a00 703a2f2f 6861636b 6167652e 6861736b p://hackage.hask │ │ │ │ │ + 0x01149a10 656c6c2e 6f72672f 7061636b 6167652f ell.org/package/ │ │ │ │ │ + 0x01149a20 736e6170 292c2073 70656369 66696361 snap), specifica │ │ │ │ │ + 0x01149a30 6c6c7920 7468650a 536e6170 2e536e61 lly the.Snap.Sna │ │ │ │ │ + 0x01149a40 706c6574 206d6f64 756c652e 20204e6f plet module. No │ │ │ │ │ + 0x01149a50 20726561 6c6c792c 20746861 74207761 really, that wa │ │ │ │ │ + 0x01149a60 736e2774 2061206a 6f6b652e 20205468 sn't a joke. Th │ │ │ │ │ + 0x01149a70 65204150 4920646f 63732061 72652077 e API docs are w │ │ │ │ │ + 0x01149a80 72697474 656e0a61 73207072 6f73652e ritten.as prose. │ │ │ │ │ + 0x01149a90 20205468 65792073 686f756c 64206265 They should be │ │ │ │ │ + 0x01149aa0 20766572 79206561 73792074 6f207265 very easy to re │ │ │ │ │ + 0x01149ab0 61642c20 7768696c 65206861 76696e67 ad, while having │ │ │ │ │ + 0x01149ac0 20746865 2062656e 65666974 206f660a the benefit of. │ │ │ │ │ + 0x01149ad0 696e636c 7564696e 6720616c 6c207468 including all th │ │ │ │ │ + 0x01149ae0 65206163 7475616c 20747970 65207369 e actual type si │ │ │ │ │ + 0x01149af0 676e6174 75726573 2e0a0a46 696c6573 gnatures...Files │ │ │ │ │ + 0x01149b00 79737465 6d204461 74612061 6e642041 ystem Data and A │ │ │ │ │ + 0x01149b10 75746f6d 61746963 20496e73 74616c6c utomatic Install │ │ │ │ │ + 0x01149b20 6174696f 6e0a3d3d 3d3d3d3d 3d3d3d3d ation.========== │ │ │ │ │ + 0x01149b30 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================ │ │ │ │ │ + 0x01149b40 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================ │ │ │ │ │ + 0x01149b50 0a0a536f 6d652073 6e61706c 65747320 ..Some snaplets │ │ │ │ │ + 0x01149b60 77696c6c 20686176 65206461 74612073 will have data s │ │ │ │ │ + 0x01149b70 746f7265 6420696e 20746865 2066696c tored in the fil │ │ │ │ │ + 0x01149b80 65737973 74656d20 74686174 2073686f esystem that sho │ │ │ │ │ + 0x01149b90 756c6420 62652069 6e737461 6c6c6564 uld be installed │ │ │ │ │ + 0x01149ba0 0a696e74 6f207468 65206469 72656374 .into the direct │ │ │ │ │ + 0x01149bb0 6f727920 6f662061 6e792070 726f6a65 ory of any proje │ │ │ │ │ + 0x01149bc0 63742074 68617420 75736573 2069742e ct that uses it. │ │ │ │ │ + 0x01149bd0 20204865 72652773 20616e20 6578616d Here's an exam │ │ │ │ │ + 0x01149be0 706c6520 6f662077 68617420 610a736e ple of what a.sn │ │ │ │ │ + 0x01149bf0 61706c65 74206669 6c657379 7374656d aplet filesystem │ │ │ │ │ + 0x01149c00 206c6179 6f757420 6d696768 74206c6f layout might lo │ │ │ │ │ + 0x01149c10 6f6b206c 696b653a 0a0a2020 2020666f ok like:.. fo │ │ │ │ │ + 0x01149c20 6f736e61 706c6574 2f0a2020 20202020 osnaplet/. │ │ │ │ │ + 0x01149c30 7c2d2d20 2a646576 656c2e63 66672a0a |-- *devel.cfg*. │ │ │ │ │ + 0x01149c40 20202020 20207c2d 2d206462 2e636667 |-- db.cfg │ │ │ │ │ + 0x01149c50 0a202020 2020207c 2d2d2070 75626c69 . |-- publi │ │ │ │ │ + 0x01149c60 632f0a20 20202020 20202020 207c2d2d c/. |-- │ │ │ │ │ + 0x01149c70 20737479 6c657368 65657473 2f0a2020 stylesheets/. │ │ │ │ │ + 0x01149c80 20202020 20202020 7c2d2d20 696d6167 |-- imag │ │ │ │ │ + 0x01149c90 65732f0a 20202020 20202020 20207c2d es/. |- │ │ │ │ │ + 0x01149ca0 2d206a73 2f0a2020 20202020 7c2d2d20 - js/. |-- │ │ │ │ │ + 0x01149cb0 2a736e61 706c6574 732f2a0a 20202020 *snaplets/*. │ │ │ │ │ + 0x01149cc0 20202020 20207c2d 2d202a68 65697374 |-- *heist │ │ │ │ │ + 0x01149cd0 2f2a0a20 20202020 20202020 20202020 /*. │ │ │ │ │ + 0x01149ce0 207c2d2d 2074656d 706c6174 65732f0a |-- templates/. │ │ │ │ │ + 0x01149cf0 20202020 20202020 20207c2d 2d207375 |-- su │ │ │ │ │ + 0x01149d00 62736e61 706c6574 312f0a20 20202020 bsnaplet1/. │ │ │ │ │ + 0x01149d10 20202020 207c2d2d 20737562 736e6170 |-- subsnap │ │ │ │ │ + 0x01149d20 6c657432 2f0a0a4f 6e6c7920 74686520 let2/..Only the │ │ │ │ │ + 0x01149d30 73746172 72656420 6974656d 73206172 starred items ar │ │ │ │ │ + 0x01149d40 65206163 7475616c 6c792065 6e666f72 e actually enfor │ │ │ │ │ + 0x01149d50 63656420 62792063 75727265 6e742063 ced by current c │ │ │ │ │ + 0x01149d60 6f64652c 20627574 20776520 77616e74 ode, but we want │ │ │ │ │ + 0x01149d70 20746f0a 65737461 626c6973 68207468 to.establish th │ │ │ │ │ + 0x01149d80 65206f74 68657273 20617320 6120636f e others as a co │ │ │ │ │ + 0x01149d90 6e76656e 74696f6e 2e202054 68652066 nvention. The f │ │ │ │ │ + 0x01149da0 696c6520 64657665 6c2e6366 67206973 ile devel.cfg is │ │ │ │ │ + 0x01149db0 20617574 6f6d6174 6963616c 6c790a72 automatically.r │ │ │ │ │ + 0x01149dc0 65616420 62792074 68652073 6e61706c ead by the snapl │ │ │ │ │ + 0x01149dd0 65742069 6e667261 73747275 63747572 et infrastructur │ │ │ │ │ + 0x01149de0 652e2020 49742069 73206176 61696c61 e. It is availa │ │ │ │ │ + 0x01149df0 626c6520 746f2079 6f752076 69612074 ble to you via t │ │ │ │ │ + 0x01149e00 68650a60 67657453 6e61706c 65745573 he.`getSnapletUs │ │ │ │ │ + 0x01149e10 6572436f 6e666967 60206675 6e637469 erConfig` functi │ │ │ │ │ + 0x01149e20 6f6e2e20 20436f6e 66696720 66696c65 on. Config file │ │ │ │ │ + 0x01149e30 73207573 65207468 6520666f 726d6174 s use the format │ │ │ │ │ + 0x01149e40 20646566 696e6564 20627920 42727961 defined by Brya │ │ │ │ │ + 0x01149e50 6e0a4f27 53756c6c 6976616e 27732065 n.O'Sullivan's e │ │ │ │ │ + 0x01149e60 7863656c 6c656e74 205b636f 6e666967 xcellent [config │ │ │ │ │ + 0x01149e70 75726174 6f720a70 61636b61 67655d28 urator.package]( │ │ │ │ │ + 0x01149e80 68747470 3a2f2f68 61636b61 67652e68 http://hackage.h │ │ │ │ │ + 0x01149e90 61736b65 6c6c2e6f 72672f70 61636b61 askell.org/packa │ │ │ │ │ + 0x01149ea0 67652f63 6f6e6669 67757261 746f7229 ge/configurator) │ │ │ │ │ + 0x01149eb0 2e202049 6e207468 69732065 78616d70 . In this examp │ │ │ │ │ + 0x01149ec0 6c652c0a 74686520 75736572 20686173 le,.the user has │ │ │ │ │ + 0x01149ed0 2063686f 73656e20 746f2070 75742064 chosen to put d │ │ │ │ │ + 0x01149ee0 6220636f 6e666967 20697465 6d732069 b config items i │ │ │ │ │ + 0x01149ef0 6e206120 73657061 72617465 2066696c n a separate fil │ │ │ │ │ + 0x01149f00 6520616e 64207573 650a636f 6e666967 e and use.config │ │ │ │ │ + 0x01149f10 75726174 6f722773 20696d70 6f727420 urator's import │ │ │ │ │ + 0x01149f20 66756e63 74696f6e 616c6974 7920746f functionality to │ │ │ │ │ + 0x01149f30 20696e63 6c756465 20697420 696e2064 include it in d │ │ │ │ │ + 0x01149f40 6576656c 2e636667 2e202049 660a666f evel.cfg. If.fo │ │ │ │ │ + 0x01149f50 6f736e61 706c6574 20757365 7320606e osnaplet uses `n │ │ │ │ │ + 0x01149f60 65737453 6e61706c 65746020 6f722060 estSnaplet` or ` │ │ │ │ │ + 0x01149f70 656d6265 64536e61 706c6574 6020746f embedSnaplet` to │ │ │ │ │ + 0x01149f80 20696e63 6c756465 20616e79 206f7468 include any oth │ │ │ │ │ + 0x01149f90 65722073 6e61706c 6574732c 0a746865 er snaplets,.the │ │ │ │ │ + 0x01149fa0 6e206669 6c657379 7374656d 20646174 n filesystem dat │ │ │ │ │ + 0x01149fb0 61206465 66696e65 64206279 2074686f a defined by tho │ │ │ │ │ + 0x01149fc0 73652073 6e61706c 65747320 77696c6c se snaplets will │ │ │ │ │ + 0x01149fd0 20626520 696e636c 75646564 20696e0a be included in. │ │ │ │ │ + 0x01149fe0 73756264 69726563 746f7269 65732075 subdirectories u │ │ │ │ │ + 0x01149ff0 6e646572 20746865 2060736e 61706c65 nder the `snaple │ │ │ │ │ + 0x0114a000 74732f60 20646972 6563746f 72792e0a ts/` directory.. │ │ │ │ │ + 0x0114a010 0a536f20 686f7720 646f2079 6f752074 .So how do you t │ │ │ │ │ + 0x0114a020 656c6c20 74686520 736e6170 6c657420 ell the snaplet │ │ │ │ │ + 0x0114a030 696e6672 61737472 75637475 72652074 infrastructure t │ │ │ │ │ + 0x0114a040 68617420 796f7572 20736e61 706c6574 hat your snaplet │ │ │ │ │ + 0x0114a050 20686173 2066696c 65737973 74656d0a has filesystem. │ │ │ │ │ + 0x0114a060 64617461 20746861 74207368 6f756c64 data that should │ │ │ │ │ + 0x0114a070 20626520 696e7374 616c6c65 643f2020 be installed? │ │ │ │ │ + 0x0114a080 4c6f6f6b 20617420 74686520 64656669 Look at the defi │ │ │ │ │ + 0x0114a090 6e697469 6f6e206f 66206170 70496e69 nition of appIni │ │ │ │ │ + 0x0114a0a0 74206162 6f76652e 20205468 650a7468 t above. The.th │ │ │ │ │ + 0x0114a0b0 69726420 61726775 6d656e74 20746f20 ird argument to │ │ │ │ │ + 0x0114a0c0 74686520 6d616b65 536e6170 6c657420 the makeSnaplet │ │ │ │ │ + 0x0114a0d0 66756e63 74696f6e 20697320 77686572 function is wher │ │ │ │ │ + 0x0114a0e0 65207765 20737065 63696679 20746865 e we specify the │ │ │ │ │ + 0x0114a0f0 2066696c 65737973 74656d0a 64697265 filesystem.dire │ │ │ │ │ + 0x0114a100 63746f72 79207468 61742073 686f756c ctory that shoul │ │ │ │ │ + 0x0114a110 64206265 20696e73 74616c6c 65642e20 d be installed. │ │ │ │ │ + 0x0114a120 20546861 74206172 67756d65 6e742068 That argument h │ │ │ │ │ + 0x0114a130 61732074 68652074 79706520 604d6179 as the type `May │ │ │ │ │ + 0x0114a140 62652028 494f0a46 696c6550 61746829 be (IO.FilePath) │ │ │ │ │ + 0x0114a150 602e2020 496e2074 68697320 63617365 `. In this case │ │ │ │ │ + 0x0114a160 20776520 75736564 20604e6f 7468696e we used `Nothin │ │ │ │ │ + 0x0114a170 67602062 65636175 7365206f 75722073 g` because our s │ │ │ │ │ + 0x0114a180 696d706c 65206578 616d706c 6520646f imple example do │ │ │ │ │ + 0x0114a190 65736e27 740a6861 76652061 6e792066 esn't.have any f │ │ │ │ │ + 0x0114a1a0 696c6573 79737465 6d206461 74612e20 ilesystem data. │ │ │ │ │ + 0x0114a1b0 20417320 616e2065 78616d70 6c652c20 As an example, │ │ │ │ │ + 0x0114a1c0 6c657427 73207361 7920796f 75206172 let's say you ar │ │ │ │ │ + 0x0114a1d0 65206372 65617469 6e672061 20736e61 e creating a sna │ │ │ │ │ + 0x0114a1e0 706c6574 0a63616c 6c656420 6b696c6c plet.called kill │ │ │ │ │ + 0x0114a1f0 65726170 70207468 61742077 696c6c20 erapp that will │ │ │ │ │ + 0x0114a200 62652064 69737472 69627574 65642061 be distributed a │ │ │ │ │ + 0x0114a210 73206120 6861636b 61676520 70726f6a s a hackage proj │ │ │ │ │ + 0x0114a220 65637420 63616c6c 65640a73 6e61706c ect called.snapl │ │ │ │ │ + 0x0114a230 65742d6b 696c6c65 72617070 2e202059 et-killerapp. Y │ │ │ │ │ + 0x0114a240 6f757220 70726f6a 65637420 64697265 our project dire │ │ │ │ │ + 0x0114a250 63746f72 79207374 72756374 75726520 ctory structure │ │ │ │ │ + 0x0114a260 77696c6c 206c6f6f 6b20736f 6d657468 will look someth │ │ │ │ │ + 0x0114a270 696e6720 6c696b65 0a746869 733a0a0a ing like.this:.. │ │ │ │ │ + 0x0114a280 20202020 736e6170 6c65742d 6b696c6c snaplet-kill │ │ │ │ │ + 0x0114a290 65726170 702f0a20 20202020 207c2d2d erapp/. |-- │ │ │ │ │ + 0x0114a2a0 20726573 6f757263 65732f0a 20202020 resources/. │ │ │ │ │ + 0x0114a2b0 20207c2d 2d20736e 61706c65 742d6b69 |-- snaplet-ki │ │ │ │ │ + 0x0114a2c0 6c6c6572 6170702e 63616261 6c0a2020 llerapp.cabal. │ │ │ │ │ + 0x0114a2d0 20202020 7c2d2d20 7372632f 0a0a416c |-- src/..Al │ │ │ │ │ + 0x0114a2e0 6c206f66 20746865 2066696c 65732061 l of the files a │ │ │ │ │ + 0x0114a2f0 6e642064 69726563 746f7269 6573206c nd directories l │ │ │ │ │ + 0x0114a300 69737465 64206162 6f766520 756e6465 isted above unde │ │ │ │ │ + 0x0114a310 7220666f 6f736e61 706c6574 2f207769 r foosnaplet/ wi │ │ │ │ │ + 0x0114a320 6c6c2062 6520696e 0a726573 6f757263 ll be in.resourc │ │ │ │ │ + 0x0114a330 65732f2e 2020536f 6d657768 65726520 es/. Somewhere │ │ │ │ │ + 0x0114a340 696e2074 68652063 6f646520 796f7520 in the code you │ │ │ │ │ + 0x0114a350 77696c6c 20646566 696e6520 616e2069 will define an i │ │ │ │ │ + 0x0114a360 6e697469 616c697a 65722066 6f722074 nitializer for t │ │ │ │ │ + 0x0114a370 68650a73 6e61706c 65742074 68617420 he.snaplet that │ │ │ │ │ + 0x0114a380 77696c6c 206c6f6f 6b206c69 6b652074 will look like t │ │ │ │ │ + 0x0114a390 6869733a 0a0a2020 20206b69 6c6c6572 his:.. killer │ │ │ │ │ + 0x0114a3a0 496e6974 203d206d 616b6553 6e61706c Init = makeSnapl │ │ │ │ │ + 0x0114a3b0 65742022 6b696c6c 65726170 70222022 et "killerapp" " │ │ │ │ │ + 0x0114a3c0 34322220 284a7573 74206461 74614469 42" (Just dataDi │ │ │ │ │ + 0x0114a3d0 72292024 20646f0a 0a546865 20707269 r) $ do..The pri │ │ │ │ │ + 0x0114a3e0 6d617279 2066756e 6374696f 6e206f66 mary function of │ │ │ │ │ + 0x0114a3f0 20436162 616c2069 7320746f 20696e73 Cabal is to ins │ │ │ │ │ + 0x0114a400 74616c6c 20636f64 652e2020 42757420 tall code. But │ │ │ │ │ + 0x0114a410 69742068 61732074 68652061 62696c69 it has the abili │ │ │ │ │ + 0x0114a420 74792074 6f0a696e 7374616c 6c206461 ty to.install da │ │ │ │ │ + 0x0114a430 74612066 696c6573 20616e64 2070726f ta files and pro │ │ │ │ │ + 0x0114a440 76696465 73206120 66756e63 74696f6e vides a function │ │ │ │ │ + 0x0114a450 2063616c 6c656420 60676574 44617461 called `getData │ │ │ │ │ + 0x0114a460 44697260 20666f72 20726574 72696576 Dir` for retriev │ │ │ │ │ + 0x0114a470 696e670a 74686520 6c6f6361 74696f6e ing.the location │ │ │ │ │ + 0x0114a480 206f6620 74686573 65206669 6c65732e of these files. │ │ │ │ │ + 0x0114a490 20205369 6e636520 69742072 65747572 Since it retur │ │ │ │ │ + 0x0114a4a0 6e732061 20646966 66657265 6e742072 ns a different r │ │ │ │ │ + 0x0114a4b0 6573756c 74206465 70656e64 696e6720 esult depending │ │ │ │ │ + 0x0114a4c0 6f6e0a77 68617420 6d616368 696e6520 on.what machine │ │ │ │ │ + 0x0114a4d0 796f7527 72652075 73696e67 2c207468 you're using, th │ │ │ │ │ + 0x0114a4e0 65207468 69726420 61726775 6d656e74 e third argument │ │ │ │ │ + 0x0114a4f0 20746f20 606d616b 65536e61 706c6574 to `makeSnaplet │ │ │ │ │ + 0x0114a500 60206861 7320746f 20626520 604d6179 ` has to be `May │ │ │ │ │ + 0x0114a510 62650a28 494f2046 696c6550 61746829 be.(IO FilePath) │ │ │ │ │ + 0x0114a520 6020696e 73746561 64206f66 20746865 ` instead of the │ │ │ │ │ + 0x0114a530 206d6f72 65206e61 74757261 6c207075 more natural pu │ │ │ │ │ + 0x0114a540 72652076 65727369 6f6e2e20 20546f20 re version. To │ │ │ │ │ + 0x0114a550 6d616b65 20746869 6e677320 6d6f7265 make things more │ │ │ │ │ + 0x0114a560 0a6f7267 616e697a 65642c20 77652075 .organized, we u │ │ │ │ │ + 0x0114a570 73652074 68652063 6f6e7665 6e74696f se the conventio │ │ │ │ │ + 0x0114a580 6e206f66 20707574 74696e67 20616c6c n of putting all │ │ │ │ │ + 0x0114a590 20796f75 7220736e 61706c65 74277320 your snaplet's │ │ │ │ │ + 0x0114a5a0 64617461 2066696c 65732069 6e20610a data files in a. │ │ │ │ │ + 0x0114a5b0 73756264 69726563 746f7279 2063616c subdirectory cal │ │ │ │ │ + 0x0114a5c0 6c656420 7265736f 75726365 732e2020 led resources. │ │ │ │ │ + 0x0114a5d0 536f2077 65206e65 65642074 6f206372 So we need to cr │ │ │ │ │ + 0x0114a5e0 65617465 20612073 6d616c6c 2066756e eate a small fun │ │ │ │ │ + 0x0114a5f0 6374696f 6e207468 61740a61 7070656e ction that.appen │ │ │ │ │ + 0x0114a600 64732060 2f726573 6f757263 65736020 ds `/resources` │ │ │ │ │ + 0x0114a610 746f2074 68652072 6573756c 74206f66 to the result of │ │ │ │ │ + 0x0114a620 20606765 74446174 61446972 602e0a0a `getDataDir`... │ │ │ │ │ + 0x0114a630 20202020 696d706f 72742050 61746873 import Paths │ │ │ │ │ + 0x0114a640 5f736e61 706c6574 5f6b696c 6c657261 _snaplet_killera │ │ │ │ │ + 0x0114a650 70700a20 20202064 61746144 6972203d pp. dataDir = │ │ │ │ │ + 0x0114a660 206c6966 744d2028 2b2b222f 7265736f liftM (++"/reso │ │ │ │ │ + 0x0114a670 75726365 73222920 67657444 61746144 urces") getDataD │ │ │ │ │ + 0x0114a680 69720a0a 4966206f 75722070 726f6a65 ir..If our proje │ │ │ │ │ + 0x0114a690 63742069 73206e61 6d656420 736e6170 ct is named snap │ │ │ │ │ + 0x0114a6a0 6c65742d 6b696c6c 65726170 702c2074 let-killerapp, t │ │ │ │ │ + 0x0114a6b0 68652060 67657444 61746144 69726020 he `getDataDir` │ │ │ │ │ + 0x0114a6c0 66756e63 74696f6e 2069730a 64656669 function is.defi │ │ │ │ │ + 0x0114a6d0 6e656420 696e2074 6865206d 6f64756c ned in the modul │ │ │ │ │ + 0x0114a6e0 65205061 7468735f 736e6170 6c65745f e Paths_snaplet_ │ │ │ │ │ + 0x0114a6f0 6b696c6c 65726170 702c2077 68696368 killerapp, which │ │ │ │ │ + 0x0114a700 20776520 68617665 20746f20 696d706f we have to impo │ │ │ │ │ + 0x0114a710 72742e20 20546f0a 6d616b65 20657665 rt. To.make eve │ │ │ │ │ + 0x0114a720 72797468 696e6720 776f726b 2c20796f rything work, yo │ │ │ │ │ + 0x0114a730 75206861 76652074 6f207465 6c6c2043 u have to tell C │ │ │ │ │ + 0x0114a740 6162616c 2061626f 75742079 6f757220 abal about your │ │ │ │ │ + 0x0114a750 64617461 2066696c 65732062 790a696e data files by.in │ │ │ │ │ + 0x0114a760 636c7564 696e6720 61207365 6374696f cluding a sectio │ │ │ │ │ + 0x0114a770 6e206c69 6b652074 68652066 6f6c6c6f n like the follo │ │ │ │ │ + 0x0114a780 77696e67 20696e20 736e6170 6c65742d wing in snaplet- │ │ │ │ │ + 0x0114a790 6b696c6c 65726170 702e6361 62616c3a killerapp.cabal: │ │ │ │ │ + 0x0114a7a0 0a0a2020 20206461 74612d66 696c6573 .. data-files │ │ │ │ │ + 0x0114a7b0 3a0a2020 20202020 7265736f 75726365 :. resource │ │ │ │ │ + 0x0114a7c0 732f6465 76656c2e 6366672c 0a202020 s/devel.cfg,. │ │ │ │ │ + 0x0114a7d0 20202072 65736f75 72636573 2f707562 resources/pub │ │ │ │ │ + 0x0114a7e0 6c69632f 7374796c 65736865 6574732f lic/stylesheets/ │ │ │ │ │ + 0x0114a7f0 7374796c 652e6373 732c0a20 20202020 style.css,. │ │ │ │ │ + 0x0114a800 20726573 6f757263 65732f73 6e61706c resources/snapl │ │ │ │ │ + 0x0114a810 6574732f 68656973 742f7465 6d706c61 ets/heist/templa │ │ │ │ │ + 0x0114a820 7465732f 70616765 2e74706c 0a0a4e6f tes/page.tpl..No │ │ │ │ │ + 0x0114a830 77207768 656e6576 65722079 6f757220 w whenever your │ │ │ │ │ + 0x0114a840 736e6170 6c657420 69732075 7365642c snaplet is used, │ │ │ │ │ + 0x0114a850 20697473 2066696c 65737973 74656d20 its filesystem │ │ │ │ │ + 0x0114a860 64617461 2077696c 6c206265 20617574 data will be aut │ │ │ │ │ + 0x0114a870 6f6d6167 6963616c 6c790a63 6f706965 omagically.copie │ │ │ │ │ + 0x0114a880 6420696e 746f2074 6865206c 6f63616c d into the local │ │ │ │ │ + 0x0114a890 2070726f 6a656374 20746861 74206973 project that is │ │ │ │ │ + 0x0114a8a0 20757369 6e672069 742c2077 68656e65 using it, whene │ │ │ │ │ + 0x0114a8b0 76657220 74686520 6170706c 69636174 ver the applicat │ │ │ │ │ + 0x0114a8c0 696f6e20 69730a72 756e2061 6e642069 ion is.run and i │ │ │ │ │ + 0x0114a8d0 74207365 65732074 68617420 74686520 t sees that the │ │ │ │ │ + 0x0114a8e0 736e6170 6c657427 73206469 72656374 snaplet's direct │ │ │ │ │ + 0x0114a8f0 6f727920 646f6573 206e6f74 20616c72 ory does not alr │ │ │ │ │ + 0x0114a900 65616479 20657869 73742e20 20496620 eady exist. If │ │ │ │ │ + 0x0114a910 7468650a 75736572 20757067 72616465 the.user upgrade │ │ │ │ │ + 0x0114a920 7320746f 2061206e 65772076 65727369 s to a new versi │ │ │ │ │ + 0x0114a930 6f6e206f 66207468 6520736e 61706c65 on of the snaple │ │ │ │ │ + 0x0114a940 7420616e 64207468 65206e65 77207665 t and the new ve │ │ │ │ │ + 0x0114a950 7273696f 6e206d61 64652063 68616e67 rsion made chang │ │ │ │ │ + 0x0114a960 65730a74 6f207468 65206669 6c657379 es.to the filesy │ │ │ │ │ + 0x0114a970 7374656d 20726573 6f757263 65732c20 stem resources, │ │ │ │ │ + 0x0114a980 74686f73 65207265 736f7572 63657320 those resources │ │ │ │ │ + 0x0114a990 77696c6c 204e4f54 20626520 6175746f will NOT be auto │ │ │ │ │ + 0x0114a9a0 6d617469 63616c6c 7920636f 70696564 matically copied │ │ │ │ │ + 0x0114a9b0 0a696e20 62792064 65666175 6c742e20 .in by default. │ │ │ │ │ + 0x0114a9c0 20526573 6f757263 6520696e 7374616c Resource instal │ │ │ │ │ + 0x0114a9d0 6c617469 6f6e202a 6f6e6c79 2a206861 lation *only* ha │ │ │ │ │ + 0x0114a9e0 7070656e 73207768 656e2074 68652060 ppens when the ` │ │ │ │ │ + 0x0114a9f0 736e6170 6c657473 2f666f6f 600a6469 snaplets/foo`.di │ │ │ │ │ + 0x0114aa00 72656374 6f727920 646f6573 206e6f74 rectory does not │ │ │ │ │ + 0x0114aa10 20657869 73742e20 20496620 796f7520 exist. If you │ │ │ │ │ + 0x0114aa20 77616e74 20746f20 67657420 74686520 want to get the │ │ │ │ │ + 0x0114aa30 6c617465 73742076 65727369 6f6e206f latest version o │ │ │ │ │ + 0x0114aa40 66207468 650a6669 6c657379 7374656d f the.filesystem │ │ │ │ │ + 0x0114aa50 20726573 6f757263 65732c20 72656d6f resources, remo │ │ │ │ │ + 0x0114aa60 76652074 68652060 736e6170 6c657473 ve the `snaplets │ │ │ │ │ + 0x0114aa70 2f666f6f 60206469 72656374 6f72792c /foo` directory, │ │ │ │ │ + 0x0114aa80 20616e64 20726573 74617274 20796f75 and restart you │ │ │ │ │ + 0x0114aa90 720a6170 702e0a00 2e2f7372 632f5475 r.app..../src/Tu │ │ │ │ │ + 0x0114aaa0 746f7269 616c2e6c 6873003e 207b2d23 torial.lhs.> {-# │ │ │ │ │ + 0x0114aab0 204c414e 47554147 45204f76 65726c6f LANGUAGE Overlo │ │ │ │ │ + 0x0114aac0 61646564 53747269 6e677320 232d7d0a adedStrings #-}. │ │ │ │ │ + 0x0114aad0 3e206d6f 64756c65 20506172 74322077 > module Part2 w │ │ │ │ │ + 0x0114aae0 68657265 0a0a3e20 696d706f 72742020 here..> import │ │ │ │ │ + 0x0114aaf0 20202020 20202020 20536e61 702e536e Snap.Sn │ │ │ │ │ + 0x0114ab00 61706c65 740a0a3e 20646174 6120466f aplet..> data Fo │ │ │ │ │ + 0x0114ab10 6f203d20 466f6f0a 3e0a3e20 64617461 o = Foo.>.> data │ │ │ │ │ + 0x0114ab20 20426172 203d2042 61720a3e 0a3e2066 Bar = Bar.>.> f │ │ │ │ │ + 0x0114ab30 6f6f496e 6974203a 3a20536e 61706c65 ooInit :: Snaple │ │ │ │ │ + 0x0114ab40 74496e69 74206220 466f6f0a 3e20666f tInit b Foo.> fo │ │ │ │ │ + 0x0114ab50 6f496e69 74203d20 6d616b65 536e6170 oInit = makeSnap │ │ │ │ │ + 0x0114ab60 6c657420 22666f6f 22202246 6f6f2073 let "foo" "Foo s │ │ │ │ │ + 0x0114ab70 6e61706c 65742220 4e6f7468 696e6720 naplet" Nothing │ │ │ │ │ + 0x0114ab80 2420646f 0a3e2020 20202072 65747572 $ do.> retur │ │ │ │ │ + 0x0114ab90 6e20466f 6f0a3e0a 3e206261 72496e69 n Foo.>.> barIni │ │ │ │ │ + 0x0114aba0 74203a3a 20536e61 706c6574 4c656e73 t :: SnapletLens │ │ │ │ │ + 0x0114abb0 20622046 6f6f202d 3e20536e 61706c65 b Foo -> Snaple │ │ │ │ │ + 0x0114abc0 74496e69 74206220 4261720a 3e206261 tInit b Bar.> ba │ │ │ │ │ + 0x0114abd0 72496e69 74205f68 203d206d 616b6553 rInit _h = makeS │ │ │ │ │ + 0x0114abe0 6e61706c 65742022 62617222 20224261 naplet "bar" "Ba │ │ │ │ │ + 0x0114abf0 7220736e 61706c65 7422204e 6f746869 r snaplet" Nothi │ │ │ │ │ + 0x0114ac00 6e672024 20646f0a 3e202020 20207265 ng $ do.> re │ │ │ │ │ + 0x0114ac10 7475726e 20426172 0a002e2f 7372632f turn Bar.../src/ │ │ │ │ │ + 0x0114ac20 50617274 322e6c68 73004e61 6d653a20 Part2.lhs.Name: │ │ │ │ │ 0x0114ac30 20202020 20202020 20202020 20202070 p │ │ │ │ │ 0x0114ac40 726f6a6e 616d650a 56657273 696f6e3a rojname.Version: │ │ │ │ │ 0x0114ac50 20202020 20202020 20202020 20302e31 0.1 │ │ │ │ │ 0x0114ac60 0a53796e 6f707369 733a2020 20202020 .Synopsis: │ │ │ │ │ 0x0114ac70 20202020 20205072 6f6a6563 74205379 Project Sy │ │ │ │ │ 0x0114ac80 6e6f7073 69732048 6572650a 44657363 nopsis Here.Desc │ │ │ │ │ 0x0114ac90 72697074 696f6e3a 20202020 20202020 ription: │ │ │ │ │ @@ -1217,835 +1217,835 @@ │ │ │ │ │ 0x0114b020 20202020 20202020 202d666e 6f2d7761 -fno-wa │ │ │ │ │ 0x0114b030 726e2d75 6e757365 642d646f 2d62696e rn-unused-do-bin │ │ │ │ │ 0x0114b040 640a2020 656c7365 0a202020 20676863 d. else. ghc │ │ │ │ │ 0x0114b050 2d6f7074 696f6e73 3a202d74 68726561 -options: -threa │ │ │ │ │ 0x0114b060 64656420 2d57616c 6c202d66 7761726e ded -Wall -fwarn │ │ │ │ │ 0x0114b070 2d746162 73202d66 756e626f 782d7374 -tabs -funbox-st │ │ │ │ │ 0x0114b080 72696374 2d666965 6c647320 2d4f320a rict-fields -O2. │ │ │ │ │ - 0x0114b090 007b2d23 204c414e 47554147 45205465 .{-# LANGUAGE Te │ │ │ │ │ - 0x0114b0a0 6d706c61 74654861 736b656c 6c20232d mplateHaskell #- │ │ │ │ │ - 0x0114b0b0 7d0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d }..------------- │ │ │ │ │ + 0x0114b090 007b2d23 204c414e 47554147 45204f76 .{-# LANGUAGE Ov │ │ │ │ │ + 0x0114b0a0 65726c6f 61646564 53747269 6e677320 erloadedStrings │ │ │ │ │ + 0x0114b0b0 232d7d0a 0a2d2d2d 2d2d2d2d 2d2d2d2d #-}..----------- │ │ │ │ │ 0x0114b0c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114b0d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114b0e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114b0f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b100 2d0a2d2d 207c2054 68697320 6d6f6475 -.-- | This modu │ │ │ │ │ - 0x0114b110 6c652064 6566696e 6573206f 75722061 le defines our a │ │ │ │ │ - 0x0114b120 70706c69 63617469 6f6e2773 20737461 pplication's sta │ │ │ │ │ - 0x0114b130 74652074 79706520 616e6420 616e2061 te type and an a │ │ │ │ │ - 0x0114b140 6c696173 20666f72 20697473 0a2d2d20 lias for its.-- │ │ │ │ │ - 0x0114b150 68616e64 6c657220 6d6f6e61 642e0a6d handler monad..m │ │ │ │ │ - 0x0114b160 6f64756c 65204170 706c6963 6174696f odule Applicatio │ │ │ │ │ - 0x0114b170 6e207768 6572650a 0a2d2d2d 2d2d2d2d n where..------- │ │ │ │ │ - 0x0114b180 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b190 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b1a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b1b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b1c0 2d2d2d2d 2d2d2d0a 696d706f 72742043 -------.import C │ │ │ │ │ - 0x0114b1d0 6f6e7472 6f6c2e4c 656e730a 696d706f ontrol.Lens.impo │ │ │ │ │ - 0x0114b1e0 72742053 6e61702e 536e6170 6c65740a rt Snap.Snaplet. │ │ │ │ │ - 0x0114b1f0 696d706f 72742053 6e61702e 536e6170 import Snap.Snap │ │ │ │ │ - 0x0114b200 6c65742e 48656973 740a696d 706f7274 let.Heist.import │ │ │ │ │ - 0x0114b210 20536e61 702e536e 61706c65 742e4175 Snap.Snaplet.Au │ │ │ │ │ - 0x0114b220 74680a69 6d706f72 7420536e 61702e53 th.import Snap.S │ │ │ │ │ - 0x0114b230 6e61706c 65742e53 65737369 6f6e0a0a naplet.Session.. │ │ │ │ │ - 0x0114b240 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b250 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b260 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b270 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b280 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d0a64 --------------.d │ │ │ │ │ - 0x0114b290 61746120 41707020 3d204170 700a2020 ata App = App. │ │ │ │ │ - 0x0114b2a0 20207b20 5f686569 7374203a 3a20536e { _heist :: Sn │ │ │ │ │ - 0x0114b2b0 61706c65 74202848 65697374 20417070 aplet (Heist App │ │ │ │ │ - 0x0114b2c0 290a2020 20202c20 5f736573 73203a3a ). , _sess :: │ │ │ │ │ - 0x0114b2d0 20536e61 706c6574 20536573 73696f6e Snaplet Session │ │ │ │ │ - 0x0114b2e0 4d616e61 6765720a 20202020 2c205f61 Manager. , _a │ │ │ │ │ - 0x0114b2f0 75746820 3a3a2053 6e61706c 65742028 uth :: Snaplet ( │ │ │ │ │ - 0x0114b300 41757468 4d616e61 67657220 41707029 AuthManager App) │ │ │ │ │ - 0x0114b310 0a202020 207d0a0a 6d616b65 4c656e73 . }..makeLens │ │ │ │ │ - 0x0114b320 65732027 27417070 0a0a696e 7374616e es ''App..instan │ │ │ │ │ - 0x0114b330 63652048 61734865 69737420 41707020 ce HasHeist App │ │ │ │ │ - 0x0114b340 77686572 650a2020 20206865 6973744c where. heistL │ │ │ │ │ - 0x0114b350 656e7320 3d207375 62536e61 706c6574 ens = subSnaplet │ │ │ │ │ - 0x0114b360 20686569 73740a0a 0a2d2d2d 2d2d2d2d heist...------- │ │ │ │ │ - 0x0114b370 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b380 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b390 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b3a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b3b0 2d2d2d2d 2d2d2d0a 74797065 20417070 -------.type App │ │ │ │ │ - 0x0114b3c0 48616e64 6c657220 3d204861 6e646c65 Handler = Handle │ │ │ │ │ - 0x0114b3d0 72204170 70204170 700a0a0a 002e2f73 r App App...../s │ │ │ │ │ - 0x0114b3e0 72632f41 70706c69 63617469 6f6e2e68 rc/Application.h │ │ │ │ │ - 0x0114b3f0 73007b2d 23204c41 4e475541 47452043 s.{-# LANGUAGE C │ │ │ │ │ - 0x0114b400 50502020 20202020 20202020 20202023 PP # │ │ │ │ │ - 0x0114b410 2d7d0a7b 2d23204c 414e4755 41474520 -}.{-# LANGUAGE │ │ │ │ │ - 0x0114b420 54656d70 6c617465 4861736b 656c6c20 TemplateHaskell │ │ │ │ │ - 0x0114b430 232d7d0a 0a7b2d0a 0a4e4f54 453a2044 #-}..{-..NOTE: D │ │ │ │ │ - 0x0114b440 6f6e2774 206d6f64 69667920 74686973 on't modify this │ │ │ │ │ - 0x0114b450 2066696c 6520756e 6c657373 20796f75 file unless you │ │ │ │ │ - 0x0114b460 206b6e6f 77207768 61742079 6f752061 know what you a │ │ │ │ │ - 0x0114b470 72652064 6f696e67 2e202049 6620796f re doing. If yo │ │ │ │ │ - 0x0114b480 75206172 650a6e65 7720746f 20736e61 u are.new to sna │ │ │ │ │ - 0x0114b490 702c2073 74617274 20776974 68205369 p, start with Si │ │ │ │ │ - 0x0114b4a0 74652e68 7320616e 64204170 706c6963 te.hs and Applic │ │ │ │ │ - 0x0114b4b0 6174696f 6e2e6873 2e202054 68697320 ation.hs. This │ │ │ │ │ - 0x0114b4c0 66696c65 20636f6e 7461696e 730a626f file contains.bo │ │ │ │ │ - 0x0114b4d0 696c6572 706c6174 65206e65 65646564 ilerplate needed │ │ │ │ │ - 0x0114b4e0 20666f72 2064796e 616d6963 2072656c for dynamic rel │ │ │ │ │ - 0x0114b4f0 6f616469 6e672061 6e642069 73206e6f oading and is no │ │ │ │ │ - 0x0114b500 74206d65 616e7420 666f7220 67656e65 t meant for gene │ │ │ │ │ - 0x0114b510 72616c0a 636f6e73 756d7074 696f6e2e ral.consumption. │ │ │ │ │ - 0x0114b520 0a0a4f63 63617369 6f6e616c 6c792069 ..Occasionally i │ │ │ │ │ - 0x0114b530 66207765 206d6f64 69667920 74686520 f we modify the │ │ │ │ │ - 0x0114b540 77617920 74686520 64796e61 6d696320 way the dynamic │ │ │ │ │ - 0x0114b550 72656c6f 61646572 20776f72 6b732061 reloader works a │ │ │ │ │ - 0x0114b560 6e642079 6f752077 616e7420 746f0a75 nd you want to.u │ │ │ │ │ - 0x0114b570 70677261 64652c20 796f7520 6d696768 pgrade, you migh │ │ │ │ │ - 0x0114b580 74206861 76652074 6f207377 6170206f t have to swap o │ │ │ │ │ - 0x0114b590 75742074 68697320 66696c65 20666f72 ut this file for │ │ │ │ │ - 0x0114b5a0 2061206e 65776572 20766572 73696f6e a newer version │ │ │ │ │ - 0x0114b5b0 2e202042 75742069 6e0a6d6f 73742063 . But in.most c │ │ │ │ │ - 0x0114b5c0 61736573 20796f75 276c6c20 6e657665 ases you'll neve │ │ │ │ │ - 0x0114b5d0 72206e65 65642074 6f206d6f 64696679 r need to modify │ │ │ │ │ - 0x0114b5e0 20746869 7320636f 64652e0a 0a2d7d0a this code...-}. │ │ │ │ │ - 0x0114b5f0 6d6f6475 6c65204d 61696e20 77686572 module Main wher │ │ │ │ │ - 0x0114b600 650a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d e..------------- │ │ │ │ │ - 0x0114b610 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b620 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b630 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b640 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b650 2d0a696d 706f7274 20202020 20202020 -.import │ │ │ │ │ - 0x0114b660 20202043 6f6e7472 6f6c2e45 78636570 Control.Excep │ │ │ │ │ - 0x0114b670 74696f6e 2028536f 6d654578 63657074 tion (SomeExcept │ │ │ │ │ - 0x0114b680 696f6e2c 20747279 290a696d 706f7274 ion, try).import │ │ │ │ │ - 0x0114b690 20717561 6c696669 65642044 6174612e qualified Data. │ │ │ │ │ - 0x0114b6a0 54657874 20617320 540a696d 706f7274 Text as T.import │ │ │ │ │ - 0x0114b6b0 20202020 20202020 20202053 6e61702e Snap. │ │ │ │ │ - 0x0114b6c0 48747470 2e536572 7665720a 696d706f Http.Server.impo │ │ │ │ │ - 0x0114b6d0 72742020 20202020 20202020 20536e61 rt Sna │ │ │ │ │ - 0x0114b6e0 702e536e 61706c65 740a696d 706f7274 p.Snaplet.import │ │ │ │ │ - 0x0114b6f0 20202020 20202020 20202053 6e61702e Snap. │ │ │ │ │ - 0x0114b700 536e6170 6c65742e 436f6e66 69670a69 Snaplet.Config.i │ │ │ │ │ - 0x0114b710 6d706f72 74202020 20202020 20202020 mport │ │ │ │ │ - 0x0114b720 536e6170 2e436f72 650a696d 706f7274 Snap.Core.import │ │ │ │ │ - 0x0114b730 20202020 20202020 20202053 79737465 Syste │ │ │ │ │ - 0x0114b740 6d2e494f 0a696d70 6f727420 20202020 m.IO.import │ │ │ │ │ - 0x0114b750 20202020 20205369 74650a0a 23696664 Site..#ifd │ │ │ │ │ - 0x0114b760 65662044 4556454c 4f504d45 4e540a69 ef DEVELOPMENT.i │ │ │ │ │ - 0x0114b770 6d706f72 74202020 20202020 20202020 mport │ │ │ │ │ - 0x0114b780 536e6170 2e4c6f61 6465722e 44796e61 Snap.Loader.Dyna │ │ │ │ │ - 0x0114b790 6d69630a 23656c73 650a696d 706f7274 mic.#else.import │ │ │ │ │ - 0x0114b7a0 20202020 20202020 20202053 6e61702e Snap. │ │ │ │ │ - 0x0114b7b0 4c6f6164 65722e53 74617469 630a2365 Loader.Static.#e │ │ │ │ │ - 0x0114b7c0 6e646966 0a0a0a2d 2d2d2d2d 2d2d2d2d ndif...--------- │ │ │ │ │ - 0x0114b7d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b7e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b7f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b100 2d2d2d0a 2d2d207c 20546869 73206d6f ---.-- | This mo │ │ │ │ │ + 0x0114b110 64756c65 20697320 77686572 6520616c dule is where al │ │ │ │ │ + 0x0114b120 6c207468 6520726f 75746573 20616e64 l the routes and │ │ │ │ │ + 0x0114b130 2068616e 646c6572 73206172 65206465 handlers are de │ │ │ │ │ + 0x0114b140 66696e65 6420666f 7220796f 75720a2d fined for your.- │ │ │ │ │ + 0x0114b150 2d207369 74652e20 54686520 27617070 - site. The 'app │ │ │ │ │ + 0x0114b160 27206675 6e637469 6f6e2069 73207468 ' function is th │ │ │ │ │ + 0x0114b170 6520696e 69746961 6c697a65 72207468 e initializer th │ │ │ │ │ + 0x0114b180 61742063 6f6d6269 6e657320 65766572 at combines ever │ │ │ │ │ + 0x0114b190 79746869 6e670a2d 2d20746f 67657468 ything.-- togeth │ │ │ │ │ + 0x0114b1a0 65722061 6e642069 73206578 706f7274 er and is export │ │ │ │ │ + 0x0114b1b0 65642062 79207468 6973206d 6f64756c ed by this modul │ │ │ │ │ + 0x0114b1c0 652e0a6d 6f64756c 65205369 74650a20 e..module Site. │ │ │ │ │ + 0x0114b1d0 20282061 70700a20 20292077 68657265 ( app. ) where │ │ │ │ │ + 0x0114b1e0 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ │ + 0x0114b1f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b200 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b210 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b220 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b230 0a696d70 6f727420 20202020 20202020 .import │ │ │ │ │ + 0x0114b240 2020436f 6e74726f 6c2e4170 706c6963 Control.Applic │ │ │ │ │ + 0x0114b250 61746976 650a696d 706f7274 20202020 ative.import │ │ │ │ │ + 0x0114b260 20202020 20202044 6174612e 42797465 Data.Byte │ │ │ │ │ + 0x0114b270 53747269 6e672028 42797465 53747269 String (ByteStri │ │ │ │ │ + 0x0114b280 6e67290a 696d706f 72742020 20202020 ng).import │ │ │ │ │ + 0x0114b290 20202020 20446174 612e4d61 702e5379 Data.Map.Sy │ │ │ │ │ + 0x0114b2a0 6e746178 20282823 2329290a 696d706f ntax ((##)).impo │ │ │ │ │ + 0x0114b2b0 72742071 75616c69 66696564 20446174 rt qualified Dat │ │ │ │ │ + 0x0114b2c0 612e5465 78742061 7320540a 696d706f a.Text as T.impo │ │ │ │ │ + 0x0114b2d0 72742020 20202020 20202020 20536e61 rt Sna │ │ │ │ │ + 0x0114b2e0 702e436f 72650a69 6d706f72 74202020 p.Core.import │ │ │ │ │ + 0x0114b2f0 20202020 20202020 536e6170 2e536e61 Snap.Sna │ │ │ │ │ + 0x0114b300 706c6574 0a696d70 6f727420 20202020 plet.import │ │ │ │ │ + 0x0114b310 20202020 2020536e 61702e53 6e61706c Snap.Snapl │ │ │ │ │ + 0x0114b320 65742e41 7574680a 696d706f 72742020 et.Auth.import │ │ │ │ │ + 0x0114b330 20202020 20202020 20536e61 702e536e Snap.Sn │ │ │ │ │ + 0x0114b340 61706c65 742e4175 74682e42 61636b65 aplet.Auth.Backe │ │ │ │ │ + 0x0114b350 6e64732e 4a736f6e 46696c65 0a696d70 nds.JsonFile.imp │ │ │ │ │ + 0x0114b360 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ │ + 0x0114b370 61702e53 6e61706c 65742e48 65697374 ap.Snaplet.Heist │ │ │ │ │ + 0x0114b380 0a696d70 6f727420 20202020 20202020 .import │ │ │ │ │ + 0x0114b390 2020536e 61702e53 6e61706c 65742e53 Snap.Snaplet.S │ │ │ │ │ + 0x0114b3a0 65737369 6f6e2e42 61636b65 6e64732e ession.Backends. │ │ │ │ │ + 0x0114b3b0 436f6f6b 69655365 7373696f 6e0a696d CookieSession.im │ │ │ │ │ + 0x0114b3c0 706f7274 20202020 20202020 20202053 port S │ │ │ │ │ + 0x0114b3d0 6e61702e 5574696c 2e46696c 65536572 nap.Util.FileSer │ │ │ │ │ + 0x0114b3e0 76650a69 6d706f72 74207175 616c6966 ve.import qualif │ │ │ │ │ + 0x0114b3f0 69656420 48656973 742e496e 74657270 ied Heist.Interp │ │ │ │ │ + 0x0114b400 72657465 64206173 20490a2d 2d2d2d2d reted as I.----- │ │ │ │ │ + 0x0114b410 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b420 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b430 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b440 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b450 2d2d2d2d 2d2d2d2d 2d0a696d 706f7274 ---------.import │ │ │ │ │ + 0x0114b460 20202020 20202020 20202041 70706c69 Appli │ │ │ │ │ + 0x0114b470 63617469 6f6e0a0a 0a2d2d2d 2d2d2d2d cation...------- │ │ │ │ │ + 0x0114b480 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b490 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b4a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b4b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b4c0 2d2d2d2d 2d2d2d0a 2d2d207c 2052656e -------.-- | Ren │ │ │ │ │ + 0x0114b4d0 64657220 6c6f6769 6e20666f 726d0a68 der login form.h │ │ │ │ │ + 0x0114b4e0 616e646c 654c6f67 696e203a 3a204d61 andleLogin :: Ma │ │ │ │ │ + 0x0114b4f0 79626520 542e5465 7874202d 3e204861 ybe T.Text -> Ha │ │ │ │ │ + 0x0114b500 6e646c65 72204170 70202841 7574684d ndler App (AuthM │ │ │ │ │ + 0x0114b510 616e6167 65722041 70702920 28290a68 anager App) ().h │ │ │ │ │ + 0x0114b520 616e646c 654c6f67 696e2061 75746845 andleLogin authE │ │ │ │ │ + 0x0114b530 72726f72 203d2068 65697374 4c6f6361 rror = heistLoca │ │ │ │ │ + 0x0114b540 6c202849 2e62696e 6453706c 69636573 l (I.bindSplices │ │ │ │ │ + 0x0114b550 20657272 73292024 2072656e 64657220 errs) $ render │ │ │ │ │ + 0x0114b560 226c6f67 696e220a 20207768 6572650a "login". where. │ │ │ │ │ + 0x0114b570 20202020 65727273 203d206d 61796265 errs = maybe │ │ │ │ │ + 0x0114b580 206d656d 70747920 73706c69 63652061 mempty splice a │ │ │ │ │ + 0x0114b590 75746845 72726f72 0a202020 2073706c uthError. spl │ │ │ │ │ + 0x0114b5a0 69636520 65727220 3d20226c 6f67696e ice err = "login │ │ │ │ │ + 0x0114b5b0 4572726f 72222023 2320492e 74657874 Error" ## I.text │ │ │ │ │ + 0x0114b5c0 53706c69 63652065 72720a0a 0a2d2d2d Splice err...--- │ │ │ │ │ + 0x0114b5d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b5e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b5f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b600 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b610 2d2d2d2d 2d2d2d2d 2d2d2d0a 2d2d207c -----------.-- | │ │ │ │ │ + 0x0114b620 2048616e 646c6520 6c6f6769 6e207375 Handle login su │ │ │ │ │ + 0x0114b630 626d6974 0a68616e 646c654c 6f67696e bmit.handleLogin │ │ │ │ │ + 0x0114b640 5375626d 6974203a 3a204861 6e646c65 Submit :: Handle │ │ │ │ │ + 0x0114b650 72204170 70202841 7574684d 616e6167 r App (AuthManag │ │ │ │ │ + 0x0114b660 65722041 70702920 28290a68 616e646c er App) ().handl │ │ │ │ │ + 0x0114b670 654c6f67 696e5375 626d6974 203d0a20 eLoginSubmit =. │ │ │ │ │ + 0x0114b680 2020206c 6f67696e 55736572 20226c6f loginUser "lo │ │ │ │ │ + 0x0114b690 67696e22 20227061 7373776f 72642220 gin" "password" │ │ │ │ │ + 0x0114b6a0 4e6f7468 696e670a 20202020 20202020 Nothing. │ │ │ │ │ + 0x0114b6b0 20202020 2020285c 5f202d3e 2068616e (\_ -> han │ │ │ │ │ + 0x0114b6c0 646c654c 6f67696e 20657272 29202872 dleLogin err) (r │ │ │ │ │ + 0x0114b6d0 65646972 65637420 222f2229 0a202077 edirect "/"). w │ │ │ │ │ + 0x0114b6e0 68657265 0a202020 20657272 203d204a here. err = J │ │ │ │ │ + 0x0114b6f0 75737420 22556e6b 6e6f776e 20757365 ust "Unknown use │ │ │ │ │ + 0x0114b700 72206f72 20706173 73776f72 64220a0a r or password".. │ │ │ │ │ + 0x0114b710 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ │ + 0x0114b720 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b730 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b740 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b750 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ │ + 0x0114b760 2d2d207c 204c6f67 73206f75 7420616e -- | Logs out an │ │ │ │ │ + 0x0114b770 64207265 64697265 63747320 74686520 d redirects the │ │ │ │ │ + 0x0114b780 75736572 20746f20 74686520 73697465 user to the site │ │ │ │ │ + 0x0114b790 20696e64 65782e0a 68616e64 6c654c6f index..handleLo │ │ │ │ │ + 0x0114b7a0 676f7574 203a3a20 48616e64 6c657220 gout :: Handler │ │ │ │ │ + 0x0114b7b0 41707020 28417574 684d616e 61676572 App (AuthManager │ │ │ │ │ + 0x0114b7c0 20417070 29202829 0a68616e 646c654c App) ().handleL │ │ │ │ │ + 0x0114b7d0 6f676f75 74203d20 6c6f676f 7574203e ogout = logout > │ │ │ │ │ + 0x0114b7e0 3e207265 64697265 63742022 2f220a0a > redirect "/".. │ │ │ │ │ + 0x0114b7f0 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ │ 0x0114b800 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114b810 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This │ │ │ │ │ - 0x0114b820 69732074 68652065 6e747279 20706f69 is the entry poi │ │ │ │ │ - 0x0114b830 6e742066 6f722074 68697320 77656220 nt for this web │ │ │ │ │ - 0x0114b840 73657276 65722061 70706c69 63617469 server applicati │ │ │ │ │ - 0x0114b850 6f6e2e20 49742073 7570706f 7274730a on. It supports. │ │ │ │ │ - 0x0114b860 2d2d2065 6173696c 79207377 69746368 -- easily switch │ │ │ │ │ - 0x0114b870 696e6720 62657477 65656e20 696e7465 ing between inte │ │ │ │ │ - 0x0114b880 72707265 74696e67 20736f75 72636520 rpreting source │ │ │ │ │ - 0x0114b890 616e6420 72756e6e 696e6720 73746174 and running stat │ │ │ │ │ - 0x0114b8a0 6963616c 6c792063 6f6d7069 6c65640a ically compiled. │ │ │ │ │ - 0x0114b8b0 2d2d2063 6f64652e 0a2d2d0a 2d2d2049 -- code..--.-- I │ │ │ │ │ - 0x0114b8c0 6e206569 74686572 206d6f64 652c2074 n either mode, t │ │ │ │ │ - 0x0114b8d0 68652067 656e6572 61746564 2070726f he generated pro │ │ │ │ │ - 0x0114b8e0 6772616d 2073686f 756c6420 62652072 gram should be r │ │ │ │ │ - 0x0114b8f0 756e2066 726f6d20 74686520 726f6f74 un from the root │ │ │ │ │ - 0x0114b900 206f6620 7468650a 2d2d2070 726f6a65 of the.-- proje │ │ │ │ │ - 0x0114b910 63742074 7265652e 20576865 6e206974 ct tree. When it │ │ │ │ │ - 0x0114b920 20697320 72756e2c 20697420 6c6f6361 is run, it loca │ │ │ │ │ - 0x0114b930 74657320 69747320 74656d70 6c617465 tes its template │ │ │ │ │ - 0x0114b940 732c2073 74617469 6320636f 6e74656e s, static conten │ │ │ │ │ - 0x0114b950 742c2061 6e640a2d 2d20736f 75726365 t, and.-- source │ │ │ │ │ - 0x0114b960 2066696c 65732069 6e206465 76656c6f files in develo │ │ │ │ │ - 0x0114b970 706d656e 74206d6f 64652c20 72656c61 pment mode, rela │ │ │ │ │ - 0x0114b980 74697665 20746f20 74686520 63757272 tive to the curr │ │ │ │ │ - 0x0114b990 656e7420 776f726b 696e6720 64697265 ent working dire │ │ │ │ │ - 0x0114b9a0 63746f72 792e0a2d 2d0a2d2d 20576865 ctory..--.-- Whe │ │ │ │ │ - 0x0114b9b0 6e20636f 6d70696c 65642077 69746820 n compiled with │ │ │ │ │ - 0x0114b9c0 74686520 64657665 6c6f706d 656e7420 the development │ │ │ │ │ - 0x0114b9d0 666c6167 2c206f6e 6c792063 68616e67 flag, only chang │ │ │ │ │ - 0x0114b9e0 65732074 6f207468 65206c69 62726172 es to the librar │ │ │ │ │ - 0x0114b9f0 6965732c 20796f75 720a2d2d 20636162 ies, your.-- cab │ │ │ │ │ - 0x0114ba00 616c2066 696c652c 206f7220 74686973 al file, or this │ │ │ │ │ - 0x0114ba10 2066696c 65207368 6f756c64 20726571 file should req │ │ │ │ │ - 0x0114ba20 75697265 20612072 65636f6d 70696c65 uire a recompile │ │ │ │ │ - 0x0114ba30 20746f20 62652070 69636b65 64207570 to be picked up │ │ │ │ │ - 0x0114ba40 2e0a2d2d 20457665 72797468 696e6720 ..-- Everything │ │ │ │ │ - 0x0114ba50 656c7365 20697320 696e7465 72707265 else is interpre │ │ │ │ │ - 0x0114ba60 74656420 61742072 756e7469 6d652e20 ted at runtime. │ │ │ │ │ - 0x0114ba70 54686572 65206172 65206120 66657720 There are a few │ │ │ │ │ - 0x0114ba80 636f6e73 65717565 6e636573 206f660a consequences of. │ │ │ │ │ - 0x0114ba90 2d2d2074 6869732e 0a2d2d0a 2d2d2046 -- this..--.-- F │ │ │ │ │ - 0x0114baa0 69727374 2c207468 69732069 73206d75 irst, this is mu │ │ │ │ │ - 0x0114bab0 63682073 6c6f7765 722e2052 756e6e69 ch slower. Runni │ │ │ │ │ - 0x0114bac0 6e672074 68652069 6e746572 70726574 ng the interpret │ │ │ │ │ - 0x0114bad0 65722074 616b6573 20612073 69676e69 er takes a signi │ │ │ │ │ - 0x0114bae0 66696361 6e740a2d 2d206368 756e6b20 ficant.-- chunk │ │ │ │ │ - 0x0114baf0 6f662074 696d6520 28612063 6f75706c of time (a coupl │ │ │ │ │ - 0x0114bb00 65207465 6e746873 206f6620 61207365 e tenths of a se │ │ │ │ │ - 0x0114bb10 636f6e64 206f6e20 74686520 61757468 cond on the auth │ │ │ │ │ - 0x0114bb20 6f722773 206d6163 68696e65 2c206174 or's machine, at │ │ │ │ │ - 0x0114bb30 20746869 730a2d2d 2074696d 65292c20 this.-- time), │ │ │ │ │ - 0x0114bb40 72656761 72646c65 7373206f 66207468 regardless of th │ │ │ │ │ - 0x0114bb50 65207369 6d706c69 63697479 206f6620 e simplicity of │ │ │ │ │ - 0x0114bb60 74686520 6c6f6164 65642063 6f64652e the loaded code. │ │ │ │ │ - 0x0114bb70 20496e20 6f726465 7220746f 0a2d2d20 In order to.-- │ │ │ │ │ - 0x0114bb80 7265636f 6d70696c 6520616e 64207265 recompile and re │ │ │ │ │ - 0x0114bb90 2d6c6f61 64207365 72766572 20737461 -load server sta │ │ │ │ │ - 0x0114bba0 74652061 7320696e 66726571 75656e74 te as infrequent │ │ │ │ │ - 0x0114bbb0 6c792061 7320706f 73736962 6c652c20 ly as possible, │ │ │ │ │ - 0x0114bbc0 74686520 736f7572 63650a2d 2d206469 the source.-- di │ │ │ │ │ - 0x0114bbd0 72656374 6f726965 73206172 65207761 rectories are wa │ │ │ │ │ - 0x0114bbe0 74636865 6420666f 72207570 64617465 tched for update │ │ │ │ │ - 0x0114bbf0 732c2061 73206172 6520616e 79206578 s, as are any ex │ │ │ │ │ - 0x0114bc00 74726120 64697265 63746f72 69657320 tra directories │ │ │ │ │ - 0x0114bc10 73706563 69666965 640a2d2d 2062656c specified.-- bel │ │ │ │ │ - 0x0114bc20 6f772e0a 2d2d0a2d 2d205365 636f6e64 ow..--.-- Second │ │ │ │ │ - 0x0114bc30 2c207468 65206765 6e657261 74656420 , the generated │ │ │ │ │ - 0x0114bc40 73657276 65722062 696e6172 79206973 server binary is │ │ │ │ │ - 0x0114bc50 204d5543 48206c61 72676572 2c207369 MUCH larger, si │ │ │ │ │ - 0x0114bc60 6e636520 6974206c 696e6b73 20696e20 nce it links in │ │ │ │ │ - 0x0114bc70 7468650a 2d2d2047 48432041 50492028 the.-- GHC API ( │ │ │ │ │ - 0x0114bc80 76696120 74686520 68696e74 206c6962 via the hint lib │ │ │ │ │ - 0x0114bc90 72617279 292e0a2d 2d0a2d2d 20546869 rary)..--.-- Thi │ │ │ │ │ - 0x0114bca0 72642c20 616e6420 74686520 72656173 rd, and the reas │ │ │ │ │ - 0x0114bcb0 6f6e2079 6f752077 6f756c64 20657665 on you would eve │ │ │ │ │ - 0x0114bcc0 72207761 6e742074 6f206163 7475616c r want to actual │ │ │ │ │ - 0x0114bcd0 6c792063 6f6d7069 6c652077 6974680a ly compile with. │ │ │ │ │ - 0x0114bce0 2d2d2064 6576656c 6f706d65 6e74206d -- development m │ │ │ │ │ - 0x0114bcf0 6f64652c 20697320 74686174 20697420 ode, is that it │ │ │ │ │ - 0x0114bd00 656e6162 6c657320 61206661 73746572 enables a faster │ │ │ │ │ - 0x0114bd10 20646576 656c6f70 6d656e74 20637963 development cyc │ │ │ │ │ - 0x0114bd20 6c652e20 596f7520 63616e0a 2d2d2073 le. You can.-- s │ │ │ │ │ - 0x0114bd30 696d706c 79206564 69742061 2066696c imply edit a fil │ │ │ │ │ - 0x0114bd40 652c2073 61766520 796f7572 20636861 e, save your cha │ │ │ │ │ - 0x0114bd50 6e676573 2c20616e 64206869 74207265 nges, and hit re │ │ │ │ │ - 0x0114bd60 6c6f6164 20746f20 73656520 796f7572 load to see your │ │ │ │ │ - 0x0114bd70 20636861 6e676573 0a2d2d20 7265666c changes.-- refl │ │ │ │ │ - 0x0114bd80 65637465 6420696d 6d656469 6174656c ected immediatel │ │ │ │ │ - 0x0114bd90 792e0a2d 2d0a2d2d 20576865 6e207468 y..--.-- When th │ │ │ │ │ - 0x0114bda0 69732069 7320636f 6d70696c 65642077 is is compiled w │ │ │ │ │ - 0x0114bdb0 6974686f 75742074 68652064 6576656c ithout the devel │ │ │ │ │ - 0x0114bdc0 6f706d65 6e742066 6c61672c 20616c6c opment flag, all │ │ │ │ │ - 0x0114bdd0 20746865 20616374 696f6e73 20617265 the actions are │ │ │ │ │ - 0x0114bde0 0a2d2d20 73746174 6963616c 6c792063 .-- statically c │ │ │ │ │ - 0x0114bdf0 6f6d7069 6c656420 696e2e20 54686973 ompiled in. This │ │ │ │ │ - 0x0114be00 20726573 756c7473 20696e20 66617374 results in fast │ │ │ │ │ - 0x0114be10 65722065 78656375 74696f6e 2c206120 er execution, a │ │ │ │ │ - 0x0114be20 736d616c 6c657220 62696e61 72790a2d smaller binary.- │ │ │ │ │ - 0x0114be30 2d207369 7a652c20 616e6420 68617669 - size, and havi │ │ │ │ │ - 0x0114be40 6e672074 6f207265 636f6d70 696c6520 ng to recompile │ │ │ │ │ - 0x0114be50 74686520 73657276 65722066 6f722061 the server for a │ │ │ │ │ - 0x0114be60 6e792063 6f646520 6368616e 67652e0a ny code change.. │ │ │ │ │ - 0x0114be70 2d2d0a6d 61696e20 3a3a2049 4f202829 --.main :: IO () │ │ │ │ │ - 0x0114be80 0a6d6169 6e203d20 646f0a20 2020202d .main = do. - │ │ │ │ │ - 0x0114be90 2d204465 70656e64 696e6720 6f6e2074 - Depending on t │ │ │ │ │ - 0x0114bea0 68652076 65727369 6f6e206f 66206c6f he version of lo │ │ │ │ │ - 0x0114beb0 6164536e 61705448 20696e20 73636f70 adSnapTH in scop │ │ │ │ │ - 0x0114bec0 652c2074 68697320 65697468 65722065 e, this either e │ │ │ │ │ - 0x0114bed0 6e61626c 65730a20 2020202d 2d206479 nables. -- dy │ │ │ │ │ - 0x0114bee0 6e616d69 63207265 6c6f6164 696e672c namic reloading, │ │ │ │ │ - 0x0114bef0 206f7220 636f6d70 696c6573 20697420 or compiles it │ │ │ │ │ - 0x0114bf00 77697468 6f75742e 20546865 206c6173 without. The las │ │ │ │ │ - 0x0114bf10 74206172 67756d65 6e742074 6f0a2020 t argument to. │ │ │ │ │ - 0x0114bf20 20202d2d 206c6f61 64536e61 70544820 -- loadSnapTH │ │ │ │ │ - 0x0114bf30 69732061 206c6973 74206f66 20616464 is a list of add │ │ │ │ │ - 0x0114bf40 6974696f 6e616c20 64697265 63746f72 itional director │ │ │ │ │ - 0x0114bf50 69657320 746f2077 61746368 20666f72 ies to watch for │ │ │ │ │ - 0x0114bf60 20636861 6e676573 20746f0a 20202020 changes to. │ │ │ │ │ - 0x0114bf70 2d2d2074 72696767 65722072 656c6f61 -- trigger reloa │ │ │ │ │ - 0x0114bf80 64732069 6e206465 76656c6f 706d656e ds in developmen │ │ │ │ │ - 0x0114bf90 74206d6f 64652e20 49742064 6f65736e t mode. It doesn │ │ │ │ │ - 0x0114bfa0 2774206e 65656420 746f2069 6e636c75 't need to inclu │ │ │ │ │ - 0x0114bfb0 64652073 6f757263 650a2020 20202d2d de source. -- │ │ │ │ │ - 0x0114bfc0 20646972 6563746f 72696573 2c207468 directories, th │ │ │ │ │ - 0x0114bfd0 6f736520 61726520 7069636b 65642075 ose are picked u │ │ │ │ │ - 0x0114bfe0 70206175 746f6d61 74696361 6c6c7920 p automatically │ │ │ │ │ - 0x0114bff0 62792074 68652073 706c6963 652e0a20 by the splice.. │ │ │ │ │ - 0x0114c000 20202028 636f6e66 2c207369 74652c20 (conf, site, │ │ │ │ │ - 0x0114c010 636c6561 6e757029 203c2d20 24286c6f cleanup) <- $(lo │ │ │ │ │ - 0x0114c020 6164536e 61705448 205b7c20 67657443 adSnapTH [| getC │ │ │ │ │ - 0x0114c030 6f6e6620 7c5d0a20 20202020 20202020 onf |]. │ │ │ │ │ - 0x0114c040 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114c050 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114c060 20276765 74416374 696f6e73 0a202020 'getActions. │ │ │ │ │ - 0x0114c070 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114c080 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114c090 20202020 2020205b 22736e61 706c6574 ["snaplet │ │ │ │ │ - 0x0114c0a0 732f6865 6973742f 74656d70 6c617465 s/heist/template │ │ │ │ │ - 0x0114c0b0 73225d29 0a0a2020 20205f20 3c2d2074 s"]).. _ <- t │ │ │ │ │ - 0x0114c0c0 72792024 20687474 70536572 76652063 ry $ httpServe c │ │ │ │ │ - 0x0114c0d0 6f6e6620 73697465 203a3a20 494f2028 onf site :: IO ( │ │ │ │ │ - 0x0114c0e0 45697468 65722053 6f6d6545 78636570 Either SomeExcep │ │ │ │ │ - 0x0114c0f0 74696f6e 20282929 0a202020 20636c65 tion ()). cle │ │ │ │ │ - 0x0114c100 616e7570 0a0a0a2d 2d2d2d2d 2d2d2d2d anup...--------- │ │ │ │ │ - 0x0114c110 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c120 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c130 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c140 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c150 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This │ │ │ │ │ - 0x0114c160 61637469 6f6e206c 6f616473 20746865 action loads the │ │ │ │ │ - 0x0114c170 20636f6e 66696720 75736564 20627920 config used by │ │ │ │ │ - 0x0114c180 74686973 20617070 6c696361 74696f6e this application │ │ │ │ │ - 0x0114c190 2e205468 65206c6f 61646564 20636f6e . The loaded con │ │ │ │ │ - 0x0114c1a0 6669670a 2d2d2069 73207265 7475726e fig.-- is return │ │ │ │ │ - 0x0114c1b0 65642061 73207468 65206669 72737420 ed as the first │ │ │ │ │ - 0x0114c1c0 656c656d 656e7420 6f662074 68652074 element of the t │ │ │ │ │ - 0x0114c1d0 75706c65 2070726f 64756365 64206279 uple produced by │ │ │ │ │ - 0x0114c1e0 20746865 206c6f61 64536e61 7054480a the loadSnapTH. │ │ │ │ │ - 0x0114c1f0 2d2d2053 706c6963 652e2054 68652074 -- Splice. The t │ │ │ │ │ - 0x0114c200 79706520 6973206e 6f742073 6f6c6964 ype is not solid │ │ │ │ │ - 0x0114c210 6c792066 69786564 2c207468 6f756768 ly fixed, though │ │ │ │ │ - 0x0114c220 20697420 6d757374 20626520 616e2049 it must be an I │ │ │ │ │ - 0x0114c230 4f206163 74696f6e 20746861 740a2d2d O action that.-- │ │ │ │ │ - 0x0114c240 2070726f 64756365 73207468 65207361 produces the sa │ │ │ │ │ - 0x0114c250 6d652074 79706520 61732027 67657441 me type as 'getA │ │ │ │ │ - 0x0114c260 6374696f 6e732720 74616b65 732e2049 ctions' takes. I │ │ │ │ │ - 0x0114c270 7420616c 736f206d 75737420 62652061 t also must be a │ │ │ │ │ - 0x0114c280 6e20696e 7374616e 6365206f 660a2d2d n instance of.-- │ │ │ │ │ - 0x0114c290 20547970 6561626c 652e2049 66207468 Typeable. If th │ │ │ │ │ - 0x0114c2a0 65207479 7065206f 66207468 69732069 e type of this i │ │ │ │ │ - 0x0114c2b0 73206368 616e6765 642c2061 2066756c s changed, a ful │ │ │ │ │ - 0x0114c2c0 6c207265 636f6d70 696c6520 77696c6c l recompile will │ │ │ │ │ - 0x0114c2d0 20626520 6e656564 65642074 6f0a2d2d be needed to.-- │ │ │ │ │ - 0x0114c2e0 20706963 6b207570 20746865 20636861 pick up the cha │ │ │ │ │ - 0x0114c2f0 6e67652c 20657665 6e20696e 20646576 nge, even in dev │ │ │ │ │ - 0x0114c300 656c6f70 6d656e74 206d6f64 652e0a2d elopment mode..- │ │ │ │ │ - 0x0114c310 2d0a2d2d 20546869 73206163 74696f6e -.-- This action │ │ │ │ │ - 0x0114c320 20697320 6f6e6c79 2072756e 206f6e63 is only run onc │ │ │ │ │ - 0x0114c330 652c2072 65676172 646c6573 73206f66 e, regardless of │ │ │ │ │ - 0x0114c340 20776865 74686572 20646576 656c6f70 whether develop │ │ │ │ │ - 0x0114c350 6d656e74 206f720a 2d2d2070 726f6475 ment or.-- produ │ │ │ │ │ - 0x0114c360 6374696f 6e206d6f 64652069 7320696e ction mode is in │ │ │ │ │ - 0x0114c370 20757365 2e0a6765 74436f6e 66203a3a use..getConf :: │ │ │ │ │ - 0x0114c380 20494f20 28436f6e 66696720 536e6170 IO (Config Snap │ │ │ │ │ - 0x0114c390 20417070 436f6e66 6967290a 67657443 AppConfig).getC │ │ │ │ │ - 0x0114c3a0 6f6e6620 3d20636f 6d6d616e 644c696e onf = commandLin │ │ │ │ │ - 0x0114c3b0 65417070 436f6e66 69672064 65666175 eAppConfig defau │ │ │ │ │ - 0x0114c3c0 6c74436f 6e666967 0a0a0a2d 2d2d2d2d ltConfig...----- │ │ │ │ │ - 0x0114c3d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c3e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c3f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c400 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c410 2d2d2d2d 2d2d2d2d 2d0a2d2d 207c2054 ---------.-- | T │ │ │ │ │ - 0x0114c420 68697320 66756e63 74696f6e 2067656e his function gen │ │ │ │ │ - 0x0114c430 65726174 65732074 68652074 68652073 erates the the s │ │ │ │ │ - 0x0114c440 69746520 68616e64 6c657220 616e6420 ite handler and │ │ │ │ │ - 0x0114c450 636c6561 6e757020 61637469 6f6e2066 cleanup action f │ │ │ │ │ - 0x0114c460 726f6d20 7468650a 2d2d2063 6f6e6669 rom the.-- confi │ │ │ │ │ - 0x0114c470 67757261 74696f6e 2e20496e 2070726f guration. In pro │ │ │ │ │ - 0x0114c480 64756374 696f6e20 6d6f6465 2c207468 duction mode, th │ │ │ │ │ - 0x0114c490 69732061 6374696f 6e206973 206f6e6c is action is onl │ │ │ │ │ - 0x0114c4a0 79207275 6e206f6e 63652e20 496e0a2d y run once. In.- │ │ │ │ │ - 0x0114c4b0 2d206465 76656c6f 706d656e 74206d6f - development mo │ │ │ │ │ - 0x0114c4c0 64652c20 74686973 20616374 696f6e20 de, this action │ │ │ │ │ - 0x0114c4d0 69732072 756e2077 68656e65 76657220 is run whenever │ │ │ │ │ - 0x0114c4e0 74686520 6170706c 69636174 696f6e20 the application │ │ │ │ │ - 0x0114c4f0 69732072 656c6f61 6465642e 0a2d2d0a is reloaded..--. │ │ │ │ │ - 0x0114c500 2d2d2044 6576656c 6f706d65 6e74206d -- Development m │ │ │ │ │ - 0x0114c510 6f646520 616c736f 206d616b 65732073 ode also makes s │ │ │ │ │ - 0x0114c520 75726520 74686174 20746865 20636c65 ure that the cle │ │ │ │ │ - 0x0114c530 616e7570 20616374 696f6e73 20617265 anup actions are │ │ │ │ │ - 0x0114c540 2072756e 0a2d2d20 61707072 6f707269 run.-- appropri │ │ │ │ │ - 0x0114c550 6174656c 79206265 666f7265 20736875 ately before shu │ │ │ │ │ - 0x0114c560 74646f77 6e2e2054 68652063 6c65616e tdown. The clean │ │ │ │ │ - 0x0114c570 75702061 6374696f 6e207265 7475726e up action return │ │ │ │ │ - 0x0114c580 65642066 726f6d20 6c6f6164 536e6170 ed from loadSnap │ │ │ │ │ - 0x0114c590 54480a2d 2d207368 6f756c64 20737469 TH.-- should sti │ │ │ │ │ - 0x0114c5a0 6c6c2062 65207573 65642061 66746572 ll be used after │ │ │ │ │ - 0x0114c5b0 20746865 20736572 76657220 68617320 the server has │ │ │ │ │ - 0x0114c5c0 73746f70 70656420 68616e64 6c696e67 stopped handling │ │ │ │ │ - 0x0114c5d0 20726571 75657374 732c2061 73207468 requests, as th │ │ │ │ │ - 0x0114c5e0 650a2d2d 20636c65 616e7570 20616374 e.-- cleanup act │ │ │ │ │ - 0x0114c5f0 696f6e73 20617265 206f6e6c 79206175 ions are only au │ │ │ │ │ - 0x0114c600 746f6d61 74696361 6c6c7920 72756e20 tomatically run │ │ │ │ │ - 0x0114c610 7768656e 20612072 656c6f61 64206973 when a reload is │ │ │ │ │ - 0x0114c620 20747269 67676572 65642e0a 2d2d0a2d triggered..--.- │ │ │ │ │ - 0x0114c630 2d205468 69732073 616d706c 6520646f - This sample do │ │ │ │ │ - 0x0114c640 65736e27 74206163 7475616c 6c792075 esn't actually u │ │ │ │ │ - 0x0114c650 73652074 68652063 6f6e6669 67207061 se the config pa │ │ │ │ │ - 0x0114c660 73736564 20696e2c 20627574 206d6f72 ssed in, but mor │ │ │ │ │ - 0x0114c670 650a2d2d 20736f70 68697374 69636174 e.-- sophisticat │ │ │ │ │ - 0x0114c680 65642063 6f646520 6d696768 742e0a67 ed code might..g │ │ │ │ │ - 0x0114c690 65744163 74696f6e 73203a3a 20436f6e etActions :: Con │ │ │ │ │ - 0x0114c6a0 66696720 536e6170 20417070 436f6e66 fig Snap AppConf │ │ │ │ │ - 0x0114c6b0 6967202d 3e20494f 2028536e 61702028 ig -> IO (Snap ( │ │ │ │ │ - 0x0114c6c0 292c2049 4f202829 290a6765 74416374 ), IO ()).getAct │ │ │ │ │ - 0x0114c6d0 696f6e73 20636f6e 66203d20 646f0a20 ions conf = do. │ │ │ │ │ - 0x0114c6e0 20202028 6d736773 2c207369 74652c20 (msgs, site, │ │ │ │ │ - 0x0114c6f0 636c6561 6e757029 203c2d20 72756e53 cleanup) <- runS │ │ │ │ │ - 0x0114c700 6e61706c 65740a20 20202020 20202028 naplet. ( │ │ │ │ │ - 0x0114c710 61707045 6e766972 6f6e6d65 6e74203d appEnvironment = │ │ │ │ │ - 0x0114c720 3c3c2067 65744f74 68657220 636f6e66 << getOther conf │ │ │ │ │ - 0x0114c730 29206170 700a2020 20206850 75745374 ) app. hPutSt │ │ │ │ │ - 0x0114c740 724c6e20 73746465 72722024 20542e75 rLn stderr $ T.u │ │ │ │ │ - 0x0114c750 6e706163 6b206d73 67730a20 20202072 npack msgs. r │ │ │ │ │ - 0x0114c760 65747572 6e202873 6974652c 20636c65 eturn (site, cle │ │ │ │ │ - 0x0114c770 616e7570 290a007b 2d23204c 414e4755 anup)..{-# LANGU │ │ │ │ │ - 0x0114c780 41474520 4f766572 6c6f6164 65645374 AGE OverloadedSt │ │ │ │ │ - 0x0114c790 72696e67 7320232d 7d0a0a2d 2d2d2d2d rings #-}..----- │ │ │ │ │ - 0x0114c7a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c7b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c7c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c7d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c7e0 2d2d2d2d 2d2d2d2d 2d0a2d2d 207c2054 ---------.-- | T │ │ │ │ │ - 0x0114c7f0 68697320 6d6f6475 6c652069 73207768 his module is wh │ │ │ │ │ - 0x0114c800 65726520 616c6c20 74686520 726f7574 ere all the rout │ │ │ │ │ - 0x0114c810 65732061 6e642068 616e646c 65727320 es and handlers │ │ │ │ │ - 0x0114c820 61726520 64656669 6e656420 666f7220 are defined for │ │ │ │ │ - 0x0114c830 796f7572 0a2d2d20 73697465 2e205468 your.-- site. Th │ │ │ │ │ - 0x0114c840 65202761 70702720 66756e63 74696f6e e 'app' function │ │ │ │ │ - 0x0114c850 20697320 74686520 696e6974 69616c69 is the initiali │ │ │ │ │ - 0x0114c860 7a657220 74686174 20636f6d 62696e65 zer that combine │ │ │ │ │ - 0x0114c870 73206576 65727974 68696e67 0a2d2d20 s everything.-- │ │ │ │ │ - 0x0114c880 746f6765 74686572 20616e64 20697320 together and is │ │ │ │ │ - 0x0114c890 6578706f 72746564 20627920 74686973 exported by this │ │ │ │ │ - 0x0114c8a0 206d6f64 756c652e 0a6d6f64 756c6520 module..module │ │ │ │ │ - 0x0114c8b0 53697465 0a202028 20617070 0a202029 Site. ( app. ) │ │ │ │ │ - 0x0114c8c0 20776865 72650a0a 2d2d2d2d 2d2d2d2d where..-------- │ │ │ │ │ - 0x0114c8d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c8e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c8f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c900 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114c910 2d2d2d2d 2d2d0a69 6d706f72 74202020 ------.import │ │ │ │ │ - 0x0114c920 20202020 20202020 436f6e74 726f6c2e Control. │ │ │ │ │ - 0x0114c930 4170706c 69636174 6976650a 696d706f Applicative.impo │ │ │ │ │ - 0x0114c940 72742020 20202020 20202020 20446174 rt Dat │ │ │ │ │ - 0x0114c950 612e4279 74655374 72696e67 20284279 a.ByteString (By │ │ │ │ │ - 0x0114c960 74655374 72696e67 290a696d 706f7274 teString).import │ │ │ │ │ - 0x0114c970 20202020 20202020 20202044 6174612e Data. │ │ │ │ │ - 0x0114c980 4d61702e 53796e74 61782028 28232329 Map.Syntax ((##) │ │ │ │ │ - 0x0114c990 290a696d 706f7274 20717561 6c696669 ).import qualifi │ │ │ │ │ - 0x0114c9a0 65642044 6174612e 54657874 20617320 ed Data.Text as │ │ │ │ │ - 0x0114c9b0 540a696d 706f7274 20202020 20202020 T.import │ │ │ │ │ - 0x0114c9c0 20202053 6e61702e 436f7265 0a696d70 Snap.Core.imp │ │ │ │ │ - 0x0114c9d0 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ │ - 0x0114c9e0 61702e53 6e61706c 65740a69 6d706f72 ap.Snaplet.impor │ │ │ │ │ - 0x0114c9f0 74202020 20202020 20202020 536e6170 t Snap │ │ │ │ │ - 0x0114ca00 2e536e61 706c6574 2e417574 680a696d .Snaplet.Auth.im │ │ │ │ │ - 0x0114ca10 706f7274 20202020 20202020 20202053 port S │ │ │ │ │ - 0x0114ca20 6e61702e 536e6170 6c65742e 41757468 nap.Snaplet.Auth │ │ │ │ │ - 0x0114ca30 2e426163 6b656e64 732e4a73 6f6e4669 .Backends.JsonFi │ │ │ │ │ - 0x0114ca40 6c650a69 6d706f72 74202020 20202020 le.import │ │ │ │ │ - 0x0114ca50 20202020 536e6170 2e536e61 706c6574 Snap.Snaplet │ │ │ │ │ - 0x0114ca60 2e486569 73740a69 6d706f72 74202020 .Heist.import │ │ │ │ │ - 0x0114ca70 20202020 20202020 536e6170 2e536e61 Snap.Sna │ │ │ │ │ - 0x0114ca80 706c6574 2e536573 73696f6e 2e426163 plet.Session.Bac │ │ │ │ │ - 0x0114ca90 6b656e64 732e436f 6f6b6965 53657373 kends.CookieSess │ │ │ │ │ - 0x0114caa0 696f6e0a 696d706f 72742020 20202020 ion.import │ │ │ │ │ - 0x0114cab0 20202020 20536e61 702e5574 696c2e46 Snap.Util.F │ │ │ │ │ - 0x0114cac0 696c6553 65727665 0a696d70 6f727420 ileServe.import │ │ │ │ │ - 0x0114cad0 7175616c 69666965 64204865 6973742e qualified Heist. │ │ │ │ │ - 0x0114cae0 496e7465 72707265 74656420 61732049 Interpreted as I │ │ │ │ │ - 0x0114caf0 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ │ + 0x0114b810 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b820 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b830 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ │ + 0x0114b840 2d2d207c 2048616e 646c6520 6e657720 -- | Handle new │ │ │ │ │ + 0x0114b850 75736572 20666f72 6d207375 626d6974 user form submit │ │ │ │ │ + 0x0114b860 0a68616e 646c654e 65775573 6572203a .handleNewUser : │ │ │ │ │ + 0x0114b870 3a204861 6e646c65 72204170 70202841 : Handler App (A │ │ │ │ │ + 0x0114b880 7574684d 616e6167 65722041 70702920 uthManager App) │ │ │ │ │ + 0x0114b890 28290a68 616e646c 654e6577 55736572 ().handleNewUser │ │ │ │ │ + 0x0114b8a0 203d206d 6574686f 64204745 54206861 = method GET ha │ │ │ │ │ + 0x0114b8b0 6e646c65 466f726d 203c7c3e 206d6574 ndleForm <|> met │ │ │ │ │ + 0x0114b8c0 686f6420 504f5354 2068616e 646c6546 hod POST handleF │ │ │ │ │ + 0x0114b8d0 6f726d53 75626d69 740a2020 77686572 ormSubmit. wher │ │ │ │ │ + 0x0114b8e0 650a2020 20206861 6e646c65 466f726d e. handleForm │ │ │ │ │ + 0x0114b8f0 203d2072 656e6465 7220226e 65775f75 = render "new_u │ │ │ │ │ + 0x0114b900 73657222 0a202020 2068616e 646c6546 ser". handleF │ │ │ │ │ + 0x0114b910 6f726d53 75626d69 74203d20 72656769 ormSubmit = regi │ │ │ │ │ + 0x0114b920 73746572 55736572 20226c6f 67696e22 sterUser "login" │ │ │ │ │ + 0x0114b930 20227061 7373776f 72642220 3e3e2072 "password" >> r │ │ │ │ │ + 0x0114b940 65646972 65637420 222f220a 0a0a2d2d edirect "/"...-- │ │ │ │ │ + 0x0114b950 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b960 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b970 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b980 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114b990 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a2d2d20 ------------.-- │ │ │ │ │ + 0x0114b9a0 7c205468 65206170 706c6963 6174696f | The applicatio │ │ │ │ │ + 0x0114b9b0 6e277320 726f7574 65732e0a 726f7574 n's routes..rout │ │ │ │ │ + 0x0114b9c0 6573203a 3a205b28 42797465 53747269 es :: [(ByteStri │ │ │ │ │ + 0x0114b9d0 6e672c20 48616e64 6c657220 41707020 ng, Handler App │ │ │ │ │ + 0x0114b9e0 41707020 2829295d 0a726f75 74657320 App ())].routes │ │ │ │ │ + 0x0114b9f0 3d205b20 28226c6f 67696e22 2c202020 = [ ("login", │ │ │ │ │ + 0x0114ba00 20776974 68206175 74682068 616e646c with auth handl │ │ │ │ │ + 0x0114ba10 654c6f67 696e5375 626d6974 290a2020 eLoginSubmit). │ │ │ │ │ + 0x0114ba20 20202020 2020202c 2028226c 6f676f75 , ("logou │ │ │ │ │ + 0x0114ba30 74222c20 20207769 74682061 75746820 t", with auth │ │ │ │ │ + 0x0114ba40 68616e64 6c654c6f 676f7574 290a2020 handleLogout). │ │ │ │ │ + 0x0114ba50 20202020 2020202c 2028226e 65775f75 , ("new_u │ │ │ │ │ + 0x0114ba60 73657222 2c207769 74682061 75746820 ser", with auth │ │ │ │ │ + 0x0114ba70 68616e64 6c654e65 77557365 72290a20 handleNewUser). │ │ │ │ │ + 0x0114ba80 20202020 20202020 2c202822 222c2020 , ("", │ │ │ │ │ + 0x0114ba90 20202020 20202073 65727665 44697265 serveDire │ │ │ │ │ + 0x0114baa0 63746f72 79202273 74617469 6322290a ctory "static"). │ │ │ │ │ + 0x0114bab0 20202020 20202020 205d0a0a 0a2d2d2d ]...--- │ │ │ │ │ + 0x0114bac0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114bad0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114bae0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114baf0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114bb00 2d2d2d2d 2d2d2d2d 2d2d2d0a 2d2d207c -----------.-- | │ │ │ │ │ + 0x0114bb10 20546865 20617070 6c696361 74696f6e The application │ │ │ │ │ + 0x0114bb20 20696e69 7469616c 697a6572 2e0a6170 initializer..ap │ │ │ │ │ + 0x0114bb30 70203a3a 20536e61 706c6574 496e6974 p :: SnapletInit │ │ │ │ │ + 0x0114bb40 20417070 20417070 0a617070 203d206d App App.app = m │ │ │ │ │ + 0x0114bb50 616b6553 6e61706c 65742022 61707022 akeSnaplet "app" │ │ │ │ │ + 0x0114bb60 2022416e 20736e61 706c6574 20657861 "An snaplet exa │ │ │ │ │ + 0x0114bb70 6d706c65 20617070 6c696361 74696f6e mple application │ │ │ │ │ + 0x0114bb80 2e22204e 6f746869 6e672024 20646f0a ." Nothing $ do. │ │ │ │ │ + 0x0114bb90 20202020 68203c2d 206e6573 74536e61 h <- nestSna │ │ │ │ │ + 0x0114bba0 706c6574 20222220 68656973 74202420 plet "" heist $ │ │ │ │ │ + 0x0114bbb0 68656973 74496e69 74202274 656d706c heistInit "templ │ │ │ │ │ + 0x0114bbc0 61746573 220a2020 20207320 3c2d206e ates". s <- n │ │ │ │ │ + 0x0114bbd0 65737453 6e61706c 65742022 73657373 estSnaplet "sess │ │ │ │ │ + 0x0114bbe0 22207365 73732024 0a202020 20202020 " sess $. │ │ │ │ │ + 0x0114bbf0 20202020 696e6974 436f6f6b 69655365 initCookieSe │ │ │ │ │ + 0x0114bc00 7373696f 6e4d616e 61676572 20227369 ssionManager "si │ │ │ │ │ + 0x0114bc10 74655f6b 65792e74 78742220 22736573 te_key.txt" "ses │ │ │ │ │ + 0x0114bc20 7322204e 6f746869 6e672028 4a757374 s" Nothing (Just │ │ │ │ │ + 0x0114bc30 20333630 30290a0a 20202020 2d2d204e 3600).. -- N │ │ │ │ │ + 0x0114bc40 4f54453a 20576527 72652075 73696e67 OTE: We're using │ │ │ │ │ + 0x0114bc50 20696e69 744a736f 6e46696c 65417574 initJsonFileAut │ │ │ │ │ + 0x0114bc60 684d616e 61676572 20686572 65206265 hManager here be │ │ │ │ │ + 0x0114bc70 63617573 65206974 27732065 61737920 cause it's easy │ │ │ │ │ + 0x0114bc80 616e640a 20202020 2d2d2064 6f65736e and. -- doesn │ │ │ │ │ + 0x0114bc90 27742072 65717569 72652061 6e79206b 't require any k │ │ │ │ │ + 0x0114bca0 696e6420 6f662064 61746162 61736520 ind of database │ │ │ │ │ + 0x0114bcb0 73657276 65722074 6f207275 6e2e2020 server to run. │ │ │ │ │ + 0x0114bcc0 496e2070 72616374 6963652c 0a202020 In practice,. │ │ │ │ │ + 0x0114bcd0 202d2d20 796f7527 6c6c2070 726f6261 -- you'll proba │ │ │ │ │ + 0x0114bce0 626c7920 77616e74 20746f20 6368616e bly want to chan │ │ │ │ │ + 0x0114bcf0 67652074 68697320 746f2061 206d6f72 ge this to a mor │ │ │ │ │ + 0x0114bd00 6520726f 62757374 20617574 68206261 e robust auth ba │ │ │ │ │ + 0x0114bd10 636b656e 642e0a20 20202061 203c2d20 ckend.. a <- │ │ │ │ │ + 0x0114bd20 6e657374 536e6170 6c657420 22617574 nestSnaplet "aut │ │ │ │ │ + 0x0114bd30 68222061 75746820 240a2020 20202020 h" auth $. │ │ │ │ │ + 0x0114bd40 20202020 20696e69 744a736f 6e46696c initJsonFil │ │ │ │ │ + 0x0114bd50 65417574 684d616e 61676572 20646566 eAuthManager def │ │ │ │ │ + 0x0114bd60 41757468 53657474 696e6773 20736573 AuthSettings ses │ │ │ │ │ + 0x0114bd70 73202275 73657273 2e6a736f 6e220a20 s "users.json". │ │ │ │ │ + 0x0114bd80 20202061 6464526f 75746573 20726f75 addRoutes rou │ │ │ │ │ + 0x0114bd90 7465730a 20202020 61646441 75746853 tes. addAuthS │ │ │ │ │ + 0x0114bda0 706c6963 65732068 20617574 680a2020 plices h auth. │ │ │ │ │ + 0x0114bdb0 20207265 7475726e 20242041 70702068 return $ App h │ │ │ │ │ + 0x0114bdc0 20732061 0a0a002e 2f737263 2f536974 s a..../src/Sit │ │ │ │ │ + 0x0114bdd0 652e6873 007b2d23 204c414e 47554147 e.hs.{-# LANGUAG │ │ │ │ │ + 0x0114bde0 45204350 50202020 20202020 20202020 E CPP │ │ │ │ │ + 0x0114bdf0 2020232d 7d0a7b2d 23204c41 4e475541 #-}.{-# LANGUA │ │ │ │ │ + 0x0114be00 47452054 656d706c 61746548 61736b65 GE TemplateHaske │ │ │ │ │ + 0x0114be10 6c6c2023 2d7d0a0a 7b2d0a0a 4e4f5445 ll #-}..{-..NOTE │ │ │ │ │ + 0x0114be20 3a20446f 6e277420 6d6f6469 66792074 : Don't modify t │ │ │ │ │ + 0x0114be30 68697320 66696c65 20756e6c 65737320 his file unless │ │ │ │ │ + 0x0114be40 796f7520 6b6e6f77 20776861 7420796f you know what yo │ │ │ │ │ + 0x0114be50 75206172 6520646f 696e672e 20204966 u are doing. If │ │ │ │ │ + 0x0114be60 20796f75 20617265 0a6e6577 20746f20 you are.new to │ │ │ │ │ + 0x0114be70 736e6170 2c207374 61727420 77697468 snap, start with │ │ │ │ │ + 0x0114be80 20536974 652e6873 20616e64 20417070 Site.hs and App │ │ │ │ │ + 0x0114be90 6c696361 74696f6e 2e68732e 20205468 lication.hs. Th │ │ │ │ │ + 0x0114bea0 69732066 696c6520 636f6e74 61696e73 is file contains │ │ │ │ │ + 0x0114beb0 0a626f69 6c657270 6c617465 206e6565 .boilerplate nee │ │ │ │ │ + 0x0114bec0 64656420 666f7220 64796e61 6d696320 ded for dynamic │ │ │ │ │ + 0x0114bed0 72656c6f 6164696e 6720616e 64206973 reloading and is │ │ │ │ │ + 0x0114bee0 206e6f74 206d6561 6e742066 6f722067 not meant for g │ │ │ │ │ + 0x0114bef0 656e6572 616c0a63 6f6e7375 6d707469 eneral.consumpti │ │ │ │ │ + 0x0114bf00 6f6e2e0a 0a4f6363 6173696f 6e616c6c on...Occasionall │ │ │ │ │ + 0x0114bf10 79206966 20776520 6d6f6469 66792074 y if we modify t │ │ │ │ │ + 0x0114bf20 68652077 61792074 68652064 796e616d he way the dynam │ │ │ │ │ + 0x0114bf30 69632072 656c6f61 64657220 776f726b ic reloader work │ │ │ │ │ + 0x0114bf40 7320616e 6420796f 75207761 6e742074 s and you want t │ │ │ │ │ + 0x0114bf50 6f0a7570 67726164 652c2079 6f75206d o.upgrade, you m │ │ │ │ │ + 0x0114bf60 69676874 20686176 6520746f 20737761 ight have to swa │ │ │ │ │ + 0x0114bf70 70206f75 74207468 69732066 696c6520 p out this file │ │ │ │ │ + 0x0114bf80 666f7220 61206e65 77657220 76657273 for a newer vers │ │ │ │ │ + 0x0114bf90 696f6e2e 20204275 7420696e 0a6d6f73 ion. But in.mos │ │ │ │ │ + 0x0114bfa0 74206361 73657320 796f7527 6c6c206e t cases you'll n │ │ │ │ │ + 0x0114bfb0 65766572 206e6565 6420746f 206d6f64 ever need to mod │ │ │ │ │ + 0x0114bfc0 69667920 74686973 20636f64 652e0a0a ify this code... │ │ │ │ │ + 0x0114bfd0 2d7d0a6d 6f64756c 65204d61 696e2077 -}.module Main w │ │ │ │ │ + 0x0114bfe0 68657265 0a0a2d2d 2d2d2d2d 2d2d2d2d here..---------- │ │ │ │ │ + 0x0114bff0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c000 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c010 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c020 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c030 2d2d2d2d 0a696d70 6f727420 20202020 ----.import │ │ │ │ │ + 0x0114c040 20202020 2020436f 6e74726f 6c2e4578 Control.Ex │ │ │ │ │ + 0x0114c050 63657074 696f6e20 28536f6d 65457863 ception (SomeExc │ │ │ │ │ + 0x0114c060 65707469 6f6e2c20 74727929 0a696d70 eption, try).imp │ │ │ │ │ + 0x0114c070 6f727420 7175616c 69666965 64204461 ort qualified Da │ │ │ │ │ + 0x0114c080 74612e54 65787420 61732054 0a696d70 ta.Text as T.imp │ │ │ │ │ + 0x0114c090 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ │ + 0x0114c0a0 61702e48 7474702e 53657276 65720a69 ap.Http.Server.i │ │ │ │ │ + 0x0114c0b0 6d706f72 74202020 20202020 20202020 mport │ │ │ │ │ + 0x0114c0c0 536e6170 2e536e61 706c6574 0a696d70 Snap.Snaplet.imp │ │ │ │ │ + 0x0114c0d0 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ │ + 0x0114c0e0 61702e53 6e61706c 65742e43 6f6e6669 ap.Snaplet.Confi │ │ │ │ │ + 0x0114c0f0 670a696d 706f7274 20202020 20202020 g.import │ │ │ │ │ + 0x0114c100 20202053 6e61702e 436f7265 0a696d70 Snap.Core.imp │ │ │ │ │ + 0x0114c110 6f727420 20202020 20202020 20205379 ort Sy │ │ │ │ │ + 0x0114c120 7374656d 2e494f0a 696d706f 72742020 stem.IO.import │ │ │ │ │ + 0x0114c130 20202020 20202020 20536974 650a0a23 Site..# │ │ │ │ │ + 0x0114c140 69666465 66204445 56454c4f 504d454e ifdef DEVELOPMEN │ │ │ │ │ + 0x0114c150 540a696d 706f7274 20202020 20202020 T.import │ │ │ │ │ + 0x0114c160 20202053 6e61702e 4c6f6164 65722e44 Snap.Loader.D │ │ │ │ │ + 0x0114c170 796e616d 69630a23 656c7365 0a696d70 ynamic.#else.imp │ │ │ │ │ + 0x0114c180 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ │ + 0x0114c190 61702e4c 6f616465 722e5374 61746963 ap.Loader.Static │ │ │ │ │ + 0x0114c1a0 0a23656e 6469660a 0a0a2d2d 2d2d2d2d .#endif...------ │ │ │ │ │ + 0x0114c1b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c1c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c1d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c1e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114c1f0 2d2d2d2d 2d2d2d2d 0a2d2d20 7c205468 --------.-- | Th │ │ │ │ │ + 0x0114c200 69732069 73207468 6520656e 74727920 is is the entry │ │ │ │ │ + 0x0114c210 706f696e 7420666f 72207468 69732077 point for this w │ │ │ │ │ + 0x0114c220 65622073 65727665 72206170 706c6963 eb server applic │ │ │ │ │ + 0x0114c230 6174696f 6e2e2049 74207375 70706f72 ation. It suppor │ │ │ │ │ + 0x0114c240 74730a2d 2d206561 73696c79 20737769 ts.-- easily swi │ │ │ │ │ + 0x0114c250 74636869 6e672062 65747765 656e2069 tching between i │ │ │ │ │ + 0x0114c260 6e746572 70726574 696e6720 736f7572 nterpreting sour │ │ │ │ │ + 0x0114c270 63652061 6e642072 756e6e69 6e672073 ce and running s │ │ │ │ │ + 0x0114c280 74617469 63616c6c 7920636f 6d70696c tatically compil │ │ │ │ │ + 0x0114c290 65640a2d 2d20636f 64652e0a 2d2d0a2d ed.-- code..--.- │ │ │ │ │ + 0x0114c2a0 2d20496e 20656974 68657220 6d6f6465 - In either mode │ │ │ │ │ + 0x0114c2b0 2c207468 65206765 6e657261 74656420 , the generated │ │ │ │ │ + 0x0114c2c0 70726f67 72616d20 73686f75 6c642062 program should b │ │ │ │ │ + 0x0114c2d0 65207275 6e206672 6f6d2074 68652072 e run from the r │ │ │ │ │ + 0x0114c2e0 6f6f7420 6f662074 68650a2d 2d207072 oot of the.-- pr │ │ │ │ │ + 0x0114c2f0 6f6a6563 74207472 65652e20 5768656e oject tree. When │ │ │ │ │ + 0x0114c300 20697420 69732072 756e2c20 6974206c it is run, it l │ │ │ │ │ + 0x0114c310 6f636174 65732069 74732074 656d706c ocates its templ │ │ │ │ │ + 0x0114c320 61746573 2c207374 61746963 20636f6e ates, static con │ │ │ │ │ + 0x0114c330 74656e74 2c20616e 640a2d2d 20736f75 tent, and.-- sou │ │ │ │ │ + 0x0114c340 72636520 66696c65 7320696e 20646576 rce files in dev │ │ │ │ │ + 0x0114c350 656c6f70 6d656e74 206d6f64 652c2072 elopment mode, r │ │ │ │ │ + 0x0114c360 656c6174 69766520 746f2074 68652063 elative to the c │ │ │ │ │ + 0x0114c370 75727265 6e742077 6f726b69 6e672064 urrent working d │ │ │ │ │ + 0x0114c380 69726563 746f7279 2e0a2d2d 0a2d2d20 irectory..--.-- │ │ │ │ │ + 0x0114c390 5768656e 20636f6d 70696c65 64207769 When compiled wi │ │ │ │ │ + 0x0114c3a0 74682074 68652064 6576656c 6f706d65 th the developme │ │ │ │ │ + 0x0114c3b0 6e742066 6c61672c 206f6e6c 79206368 nt flag, only ch │ │ │ │ │ + 0x0114c3c0 616e6765 7320746f 20746865 206c6962 anges to the lib │ │ │ │ │ + 0x0114c3d0 72617269 65732c20 796f7572 0a2d2d20 raries, your.-- │ │ │ │ │ + 0x0114c3e0 63616261 6c206669 6c652c20 6f722074 cabal file, or t │ │ │ │ │ + 0x0114c3f0 68697320 66696c65 2073686f 756c6420 his file should │ │ │ │ │ + 0x0114c400 72657175 69726520 61207265 636f6d70 require a recomp │ │ │ │ │ + 0x0114c410 696c6520 746f2062 65207069 636b6564 ile to be picked │ │ │ │ │ + 0x0114c420 2075702e 0a2d2d20 45766572 79746869 up..-- Everythi │ │ │ │ │ + 0x0114c430 6e672065 6c736520 69732069 6e746572 ng else is inter │ │ │ │ │ + 0x0114c440 70726574 65642061 74207275 6e74696d preted at runtim │ │ │ │ │ + 0x0114c450 652e2054 68657265 20617265 20612066 e. There are a f │ │ │ │ │ + 0x0114c460 65772063 6f6e7365 7175656e 63657320 ew consequences │ │ │ │ │ + 0x0114c470 6f660a2d 2d207468 69732e0a 2d2d0a2d of.-- this..--.- │ │ │ │ │ + 0x0114c480 2d204669 7273742c 20746869 73206973 - First, this is │ │ │ │ │ + 0x0114c490 206d7563 6820736c 6f776572 2e205275 much slower. Ru │ │ │ │ │ + 0x0114c4a0 6e6e696e 67207468 6520696e 74657270 nning the interp │ │ │ │ │ + 0x0114c4b0 72657465 72207461 6b657320 61207369 reter takes a si │ │ │ │ │ + 0x0114c4c0 676e6966 6963616e 740a2d2d 20636875 gnificant.-- chu │ │ │ │ │ + 0x0114c4d0 6e6b206f 66207469 6d652028 6120636f nk of time (a co │ │ │ │ │ + 0x0114c4e0 75706c65 2074656e 74687320 6f662061 uple tenths of a │ │ │ │ │ + 0x0114c4f0 20736563 6f6e6420 6f6e2074 68652061 second on the a │ │ │ │ │ + 0x0114c500 7574686f 72277320 6d616368 696e652c uthor's machine, │ │ │ │ │ + 0x0114c510 20617420 74686973 0a2d2d20 74696d65 at this.-- time │ │ │ │ │ + 0x0114c520 292c2072 65676172 646c6573 73206f66 ), regardless of │ │ │ │ │ + 0x0114c530 20746865 2073696d 706c6963 69747920 the simplicity │ │ │ │ │ + 0x0114c540 6f662074 6865206c 6f616465 6420636f of the loaded co │ │ │ │ │ + 0x0114c550 64652e20 496e206f 72646572 20746f0a de. In order to. │ │ │ │ │ + 0x0114c560 2d2d2072 65636f6d 70696c65 20616e64 -- recompile and │ │ │ │ │ + 0x0114c570 2072652d 6c6f6164 20736572 76657220 re-load server │ │ │ │ │ + 0x0114c580 73746174 65206173 20696e66 72657175 state as infrequ │ │ │ │ │ + 0x0114c590 656e746c 79206173 20706f73 7369626c ently as possibl │ │ │ │ │ + 0x0114c5a0 652c2074 68652073 6f757263 650a2d2d e, the source.-- │ │ │ │ │ + 0x0114c5b0 20646972 6563746f 72696573 20617265 directories are │ │ │ │ │ + 0x0114c5c0 20776174 63686564 20666f72 20757064 watched for upd │ │ │ │ │ + 0x0114c5d0 61746573 2c206173 20617265 20616e79 ates, as are any │ │ │ │ │ + 0x0114c5e0 20657874 72612064 69726563 746f7269 extra directori │ │ │ │ │ + 0x0114c5f0 65732073 70656369 66696564 0a2d2d20 es specified.-- │ │ │ │ │ + 0x0114c600 62656c6f 772e0a2d 2d0a2d2d 20536563 below..--.-- Sec │ │ │ │ │ + 0x0114c610 6f6e642c 20746865 2067656e 65726174 ond, the generat │ │ │ │ │ + 0x0114c620 65642073 65727665 72206269 6e617279 ed server binary │ │ │ │ │ + 0x0114c630 20697320 4d554348 206c6172 6765722c is MUCH larger, │ │ │ │ │ + 0x0114c640 2073696e 63652069 74206c69 6e6b7320 since it links │ │ │ │ │ + 0x0114c650 696e2074 68650a2d 2d204748 43204150 in the.-- GHC AP │ │ │ │ │ + 0x0114c660 49202876 69612074 68652068 696e7420 I (via the hint │ │ │ │ │ + 0x0114c670 6c696272 61727929 2e0a2d2d 0a2d2d20 library)..--.-- │ │ │ │ │ + 0x0114c680 54686972 642c2061 6e642074 68652072 Third, and the r │ │ │ │ │ + 0x0114c690 6561736f 6e20796f 7520776f 756c6420 eason you would │ │ │ │ │ + 0x0114c6a0 65766572 2077616e 7420746f 20616374 ever want to act │ │ │ │ │ + 0x0114c6b0 75616c6c 7920636f 6d70696c 65207769 ually compile wi │ │ │ │ │ + 0x0114c6c0 74680a2d 2d206465 76656c6f 706d656e th.-- developmen │ │ │ │ │ + 0x0114c6d0 74206d6f 64652c20 69732074 68617420 t mode, is that │ │ │ │ │ + 0x0114c6e0 69742065 6e61626c 65732061 20666173 it enables a fas │ │ │ │ │ + 0x0114c6f0 74657220 64657665 6c6f706d 656e7420 ter development │ │ │ │ │ + 0x0114c700 6379636c 652e2059 6f752063 616e0a2d cycle. You can.- │ │ │ │ │ + 0x0114c710 2d207369 6d706c79 20656469 74206120 - simply edit a │ │ │ │ │ + 0x0114c720 66696c65 2c207361 76652079 6f757220 file, save your │ │ │ │ │ + 0x0114c730 6368616e 6765732c 20616e64 20686974 changes, and hit │ │ │ │ │ + 0x0114c740 2072656c 6f616420 746f2073 65652079 reload to see y │ │ │ │ │ + 0x0114c750 6f757220 6368616e 6765730a 2d2d2072 our changes.-- r │ │ │ │ │ + 0x0114c760 65666c65 63746564 20696d6d 65646961 eflected immedia │ │ │ │ │ + 0x0114c770 74656c79 2e0a2d2d 0a2d2d20 5768656e tely..--.-- When │ │ │ │ │ + 0x0114c780 20746869 73206973 20636f6d 70696c65 this is compile │ │ │ │ │ + 0x0114c790 64207769 74686f75 74207468 65206465 d without the de │ │ │ │ │ + 0x0114c7a0 76656c6f 706d656e 7420666c 61672c20 velopment flag, │ │ │ │ │ + 0x0114c7b0 616c6c20 74686520 61637469 6f6e7320 all the actions │ │ │ │ │ + 0x0114c7c0 6172650a 2d2d2073 74617469 63616c6c are.-- staticall │ │ │ │ │ + 0x0114c7d0 7920636f 6d70696c 65642069 6e2e2054 y compiled in. T │ │ │ │ │ + 0x0114c7e0 68697320 72657375 6c747320 696e2066 his results in f │ │ │ │ │ + 0x0114c7f0 61737465 72206578 65637574 696f6e2c aster execution, │ │ │ │ │ + 0x0114c800 20612073 6d616c6c 65722062 696e6172 a smaller binar │ │ │ │ │ + 0x0114c810 790a2d2d 2073697a 652c2061 6e642068 y.-- size, and h │ │ │ │ │ + 0x0114c820 6176696e 6720746f 20726563 6f6d7069 aving to recompi │ │ │ │ │ + 0x0114c830 6c652074 68652073 65727665 7220666f le the server fo │ │ │ │ │ + 0x0114c840 7220616e 7920636f 64652063 68616e67 r any code chang │ │ │ │ │ + 0x0114c850 652e0a2d 2d0a6d61 696e203a 3a20494f e..--.main :: IO │ │ │ │ │ + 0x0114c860 2028290a 6d61696e 203d2064 6f0a2020 ().main = do. │ │ │ │ │ + 0x0114c870 20202d2d 20446570 656e6469 6e67206f -- Depending o │ │ │ │ │ + 0x0114c880 6e207468 65207665 7273696f 6e206f66 n the version of │ │ │ │ │ + 0x0114c890 206c6f61 64536e61 70544820 696e2073 loadSnapTH in s │ │ │ │ │ + 0x0114c8a0 636f7065 2c207468 69732065 69746865 cope, this eithe │ │ │ │ │ + 0x0114c8b0 7220656e 61626c65 730a2020 20202d2d r enables. -- │ │ │ │ │ + 0x0114c8c0 2064796e 616d6963 2072656c 6f616469 dynamic reloadi │ │ │ │ │ + 0x0114c8d0 6e672c20 6f722063 6f6d7069 6c657320 ng, or compiles │ │ │ │ │ + 0x0114c8e0 69742077 6974686f 75742e20 54686520 it without. The │ │ │ │ │ + 0x0114c8f0 6c617374 20617267 756d656e 7420746f last argument to │ │ │ │ │ + 0x0114c900 0a202020 202d2d20 6c6f6164 536e6170 . -- loadSnap │ │ │ │ │ + 0x0114c910 54482069 73206120 6c697374 206f6620 TH is a list of │ │ │ │ │ + 0x0114c920 61646469 74696f6e 616c2064 69726563 additional direc │ │ │ │ │ + 0x0114c930 746f7269 65732074 6f207761 74636820 tories to watch │ │ │ │ │ + 0x0114c940 666f7220 6368616e 67657320 746f0a20 for changes to. │ │ │ │ │ + 0x0114c950 2020202d 2d207472 69676765 72207265 -- trigger re │ │ │ │ │ + 0x0114c960 6c6f6164 7320696e 20646576 656c6f70 loads in develop │ │ │ │ │ + 0x0114c970 6d656e74 206d6f64 652e2049 7420646f ment mode. It do │ │ │ │ │ + 0x0114c980 65736e27 74206e65 65642074 6f20696e esn't need to in │ │ │ │ │ + 0x0114c990 636c7564 6520736f 75726365 0a202020 clude source. │ │ │ │ │ + 0x0114c9a0 202d2d20 64697265 63746f72 6965732c -- directories, │ │ │ │ │ + 0x0114c9b0 2074686f 73652061 72652070 69636b65 those are picke │ │ │ │ │ + 0x0114c9c0 64207570 20617574 6f6d6174 6963616c d up automatical │ │ │ │ │ + 0x0114c9d0 6c792062 79207468 65207370 6c696365 ly by the splice │ │ │ │ │ + 0x0114c9e0 2e0a2020 20202863 6f6e662c 20736974 .. (conf, sit │ │ │ │ │ + 0x0114c9f0 652c2063 6c65616e 75702920 3c2d2024 e, cleanup) <- $ │ │ │ │ │ + 0x0114ca00 286c6f61 64536e61 70544820 5b7c2067 (loadSnapTH [| g │ │ │ │ │ + 0x0114ca10 6574436f 6e66207c 5d0a2020 20202020 etConf |]. │ │ │ │ │ + 0x0114ca20 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114ca30 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114ca40 20202020 27676574 41637469 6f6e730a 'getActions. │ │ │ │ │ + 0x0114ca50 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114ca60 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114ca70 20202020 20202020 20205b22 736e6170 ["snap │ │ │ │ │ + 0x0114ca80 6c657473 2f686569 73742f74 656d706c lets/heist/templ │ │ │ │ │ + 0x0114ca90 61746573 225d290a 0a202020 205f203c ates"]).. _ < │ │ │ │ │ + 0x0114caa0 2d207472 79202420 68747470 53657276 - try $ httpServ │ │ │ │ │ + 0x0114cab0 6520636f 6e662073 69746520 3a3a2049 e conf site :: I │ │ │ │ │ + 0x0114cac0 4f202845 69746865 7220536f 6d654578 O (Either SomeEx │ │ │ │ │ + 0x0114cad0 63657074 696f6e20 2829290a 20202020 ception ()). │ │ │ │ │ + 0x0114cae0 636c6561 6e75700a 0a0a2d2d 2d2d2d2d cleanup...------ │ │ │ │ │ + 0x0114caf0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114cb00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114cb10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114cb20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cb30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ │ - 0x0114cb40 696d706f 72742020 20202020 20202020 import │ │ │ │ │ - 0x0114cb50 20417070 6c696361 74696f6e 0a0a0a2d Application...- │ │ │ │ │ - 0x0114cb60 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cb70 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cb80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cb90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cba0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d0a2d2d -------------.-- │ │ │ │ │ - 0x0114cbb0 207c2052 656e6465 72206c6f 67696e20 | Render login │ │ │ │ │ - 0x0114cbc0 666f726d 0a68616e 646c654c 6f67696e form.handleLogin │ │ │ │ │ - 0x0114cbd0 203a3a20 4d617962 6520542e 54657874 :: Maybe T.Text │ │ │ │ │ - 0x0114cbe0 202d3e20 48616e64 6c657220 41707020 -> Handler App │ │ │ │ │ - 0x0114cbf0 28417574 684d616e 61676572 20417070 (AuthManager App │ │ │ │ │ - 0x0114cc00 29202829 0a68616e 646c654c 6f67696e ) ().handleLogin │ │ │ │ │ - 0x0114cc10 20617574 68457272 6f72203d 20686569 authError = hei │ │ │ │ │ - 0x0114cc20 73744c6f 63616c20 28492e62 696e6453 stLocal (I.bindS │ │ │ │ │ - 0x0114cc30 706c6963 65732065 72727329 20242072 plices errs) $ r │ │ │ │ │ - 0x0114cc40 656e6465 7220226c 6f67696e 220a2020 ender "login". │ │ │ │ │ - 0x0114cc50 77686572 650a2020 20206572 7273203d where. errs = │ │ │ │ │ - 0x0114cc60 206d6179 6265206d 656d7074 79207370 maybe mempty sp │ │ │ │ │ - 0x0114cc70 6c696365 20617574 68457272 6f720a20 lice authError. │ │ │ │ │ - 0x0114cc80 20202073 706c6963 65206572 72203d20 splice err = │ │ │ │ │ - 0x0114cc90 226c6f67 696e4572 726f7222 20232320 "loginError" ## │ │ │ │ │ - 0x0114cca0 492e7465 78745370 6c696365 20657272 I.textSplice err │ │ │ │ │ - 0x0114ccb0 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...------------- │ │ │ │ │ - 0x0114ccc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114ccd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cce0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114ccf0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cd00 2d0a2d2d 207c2048 616e646c 65206c6f -.-- | Handle lo │ │ │ │ │ - 0x0114cd10 67696e20 7375626d 69740a68 616e646c gin submit.handl │ │ │ │ │ - 0x0114cd20 654c6f67 696e5375 626d6974 203a3a20 eLoginSubmit :: │ │ │ │ │ - 0x0114cd30 48616e64 6c657220 41707020 28417574 Handler App (Aut │ │ │ │ │ - 0x0114cd40 684d616e 61676572 20417070 29202829 hManager App) () │ │ │ │ │ - 0x0114cd50 0a68616e 646c654c 6f67696e 5375626d .handleLoginSubm │ │ │ │ │ - 0x0114cd60 6974203d 0a202020 206c6f67 696e5573 it =. loginUs │ │ │ │ │ - 0x0114cd70 65722022 6c6f6769 6e222022 70617373 er "login" "pass │ │ │ │ │ - 0x0114cd80 776f7264 22204e6f 7468696e 670a2020 word" Nothing. │ │ │ │ │ - 0x0114cd90 20202020 20202020 20202020 285c5f20 (\_ │ │ │ │ │ - 0x0114cda0 2d3e2068 616e646c 654c6f67 696e2065 -> handleLogin e │ │ │ │ │ - 0x0114cdb0 72722920 28726564 69726563 7420222f rr) (redirect "/ │ │ │ │ │ - 0x0114cdc0 22290a20 20776865 72650a20 20202065 "). where. e │ │ │ │ │ - 0x0114cdd0 7272203d 204a7573 74202255 6e6b6e6f rr = Just "Unkno │ │ │ │ │ - 0x0114cde0 776e2075 73657220 6f722070 61737377 wn user or passw │ │ │ │ │ - 0x0114cdf0 6f726422 0a0a0a2d 2d2d2d2d 2d2d2d2d ord"...--------- │ │ │ │ │ - 0x0114ce00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114ce10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114ce20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114ce30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114ce40 2d2d2d2d 2d0a2d2d 207c204c 6f677320 -----.-- | Logs │ │ │ │ │ - 0x0114ce50 6f757420 616e6420 72656469 72656374 out and redirect │ │ │ │ │ - 0x0114ce60 73207468 65207573 65722074 6f207468 s the user to th │ │ │ │ │ - 0x0114ce70 65207369 74652069 6e646578 2e0a6861 e site index..ha │ │ │ │ │ - 0x0114ce80 6e646c65 4c6f676f 7574203a 3a204861 ndleLogout :: Ha │ │ │ │ │ - 0x0114ce90 6e646c65 72204170 70202841 7574684d ndler App (AuthM │ │ │ │ │ - 0x0114cea0 616e6167 65722041 70702920 28290a68 anager App) ().h │ │ │ │ │ - 0x0114ceb0 616e646c 654c6f67 6f757420 3d206c6f andleLogout = lo │ │ │ │ │ - 0x0114cec0 676f7574 203e3e20 72656469 72656374 gout >> redirect │ │ │ │ │ - 0x0114ced0 20222f22 0a0a0a2d 2d2d2d2d 2d2d2d2d "/"...--------- │ │ │ │ │ - 0x0114cee0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cef0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cf00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cf10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114cf20 2d2d2d2d 2d0a2d2d 207c2048 616e646c -----.-- | Handl │ │ │ │ │ - 0x0114cf30 65206e65 77207573 65722066 6f726d20 e new user form │ │ │ │ │ - 0x0114cf40 7375626d 69740a68 616e646c 654e6577 submit.handleNew │ │ │ │ │ - 0x0114cf50 55736572 203a3a20 48616e64 6c657220 User :: Handler │ │ │ │ │ - 0x0114cf60 41707020 28417574 684d616e 61676572 App (AuthManager │ │ │ │ │ - 0x0114cf70 20417070 29202829 0a68616e 646c654e App) ().handleN │ │ │ │ │ - 0x0114cf80 65775573 6572203d 206d6574 686f6420 ewUser = method │ │ │ │ │ - 0x0114cf90 47455420 68616e64 6c65466f 726d203c GET handleForm < │ │ │ │ │ - 0x0114cfa0 7c3e206d 6574686f 6420504f 53542068 |> method POST h │ │ │ │ │ - 0x0114cfb0 616e646c 65466f72 6d537562 6d69740a andleFormSubmit. │ │ │ │ │ - 0x0114cfc0 20207768 6572650a 20202020 68616e64 where. hand │ │ │ │ │ - 0x0114cfd0 6c65466f 726d203d 2072656e 64657220 leForm = render │ │ │ │ │ - 0x0114cfe0 226e6577 5f757365 72220a20 20202068 "new_user". h │ │ │ │ │ - 0x0114cff0 616e646c 65466f72 6d537562 6d697420 andleFormSubmit │ │ │ │ │ - 0x0114d000 3d207265 67697374 65725573 65722022 = registerUser " │ │ │ │ │ - 0x0114d010 6c6f6769 6e222022 70617373 776f7264 login" "password │ │ │ │ │ - 0x0114d020 22203e3e 20726564 69726563 7420222f " >> redirect "/ │ │ │ │ │ - 0x0114d030 220a0a0a 2d2d2d2d 2d2d2d2d 2d2d2d2d "...------------ │ │ │ │ │ - 0x0114d040 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d050 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d060 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d070 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d080 2d2d0a2d 2d207c20 54686520 6170706c --.-- | The appl │ │ │ │ │ - 0x0114d090 69636174 696f6e27 7320726f 75746573 ication's routes │ │ │ │ │ - 0x0114d0a0 2e0a726f 75746573 203a3a20 5b284279 ..routes :: [(By │ │ │ │ │ - 0x0114d0b0 74655374 72696e67 2c204861 6e646c65 teString, Handle │ │ │ │ │ - 0x0114d0c0 72204170 70204170 70202829 295d0a72 r App App ())].r │ │ │ │ │ - 0x0114d0d0 6f757465 73203d20 5b202822 6c6f6769 outes = [ ("logi │ │ │ │ │ - 0x0114d0e0 6e222c20 20202077 69746820 61757468 n", with auth │ │ │ │ │ - 0x0114d0f0 2068616e 646c654c 6f67696e 5375626d handleLoginSubm │ │ │ │ │ - 0x0114d100 6974290a 20202020 20202020 202c2028 it). , ( │ │ │ │ │ - 0x0114d110 226c6f67 6f757422 2c202020 77697468 "logout", with │ │ │ │ │ - 0x0114d120 20617574 68206861 6e646c65 4c6f676f auth handleLogo │ │ │ │ │ - 0x0114d130 7574290a 20202020 20202020 202c2028 ut). , ( │ │ │ │ │ - 0x0114d140 226e6577 5f757365 72222c20 77697468 "new_user", with │ │ │ │ │ - 0x0114d150 20617574 68206861 6e646c65 4e657755 auth handleNewU │ │ │ │ │ - 0x0114d160 73657229 0a202020 20202020 20202c20 ser). , │ │ │ │ │ - 0x0114d170 2822222c 20202020 20202020 20736572 ("", ser │ │ │ │ │ - 0x0114d180 76654469 72656374 6f727920 22737461 veDirectory "sta │ │ │ │ │ - 0x0114d190 74696322 290a2020 20202020 2020205d tic"). ] │ │ │ │ │ - 0x0114d1a0 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...------------- │ │ │ │ │ + 0x0114cb30 2d2d2d2d 2d2d2d2d 0a2d2d20 7c205468 --------.-- | Th │ │ │ │ │ + 0x0114cb40 69732061 6374696f 6e206c6f 61647320 is action loads │ │ │ │ │ + 0x0114cb50 74686520 636f6e66 69672075 73656420 the config used │ │ │ │ │ + 0x0114cb60 62792074 68697320 6170706c 69636174 by this applicat │ │ │ │ │ + 0x0114cb70 696f6e2e 20546865 206c6f61 64656420 ion. The loaded │ │ │ │ │ + 0x0114cb80 636f6e66 69670a2d 2d206973 20726574 config.-- is ret │ │ │ │ │ + 0x0114cb90 75726e65 64206173 20746865 20666972 urned as the fir │ │ │ │ │ + 0x0114cba0 73742065 6c656d65 6e74206f 66207468 st element of th │ │ │ │ │ + 0x0114cbb0 65207475 706c6520 70726f64 75636564 e tuple produced │ │ │ │ │ + 0x0114cbc0 20627920 74686520 6c6f6164 536e6170 by the loadSnap │ │ │ │ │ + 0x0114cbd0 54480a2d 2d205370 6c696365 2e205468 TH.-- Splice. Th │ │ │ │ │ + 0x0114cbe0 65207479 70652069 73206e6f 7420736f e type is not so │ │ │ │ │ + 0x0114cbf0 6c69646c 79206669 7865642c 2074686f lidly fixed, tho │ │ │ │ │ + 0x0114cc00 75676820 6974206d 75737420 62652061 ugh it must be a │ │ │ │ │ + 0x0114cc10 6e20494f 20616374 696f6e20 74686174 n IO action that │ │ │ │ │ + 0x0114cc20 0a2d2d20 70726f64 75636573 20746865 .-- produces the │ │ │ │ │ + 0x0114cc30 2073616d 65207479 70652061 73202767 same type as 'g │ │ │ │ │ + 0x0114cc40 65744163 74696f6e 73272074 616b6573 etActions' takes │ │ │ │ │ + 0x0114cc50 2e204974 20616c73 6f206d75 73742062 . It also must b │ │ │ │ │ + 0x0114cc60 6520616e 20696e73 74616e63 65206f66 e an instance of │ │ │ │ │ + 0x0114cc70 0a2d2d20 54797065 61626c65 2e204966 .-- Typeable. If │ │ │ │ │ + 0x0114cc80 20746865 20747970 65206f66 20746869 the type of thi │ │ │ │ │ + 0x0114cc90 73206973 20636861 6e676564 2c206120 s is changed, a │ │ │ │ │ + 0x0114cca0 66756c6c 20726563 6f6d7069 6c652077 full recompile w │ │ │ │ │ + 0x0114ccb0 696c6c20 6265206e 65656465 6420746f ill be needed to │ │ │ │ │ + 0x0114ccc0 0a2d2d20 7069636b 20757020 74686520 .-- pick up the │ │ │ │ │ + 0x0114ccd0 6368616e 67652c20 6576656e 20696e20 change, even in │ │ │ │ │ + 0x0114cce0 64657665 6c6f706d 656e7420 6d6f6465 development mode │ │ │ │ │ + 0x0114ccf0 2e0a2d2d 0a2d2d20 54686973 20616374 ..--.-- This act │ │ │ │ │ + 0x0114cd00 696f6e20 6973206f 6e6c7920 72756e20 ion is only run │ │ │ │ │ + 0x0114cd10 6f6e6365 2c207265 67617264 6c657373 once, regardless │ │ │ │ │ + 0x0114cd20 206f6620 77686574 68657220 64657665 of whether deve │ │ │ │ │ + 0x0114cd30 6c6f706d 656e7420 6f720a2d 2d207072 lopment or.-- pr │ │ │ │ │ + 0x0114cd40 6f647563 74696f6e 206d6f64 65206973 oduction mode is │ │ │ │ │ + 0x0114cd50 20696e20 7573652e 0a676574 436f6e66 in use..getConf │ │ │ │ │ + 0x0114cd60 203a3a20 494f2028 436f6e66 69672053 :: IO (Config S │ │ │ │ │ + 0x0114cd70 6e617020 41707043 6f6e6669 67290a67 nap AppConfig).g │ │ │ │ │ + 0x0114cd80 6574436f 6e66203d 20636f6d 6d616e64 etConf = command │ │ │ │ │ + 0x0114cd90 4c696e65 41707043 6f6e6669 67206465 LineAppConfig de │ │ │ │ │ + 0x0114cda0 6661756c 74436f6e 6669670a 0a0a2d2d faultConfig...-- │ │ │ │ │ + 0x0114cdb0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114cdc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114cdd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114cde0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114cdf0 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a2d2d20 ------------.-- │ │ │ │ │ + 0x0114ce00 7c205468 69732066 756e6374 696f6e20 | This function │ │ │ │ │ + 0x0114ce10 67656e65 72617465 73207468 65207468 generates the th │ │ │ │ │ + 0x0114ce20 65207369 74652068 616e646c 65722061 e site handler a │ │ │ │ │ + 0x0114ce30 6e642063 6c65616e 75702061 6374696f nd cleanup actio │ │ │ │ │ + 0x0114ce40 6e206672 6f6d2074 68650a2d 2d20636f n from the.-- co │ │ │ │ │ + 0x0114ce50 6e666967 75726174 696f6e2e 20496e20 nfiguration. In │ │ │ │ │ + 0x0114ce60 70726f64 75637469 6f6e206d 6f64652c production mode, │ │ │ │ │ + 0x0114ce70 20746869 73206163 74696f6e 20697320 this action is │ │ │ │ │ + 0x0114ce80 6f6e6c79 2072756e 206f6e63 652e2049 only run once. I │ │ │ │ │ + 0x0114ce90 6e0a2d2d 20646576 656c6f70 6d656e74 n.-- development │ │ │ │ │ + 0x0114cea0 206d6f64 652c2074 68697320 61637469 mode, this acti │ │ │ │ │ + 0x0114ceb0 6f6e2069 73207275 6e207768 656e6576 on is run whenev │ │ │ │ │ + 0x0114cec0 65722074 68652061 70706c69 63617469 er the applicati │ │ │ │ │ + 0x0114ced0 6f6e2069 73207265 6c6f6164 65642e0a on is reloaded.. │ │ │ │ │ + 0x0114cee0 2d2d0a2d 2d204465 76656c6f 706d656e --.-- Developmen │ │ │ │ │ + 0x0114cef0 74206d6f 64652061 6c736f20 6d616b65 t mode also make │ │ │ │ │ + 0x0114cf00 73207375 72652074 68617420 74686520 s sure that the │ │ │ │ │ + 0x0114cf10 636c6561 6e757020 61637469 6f6e7320 cleanup actions │ │ │ │ │ + 0x0114cf20 61726520 72756e0a 2d2d2061 7070726f are run.-- appro │ │ │ │ │ + 0x0114cf30 70726961 74656c79 20626566 6f726520 priately before │ │ │ │ │ + 0x0114cf40 73687574 646f776e 2e205468 6520636c shutdown. The cl │ │ │ │ │ + 0x0114cf50 65616e75 70206163 74696f6e 20726574 eanup action ret │ │ │ │ │ + 0x0114cf60 75726e65 64206672 6f6d206c 6f616453 urned from loadS │ │ │ │ │ + 0x0114cf70 6e617054 480a2d2d 2073686f 756c6420 napTH.-- should │ │ │ │ │ + 0x0114cf80 7374696c 6c206265 20757365 64206166 still be used af │ │ │ │ │ + 0x0114cf90 74657220 74686520 73657276 65722068 ter the server h │ │ │ │ │ + 0x0114cfa0 61732073 746f7070 65642068 616e646c as stopped handl │ │ │ │ │ + 0x0114cfb0 696e6720 72657175 65737473 2c206173 ing requests, as │ │ │ │ │ + 0x0114cfc0 20746865 0a2d2d20 636c6561 6e757020 the.-- cleanup │ │ │ │ │ + 0x0114cfd0 61637469 6f6e7320 61726520 6f6e6c79 actions are only │ │ │ │ │ + 0x0114cfe0 20617574 6f6d6174 6963616c 6c792072 automatically r │ │ │ │ │ + 0x0114cff0 756e2077 68656e20 61207265 6c6f6164 un when a reload │ │ │ │ │ + 0x0114d000 20697320 74726967 67657265 642e0a2d is triggered..- │ │ │ │ │ + 0x0114d010 2d0a2d2d 20546869 73207361 6d706c65 -.-- This sample │ │ │ │ │ + 0x0114d020 20646f65 736e2774 20616374 75616c6c doesn't actuall │ │ │ │ │ + 0x0114d030 79207573 65207468 6520636f 6e666967 y use the config │ │ │ │ │ + 0x0114d040 20706173 73656420 696e2c20 62757420 passed in, but │ │ │ │ │ + 0x0114d050 6d6f7265 0a2d2d20 736f7068 69737469 more.-- sophisti │ │ │ │ │ + 0x0114d060 63617465 6420636f 6465206d 69676874 cated code might │ │ │ │ │ + 0x0114d070 2e0a6765 74416374 696f6e73 203a3a20 ..getActions :: │ │ │ │ │ + 0x0114d080 436f6e66 69672053 6e617020 41707043 Config Snap AppC │ │ │ │ │ + 0x0114d090 6f6e6669 67202d3e 20494f20 28536e61 onfig -> IO (Sna │ │ │ │ │ + 0x0114d0a0 70202829 2c20494f 20282929 0a676574 p (), IO ()).get │ │ │ │ │ + 0x0114d0b0 41637469 6f6e7320 636f6e66 203d2064 Actions conf = d │ │ │ │ │ + 0x0114d0c0 6f0a2020 2020286d 7367732c 20736974 o. (msgs, sit │ │ │ │ │ + 0x0114d0d0 652c2063 6c65616e 75702920 3c2d2072 e, cleanup) <- r │ │ │ │ │ + 0x0114d0e0 756e536e 61706c65 740a2020 20202020 unSnaplet. │ │ │ │ │ + 0x0114d0f0 20202861 7070456e 7669726f 6e6d656e (appEnvironmen │ │ │ │ │ + 0x0114d100 74203d3c 3c206765 744f7468 65722063 t =<< getOther c │ │ │ │ │ + 0x0114d110 6f6e6629 20617070 0a202020 20685075 onf) app. hPu │ │ │ │ │ + 0x0114d120 74537472 4c6e2073 74646572 72202420 tStrLn stderr $ │ │ │ │ │ + 0x0114d130 542e756e 7061636b 206d7367 730a2020 T.unpack msgs. │ │ │ │ │ + 0x0114d140 20207265 7475726e 20287369 74652c20 return (site, │ │ │ │ │ + 0x0114d150 636c6561 6e757029 0a007b2d 23204c41 cleanup)..{-# LA │ │ │ │ │ + 0x0114d160 4e475541 47452054 656d706c 61746548 NGUAGE TemplateH │ │ │ │ │ + 0x0114d170 61736b65 6c6c2023 2d7d0a0a 2d2d2d2d askell #-}..---- │ │ │ │ │ + 0x0114d180 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d190 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d1a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ 0x0114d1b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d1c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d1d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d1e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ - 0x0114d1f0 2d0a2d2d 207c2054 68652061 70706c69 -.-- | The appli │ │ │ │ │ - 0x0114d200 63617469 6f6e2069 6e697469 616c697a cation initializ │ │ │ │ │ - 0x0114d210 65722e0a 61707020 3a3a2053 6e61706c er..app :: Snapl │ │ │ │ │ - 0x0114d220 6574496e 69742041 70702041 70700a61 etInit App App.a │ │ │ │ │ - 0x0114d230 7070203d 206d616b 65536e61 706c6574 pp = makeSnaplet │ │ │ │ │ - 0x0114d240 20226170 70222022 416e2073 6e61706c "app" "An snapl │ │ │ │ │ - 0x0114d250 65742065 78616d70 6c652061 70706c69 et example appli │ │ │ │ │ - 0x0114d260 63617469 6f6e2e22 204e6f74 68696e67 cation." Nothing │ │ │ │ │ - 0x0114d270 20242064 6f0a2020 20206820 3c2d206e $ do. h <- n │ │ │ │ │ - 0x0114d280 65737453 6e61706c 65742022 22206865 estSnaplet "" he │ │ │ │ │ - 0x0114d290 69737420 24206865 69737449 6e697420 ist $ heistInit │ │ │ │ │ - 0x0114d2a0 2274656d 706c6174 6573220a 20202020 "templates". │ │ │ │ │ - 0x0114d2b0 73203c2d 206e6573 74536e61 706c6574 s <- nestSnaplet │ │ │ │ │ - 0x0114d2c0 20227365 73732220 73657373 20240a20 "sess" sess $. │ │ │ │ │ - 0x0114d2d0 20202020 20202020 2020696e 6974436f initCo │ │ │ │ │ - 0x0114d2e0 6f6b6965 53657373 696f6e4d 616e6167 okieSessionManag │ │ │ │ │ - 0x0114d2f0 65722022 73697465 5f6b6579 2e747874 er "site_key.txt │ │ │ │ │ - 0x0114d300 22202273 65737322 204e6f74 68696e67 " "sess" Nothing │ │ │ │ │ - 0x0114d310 20284a75 73742033 36303029 0a0a2020 (Just 3600).. │ │ │ │ │ - 0x0114d320 20202d2d 204e4f54 453a2057 65277265 -- NOTE: We're │ │ │ │ │ - 0x0114d330 20757369 6e672069 6e69744a 736f6e46 using initJsonF │ │ │ │ │ - 0x0114d340 696c6541 7574684d 616e6167 65722068 ileAuthManager h │ │ │ │ │ - 0x0114d350 65726520 62656361 75736520 69742773 ere because it's │ │ │ │ │ - 0x0114d360 20656173 7920616e 640a2020 20202d2d easy and. -- │ │ │ │ │ - 0x0114d370 20646f65 736e2774 20726571 75697265 doesn't require │ │ │ │ │ - 0x0114d380 20616e79 206b696e 64206f66 20646174 any kind of dat │ │ │ │ │ - 0x0114d390 61626173 65207365 72766572 20746f20 abase server to │ │ │ │ │ - 0x0114d3a0 72756e2e 2020496e 20707261 63746963 run. In practic │ │ │ │ │ - 0x0114d3b0 652c0a20 2020202d 2d20796f 75276c6c e,. -- you'll │ │ │ │ │ - 0x0114d3c0 2070726f 6261626c 79207761 6e742074 probably want t │ │ │ │ │ - 0x0114d3d0 6f206368 616e6765 20746869 7320746f o change this to │ │ │ │ │ - 0x0114d3e0 2061206d 6f726520 726f6275 73742061 a more robust a │ │ │ │ │ - 0x0114d3f0 75746820 6261636b 656e642e 0a202020 uth backend.. │ │ │ │ │ - 0x0114d400 2061203c 2d206e65 7374536e 61706c65 a <- nestSnaple │ │ │ │ │ - 0x0114d410 74202261 75746822 20617574 6820240a t "auth" auth $. │ │ │ │ │ - 0x0114d420 20202020 20202020 20202069 6e69744a initJ │ │ │ │ │ - 0x0114d430 736f6e46 696c6541 7574684d 616e6167 sonFileAuthManag │ │ │ │ │ - 0x0114d440 65722064 65664175 74685365 7474696e er defAuthSettin │ │ │ │ │ - 0x0114d450 67732073 65737320 22757365 72732e6a gs sess "users.j │ │ │ │ │ - 0x0114d460 736f6e22 0a202020 20616464 526f7574 son". addRout │ │ │ │ │ - 0x0114d470 65732072 6f757465 730a2020 20206164 es routes. ad │ │ │ │ │ - 0x0114d480 64417574 6853706c 69636573 20682061 dAuthSplices h a │ │ │ │ │ - 0x0114d490 7574680a 20202020 72657475 726e2024 uth. return $ │ │ │ │ │ - 0x0114d4a0 20417070 20682073 20610a0a 002e2f73 App h s a..../s │ │ │ │ │ - 0x0114d4b0 72632f53 6974652e 6873003c 68746d6c rc/Site.hs.. . < │ │ │ │ │ - 0x0114d4d0 7469746c 653e536e 61702077 65622073 title>Snap web s │ │ │ │ │ - 0x0114d4e0 65727665 723c2f74 69746c65 3e0a2020 erver. │ │ │ │ │ - 0x0114d4f0 20203c6c 696e6b20 72656c3d 22737479 . │ │ │ │ │ - 0x0114d530 3c2f6865 61643e0a 20203c62 6f64793e . │ │ │ │ │ - 0x0114d540 0a202020 203c6469 76206964 3d22636f .
.. < │ │ │ │ │ - 0x0114d560 6170706c 792d636f 6e74656e 742f3e0a apply-content/>. │ │ │ │ │ - 0x0114d570 0a202020 203c2f64 69763e0a 20203c2f .
. .... │ │ │ │ │ - 0x0114d590 2f736e61 706c6574 732f6865 6973742f /snaplets/heist/ │ │ │ │ │ - 0x0114d5a0 74656d70 6c617465 732f6261 73652e74 templates/base.t │ │ │ │ │ - 0x0114d5b0 706c003c 68313e53 6e617020 4578616d pl.

Snap Exam │ │ │ │ │ - 0x0114d5c0 706c6520 41707020 4c6f6769 6e3c2f68 ple App Login..

../login.< │ │ │ │ │ - 0x0114d610 62696e64 20746167 3d227375 626d6974 bind tag="submit │ │ │ │ │ - 0x0114d620 54657874 223e4c6f 67696e3c 2f62696e Text">Login.. │ │ │ │ │ - 0x0114d650 0a3c703e 446f6e27 74206861 76652061 .

Don't have a │ │ │ │ │ - 0x0114d660 206c6f67 696e2079 65743f20 3c612068 login yet? │ │ │ │ │ - 0x0114d680 43726561 74652061 206e6577 20757365 Create a new use │ │ │ │ │ - 0x0114d690 723c2f61 3e3c2f70 3e0a002e 2f736e61 r

.../sna │ │ │ │ │ - 0x0114d6a0 706c6574 732f6865 6973742f 74656d70 plets/heist/temp │ │ │ │ │ - 0x0114d6b0 6c617465 732f5f6c 6f67696e 2e74706c lates/_login.tpl │ │ │ │ │ - 0x0114d6c0 003c6831 3e526567 69737465 72206120 .

Register a │ │ │ │ │ - 0x0114d6d0 6e657720 75736572 3c2f6831 3e0a0a3c new user

..< │ │ │ │ │ - 0x0114d6e0 62696e64 20746167 3d22706f 73744163 bind tag="postAc │ │ │ │ │ - 0x0114d6f0 74696f6e 223e2f6e 65775f75 7365723c tion">/new_user< │ │ │ │ │ - 0x0114d700 2f62696e 643e0a3c 62696e64 20746167 /bind>.Ad │ │ │ │ │ - 0x0114d720 64205573 65723c2f 62696e64 3e0a3c61 d User..../sn │ │ │ │ │ - 0x0114d750 61706c65 74732f68 65697374 2f74656d aplets/heist/tem │ │ │ │ │ - 0x0114d760 706c6174 65732f5f 6e65775f 75736572 plates/_new_user │ │ │ │ │ - 0x0114d770 2e74706c 003c6170 706c7920 74656d70 .tpl.. < │ │ │ │ │ - 0x0114d790 6170706c 79207465 6d706c61 74653d22 apply template=" │ │ │ │ │ - 0x0114d7a0 5f6c6f67 696e222f 3e0a3c2f 6170706c _login"/>..../snaplets/h │ │ │ │ │ - 0x0114d7c0 65697374 2f74656d 706c6174 65732f6c eist/templates/l │ │ │ │ │ - 0x0114d7d0 6f67696e 2e74706c 003c6170 706c7920 ogin.tpl. │ │ │ │ │ - 0x0114d7f0 0a0a2020 3c69664c 6f676765 64496e3e .. │ │ │ │ │ - 0x0114d800 0a202020 203c703e 0a202020 20202054 .

. T │ │ │ │ │ - 0x0114d810 68697320 69732061 2073696d 706c6520 his is a simple │ │ │ │ │ - 0x0114d820 64656d6f 20706167 65207365 72766564 demo page served │ │ │ │ │ - 0x0114d830 20757369 6e670a20 20202020 203c6120 using. Heist. │ │ │ │ │ - 0x0114d880 20202020 20616e64 20746865 203c6120 and the Snap web fr │ │ │ │ │ - 0x0114d8c0 616d6577 6f726b2e 0a202020 203c2f70 amework..

..

Congra │ │ │ │ │ - 0x0114d8e0 74732120 20596f75 27726520 6c6f6767 ts! You're logg │ │ │ │ │ - 0x0114d8f0 65642069 6e206173 20273c6c 6f676765 ed in as ''

.. │ │ │ │ │ - 0x0114d910 20202020 3c703e3c 61206872 65663d22

Logout< │ │ │ │ │ - 0x0114d930 2f613e3c 2f703e0a 20203c2f 69664c6f /a>

. .. . . ...../snaplets/h │ │ │ │ │ - 0x0114d9a0 65697374 2f74656d 706c6174 65732f69 eist/templates/i │ │ │ │ │ - 0x0114d9b0 6e646578 2e74706c 003c666f 726d206d ndex.tpl.. . . . │ │ │ │ │ - 0x0114da50 203c2f74 723e0a20 2020203c 74723e0a . . │ │ │ │ │ - 0x0114da60 20202020 20203c74 643e5061 7373776f . │ │ │ │ │ - 0x0114dac0 2020203c 74723e0a 20202020 20203c74 . . < │ │ │ │ │ - 0x0114db10 2f74643e 0a202020 203c2f74 723e0a20 /td>. . │ │ │ │ │ - 0x0114db20 203c2f74 61626c65 3e0a3c2f 666f726d
Logi │ │ │ │ │ - 0x0114da10 6e3a3c2f 74643e3c 74643e3c 696e7075 n:
Passwo │ │ │ │ │ - 0x0114da70 72643a3c 2f74643e 3c74643e 3c696e70 rd:< │ │ │ │ │ - 0x0114dab0 2f74643e 0a202020 203c2f74 723e0a20 /td>.
..../snaplets/he │ │ │ │ │ - 0x0114db40 6973742f 74656d70 6c617465 732f7573 ist/templates/us │ │ │ │ │ - 0x0114db50 6572666f 726d2e74 706c003c 6170706c erform.tpl.. ..../ │ │ │ │ │ - 0x0114dba0 736e6170 6c657473 2f686569 73742f74 snaplets/heist/t │ │ │ │ │ - 0x0114dbb0 656d706c 61746573 2f6e6577 5f757365 emplates/new_use │ │ │ │ │ - 0x0114dbc0 722e7470 6c004e61 6d653a20 20202020 r.tpl.Name: │ │ │ │ │ - 0x0114dbd0 20202020 20202020 20202070 726f6a6e projn │ │ │ │ │ - 0x0114dbe0 616d650a 56657273 696f6e3a 20202020 ame.Version: │ │ │ │ │ - 0x0114dbf0 20202020 20202020 20302e31 0a53796e 0.1.Syn │ │ │ │ │ - 0x0114dc00 6f707369 733a2020 20202020 20202020 opsis: │ │ │ │ │ - 0x0114dc10 20205072 6f6a6563 74205379 6e6f7073 Project Synops │ │ │ │ │ - 0x0114dc20 69732048 6572650a 44657363 72697074 is Here.Descript │ │ │ │ │ - 0x0114dc30 696f6e3a 20202020 20202020 2050726f ion: Pro │ │ │ │ │ - 0x0114dc40 6a656374 20446573 63726970 74696f6e ject Description │ │ │ │ │ - 0x0114dc50 20486572 650a4c69 63656e73 653a2020 Here.License: │ │ │ │ │ - 0x0114dc60 20202020 20202020 20202041 6c6c5269 AllRi │ │ │ │ │ - 0x0114dc70 67687473 52657365 72766564 0a417574 ghtsReserved.Aut │ │ │ │ │ - 0x0114dc80 686f723a 20202020 20202020 20202020 hor: │ │ │ │ │ - 0x0114dc90 20204175 74686f72 0a4d6169 6e746169 Author.Maintai │ │ │ │ │ - 0x0114dca0 6e65723a 20202020 20202020 20206d61 ner: ma │ │ │ │ │ - 0x0114dcb0 696e7461 696e6572 40657861 6d706c65 intainer@example │ │ │ │ │ - 0x0114dcc0 2e636f6d 0a537461 62696c69 74793a20 .com.Stability: │ │ │ │ │ - 0x0114dcd0 20202020 20202020 20204578 70657269 Experi │ │ │ │ │ - 0x0114dce0 6d656e74 616c0a43 61746567 6f72793a mental.Category: │ │ │ │ │ - 0x0114dcf0 20202020 20202020 20202020 5765620a Web. │ │ │ │ │ - 0x0114dd00 4275696c 642d7479 70653a20 20202020 Build-type: │ │ │ │ │ - 0x0114dd10 20202020 2053696d 706c650a 43616261 Simple.Caba │ │ │ │ │ - 0x0114dd20 6c2d7665 7273696f 6e3a2020 20202020 l-version: │ │ │ │ │ - 0x0114dd30 203e3d31 2e320a0a 466c6167 20646576 >=1.2..Flag dev │ │ │ │ │ - 0x0114dd40 656c6f70 6d656e74 0a202044 65736372 elopment. Descr │ │ │ │ │ - 0x0114dd50 69707469 6f6e3a20 57686574 68657220 iption: Whether │ │ │ │ │ - 0x0114dd60 746f2062 75696c64 20746865 20736572 to build the ser │ │ │ │ │ - 0x0114dd70 76657220 696e2064 6576656c 6f706d65 ver in developme │ │ │ │ │ - 0x0114dd80 6e742028 696e7465 72707265 74656429 nt (interpreted) │ │ │ │ │ - 0x0114dd90 206d6f64 650a2020 44656661 756c743a mode. Default: │ │ │ │ │ - 0x0114dda0 2046616c 73650a0a 466c6167 206f6c64 False..Flag old │ │ │ │ │ - 0x0114ddb0 2d626173 650a2020 64656661 756c743a -base. default: │ │ │ │ │ - 0x0114ddc0 2046616c 73650a20 206d616e 75616c3a False. manual: │ │ │ │ │ - 0x0114ddd0 2046616c 73650a0a 45786563 75746162 False..Executab │ │ │ │ │ - 0x0114dde0 6c652070 726f6a6e 616d650a 20206873 le projname. hs │ │ │ │ │ - 0x0114ddf0 2d736f75 7263652d 64697273 3a207372 -source-dirs: sr │ │ │ │ │ - 0x0114de00 630a2020 6d61696e 2d69733a 204d6169 c. main-is: Mai │ │ │ │ │ - 0x0114de10 6e2e6873 0a0a2020 4275696c 642d6465 n.hs.. Build-de │ │ │ │ │ - 0x0114de20 70656e64 733a0a20 20202062 61736520 pends:. base │ │ │ │ │ - 0x0114de30 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114de40 20202020 203e3d20 342e3420 20202020 >= 4.4 │ │ │ │ │ - 0x0114de50 2626203c 20352c0a 20202020 62797465 && < 5,. byte │ │ │ │ │ - 0x0114de60 73747269 6e672020 20202020 20202020 string │ │ │ │ │ - 0x0114de70 20202020 20203e3d 20302e39 2e312020 >= 0.9.1 │ │ │ │ │ - 0x0114de80 20262620 3c20302e 31312c0a 20202020 && < 0.11,. │ │ │ │ │ - 0x0114de90 68656973 74202020 20202020 20202020 heist │ │ │ │ │ - 0x0114dea0 20202020 20202020 20203e3d 20312e30 >= 1.0 │ │ │ │ │ - 0x0114deb0 20202020 20262620 3c20312e 322c0a20 && < 1.2,. │ │ │ │ │ - 0x0114dec0 2020206c 656e7320 20202020 20202020 lens │ │ │ │ │ - 0x0114ded0 20202020 20202020 20202020 203e3d20 >= │ │ │ │ │ - 0x0114dee0 332e372e 36202020 2626203c 20342e31 3.7.6 && < 4.1 │ │ │ │ │ - 0x0114def0 382c0a20 2020206d 61702d73 796e7461 8,. map-synta │ │ │ │ │ - 0x0114df00 78202020 20202020 20202020 20202020 x │ │ │ │ │ - 0x0114df10 203e3d20 302e3220 20202020 2626203c >= 0.2 && < │ │ │ │ │ - 0x0114df20 20302e34 2c0a2020 20206d6f 6e61642d 0.4,. monad- │ │ │ │ │ - 0x0114df30 636f6e74 726f6c20 20202020 20202020 control │ │ │ │ │ - 0x0114df40 20202020 3e3d2031 2e302020 20202026 >= 1.0 & │ │ │ │ │ - 0x0114df50 26203c20 312e312c 0a202020 206d746c & < 1.1,. mtl │ │ │ │ │ - 0x0114df60 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114df70 20202020 2020203e 3d203220 20202020 >= 2 │ │ │ │ │ - 0x0114df80 20202626 203c2032 2e332c0a 20202020 && < 2.3,. │ │ │ │ │ - 0x0114df90 736e6170 20202020 20202020 20202020 snap │ │ │ │ │ - 0x0114dfa0 20202020 20202020 20203e3d 20312e30 >= 1.0 │ │ │ │ │ - 0x0114dfb0 20202020 20262620 3c20312e 322c0a20 && < 1.2,. │ │ │ │ │ - 0x0114dfc0 20202073 6e61702d 636f7265 20202020 snap-core │ │ │ │ │ - 0x0114dfd0 20202020 20202020 20202020 203e3d20 >= │ │ │ │ │ - 0x0114dfe0 312e3020 20202020 2626203c 20312e31 1.0 && < 1.1 │ │ │ │ │ - 0x0114dff0 2c0a2020 2020736e 61702d73 65727665 ,. snap-serve │ │ │ │ │ - 0x0114e000 72202020 20202020 20202020 20202020 r │ │ │ │ │ - 0x0114e010 3e3d2031 2e302020 20202026 26203c20 >= 1.0 && < │ │ │ │ │ - 0x0114e020 312e322c 0a202020 20736e61 702d6c6f 1.2,. snap-lo │ │ │ │ │ - 0x0114e030 61646572 2d737461 74696320 20202020 ader-static │ │ │ │ │ - 0x0114e040 2020203e 3d20312e 30202020 20202626 >= 1.0 && │ │ │ │ │ - 0x0114e050 203c2031 2e312c0a 20202020 74657874 < 1.1,. text │ │ │ │ │ - 0x0114e060 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114e070 20202020 20203e3d 20302e31 31202020 >= 0.11 │ │ │ │ │ - 0x0114e080 20262620 3c20312e 332c0a20 20202074 && < 1.3,. t │ │ │ │ │ - 0x0114e090 696d6520 20202020 20202020 20202020 ime │ │ │ │ │ - 0x0114e0a0 20202020 20202020 203e3d20 312e3120 >= 1.1 │ │ │ │ │ - 0x0114e0b0 20202020 2626203c 20312e39 2c0a2020 && < 1.9,. │ │ │ │ │ - 0x0114e0c0 2020786d 6c68746d 6c202020 20202020 xmlhtml │ │ │ │ │ - 0x0114e0d0 20202020 20202020 20202020 3e3d2030 >= 0 │ │ │ │ │ - 0x0114e0e0 2e312020 20202026 26203c20 302e330a .1 && < 0.3. │ │ │ │ │ - 0x0114e0f0 0a202069 6620666c 61672864 6576656c . if flag(devel │ │ │ │ │ - 0x0114e100 6f706d65 6e74290a 20202020 6275696c opment). buil │ │ │ │ │ - 0x0114e110 642d6465 70656e64 733a0a20 20202020 d-depends:. │ │ │ │ │ - 0x0114e120 20736e61 702d6c6f 61646572 2d64796e snap-loader-dyn │ │ │ │ │ - 0x0114e130 616d6963 203e3d20 312e3020 2626203c amic >= 1.0 && < │ │ │ │ │ - 0x0114e140 20312e31 0a202020 20637070 2d6f7074 1.1. cpp-opt │ │ │ │ │ - 0x0114e150 696f6e73 3a202d44 44455645 4c4f504d ions: -DDEVELOPM │ │ │ │ │ - 0x0114e160 454e540a 20202020 2d2d2049 6e206465 ENT. -- In de │ │ │ │ │ - 0x0114e170 76656c6f 706d656e 74206d6f 64652c20 velopment mode, │ │ │ │ │ - 0x0114e180 73706565 64206973 20616c72 65616479 speed is already │ │ │ │ │ - 0x0114e190 20676f69 6e672074 6f207375 66666572 going to suffer │ │ │ │ │ - 0x0114e1a0 2c20736f 20736b69 700a2020 20202d2d , so skip. -- │ │ │ │ │ - 0x0114e1b0 20746865 2066616e 6379206f 7074696d the fancy optim │ │ │ │ │ - 0x0114e1c0 697a6174 696f6e20 666c6167 732e2020 ization flags. │ │ │ │ │ - 0x0114e1d0 41646469 74696f6e 616c6c79 2c206469 Additionally, di │ │ │ │ │ - 0x0114e1e0 7361626c 6520616c 6c0a2020 20202d2d sable all. -- │ │ │ │ │ - 0x0114e1f0 20776172 6e696e67 732e2020 54686520 warnings. The │ │ │ │ │ - 0x0114e200 68696e74 206c6962 72617279 20646f65 hint library doe │ │ │ │ │ - 0x0114e210 736e2774 20676976 6520616e 206f7074 sn't give an opt │ │ │ │ │ - 0x0114e220 696f6e20 746f2065 78656375 74650a20 ion to execute. │ │ │ │ │ - 0x0114e230 2020202d 2d20636f 6d70696c 65642063 -- compiled c │ │ │ │ │ - 0x0114e240 6f646520 7768656e 20746865 72652077 ode when there w │ │ │ │ │ - 0x0114e250 65726520 616c736f 20776172 6e696e67 ere also warning │ │ │ │ │ - 0x0114e260 732c2073 6f206469 7361626c 696e670a s, so disabling. │ │ │ │ │ - 0x0114e270 20202020 2d2d2077 61726e69 6e677320 -- warnings │ │ │ │ │ - 0x0114e280 616c6c6f 77732071 7569636b 65722077 allows quicker w │ │ │ │ │ - 0x0114e290 6f726b66 6c6f772e 0a202020 20676863 orkflow.. ghc │ │ │ │ │ - 0x0114e2a0 2d6f7074 696f6e73 3a202d74 68726561 -options: -threa │ │ │ │ │ - 0x0114e2b0 64656420 2d770a20 20656c73 650a2020 ded -w. else. │ │ │ │ │ - 0x0114e2c0 20206966 20696d70 6c286768 63203e3d if impl(ghc >= │ │ │ │ │ - 0x0114e2d0 20362e31 322e3029 0a202020 20202067 6.12.0). g │ │ │ │ │ - 0x0114e2e0 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ │ - 0x0114e2f0 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ │ - 0x0114e300 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ │ - 0x0114e310 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ │ - 0x0114e320 320a2020 20202020 20202020 20202020 2. │ │ │ │ │ - 0x0114e330 20202020 202d666e 6f2d7761 726e2d6f -fno-warn-o │ │ │ │ │ - 0x0114e340 72706861 6e73202d 666e6f2d 7761726e rphans -fno-warn │ │ │ │ │ - 0x0114e350 2d756e75 7365642d 646f2d62 696e640a -unused-do-bind. │ │ │ │ │ - 0x0114e360 20202020 656c7365 0a202020 20202067 else. g │ │ │ │ │ - 0x0114e370 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ │ - 0x0114e380 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ │ - 0x0114e390 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ │ - 0x0114e3a0 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ │ - 0x0114e3b0 320a2020 20202020 20202020 20202020 2. │ │ │ │ │ - 0x0114e3c0 20202020 202d666e 6f2d7761 726e2d6f -fno-warn-o │ │ │ │ │ - 0x0114e3d0 72706861 6e730a00 68746d6c 207b0a20 rphans..html {. │ │ │ │ │ + 0x0114d1c0 2d2d2d2d 2d2d2d2d 2d2d0a2d 2d207c20 ----------.-- | │ │ │ │ │ + 0x0114d1d0 54686973 206d6f64 756c6520 64656669 This module defi │ │ │ │ │ + 0x0114d1e0 6e657320 6f757220 6170706c 69636174 nes our applicat │ │ │ │ │ + 0x0114d1f0 696f6e27 73207374 61746520 74797065 ion's state type │ │ │ │ │ + 0x0114d200 20616e64 20616e20 616c6961 7320666f and an alias fo │ │ │ │ │ + 0x0114d210 72206974 730a2d2d 2068616e 646c6572 r its.-- handler │ │ │ │ │ + 0x0114d220 206d6f6e 61642e0a 6d6f6475 6c652041 monad..module A │ │ │ │ │ + 0x0114d230 70706c69 63617469 6f6e2077 68657265 pplication where │ │ │ │ │ + 0x0114d240 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ │ + 0x0114d250 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d260 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d270 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d280 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d290 0a696d70 6f727420 436f6e74 726f6c2e .import Control. │ │ │ │ │ + 0x0114d2a0 4c656e73 0a696d70 6f727420 536e6170 Lens.import Snap │ │ │ │ │ + 0x0114d2b0 2e536e61 706c6574 0a696d70 6f727420 .Snaplet.import │ │ │ │ │ + 0x0114d2c0 536e6170 2e536e61 706c6574 2e486569 Snap.Snaplet.Hei │ │ │ │ │ + 0x0114d2d0 73740a69 6d706f72 7420536e 61702e53 st.import Snap.S │ │ │ │ │ + 0x0114d2e0 6e61706c 65742e41 7574680a 696d706f naplet.Auth.impo │ │ │ │ │ + 0x0114d2f0 72742053 6e61702e 536e6170 6c65742e rt Snap.Snaplet. │ │ │ │ │ + 0x0114d300 53657373 696f6e0a 0a2d2d2d 2d2d2d2d Session..------- │ │ │ │ │ + 0x0114d310 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d320 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d330 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d340 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d350 2d2d2d2d 2d2d2d0a 64617461 20417070 -------.data App │ │ │ │ │ + 0x0114d360 203d2041 70700a20 2020207b 205f6865 = App. { _he │ │ │ │ │ + 0x0114d370 69737420 3a3a2053 6e61706c 65742028 ist :: Snaplet ( │ │ │ │ │ + 0x0114d380 48656973 74204170 70290a20 2020202c Heist App). , │ │ │ │ │ + 0x0114d390 205f7365 7373203a 3a20536e 61706c65 _sess :: Snaple │ │ │ │ │ + 0x0114d3a0 74205365 7373696f 6e4d616e 61676572 t SessionManager │ │ │ │ │ + 0x0114d3b0 0a202020 202c205f 61757468 203a3a20 . , _auth :: │ │ │ │ │ + 0x0114d3c0 536e6170 6c657420 28417574 684d616e Snaplet (AuthMan │ │ │ │ │ + 0x0114d3d0 61676572 20417070 290a2020 20207d0a ager App). }. │ │ │ │ │ + 0x0114d3e0 0a6d616b 654c656e 73657320 27274170 .makeLenses ''Ap │ │ │ │ │ + 0x0114d3f0 700a0a69 6e737461 6e636520 48617348 p..instance HasH │ │ │ │ │ + 0x0114d400 65697374 20417070 20776865 72650a20 eist App where. │ │ │ │ │ + 0x0114d410 20202068 65697374 4c656e73 203d2073 heistLens = s │ │ │ │ │ + 0x0114d420 7562536e 61706c65 74206865 6973740a ubSnaplet heist. │ │ │ │ │ + 0x0114d430 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ │ + 0x0114d440 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d450 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d460 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d470 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ │ + 0x0114d480 0a747970 65204170 7048616e 646c6572 .type AppHandler │ │ │ │ │ + 0x0114d490 203d2048 616e646c 65722041 70702041 = Handler App A │ │ │ │ │ + 0x0114d4a0 70700a0a 0a002e2f 7372632f 4170706c pp...../src/Appl │ │ │ │ │ + 0x0114d4b0 69636174 696f6e2e 6873004e 616d653a ication.hs.Name: │ │ │ │ │ + 0x0114d4c0 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114d4d0 70726f6a 6e616d65 0a566572 73696f6e projname.Version │ │ │ │ │ + 0x0114d4e0 3a202020 20202020 20202020 2020302e : 0. │ │ │ │ │ + 0x0114d4f0 310a5379 6e6f7073 69733a20 20202020 1.Synopsis: │ │ │ │ │ + 0x0114d500 20202020 20202050 726f6a65 63742053 Project S │ │ │ │ │ + 0x0114d510 796e6f70 73697320 48657265 0a446573 ynopsis Here.Des │ │ │ │ │ + 0x0114d520 63726970 74696f6e 3a202020 20202020 cription: │ │ │ │ │ + 0x0114d530 20205072 6f6a6563 74204465 73637269 Project Descri │ │ │ │ │ + 0x0114d540 7074696f 6e204865 72650a4c 6963656e ption Here.Licen │ │ │ │ │ + 0x0114d550 73653a20 20202020 20202020 20202020 se: │ │ │ │ │ + 0x0114d560 416c6c52 69676874 73526573 65727665 AllRightsReserve │ │ │ │ │ + 0x0114d570 640a4175 74686f72 3a202020 20202020 d.Author: │ │ │ │ │ + 0x0114d580 20202020 20202041 7574686f 720a4d61 Author.Ma │ │ │ │ │ + 0x0114d590 696e7461 696e6572 3a202020 20202020 intainer: │ │ │ │ │ + 0x0114d5a0 2020206d 61696e74 61696e65 72406578 maintainer@ex │ │ │ │ │ + 0x0114d5b0 616d706c 652e636f 6d0a5374 6162696c ample.com.Stabil │ │ │ │ │ + 0x0114d5c0 6974793a 20202020 20202020 20202045 ity: E │ │ │ │ │ + 0x0114d5d0 78706572 696d656e 74616c0a 43617465 xperimental.Cate │ │ │ │ │ + 0x0114d5e0 676f7279 3a202020 20202020 20202020 gory: │ │ │ │ │ + 0x0114d5f0 20576562 0a427569 6c642d74 7970653a Web.Build-type: │ │ │ │ │ + 0x0114d600 20202020 20202020 20205369 6d706c65 Simple │ │ │ │ │ + 0x0114d610 0a436162 616c2d76 65727369 6f6e3a20 .Cabal-version: │ │ │ │ │ + 0x0114d620 20202020 20203e3d 312e320a 0a466c61 >=1.2..Fla │ │ │ │ │ + 0x0114d630 67206465 76656c6f 706d656e 740a2020 g development. │ │ │ │ │ + 0x0114d640 44657363 72697074 696f6e3a 20576865 Description: Whe │ │ │ │ │ + 0x0114d650 74686572 20746f20 6275696c 64207468 ther to build th │ │ │ │ │ + 0x0114d660 65207365 72766572 20696e20 64657665 e server in deve │ │ │ │ │ + 0x0114d670 6c6f706d 656e7420 28696e74 65727072 lopment (interpr │ │ │ │ │ + 0x0114d680 65746564 29206d6f 64650a20 20446566 eted) mode. Def │ │ │ │ │ + 0x0114d690 61756c74 3a204661 6c73650a 0a466c61 ault: False..Fla │ │ │ │ │ + 0x0114d6a0 67206f6c 642d6261 73650a20 20646566 g old-base. def │ │ │ │ │ + 0x0114d6b0 61756c74 3a204661 6c73650a 20206d61 ault: False. ma │ │ │ │ │ + 0x0114d6c0 6e75616c 3a204661 6c73650a 0a457865 nual: False..Exe │ │ │ │ │ + 0x0114d6d0 63757461 626c6520 70726f6a 6e616d65 cutable projname │ │ │ │ │ + 0x0114d6e0 0a202068 732d736f 75726365 2d646972 . hs-source-dir │ │ │ │ │ + 0x0114d6f0 733a2073 72630a20 206d6169 6e2d6973 s: src. main-is │ │ │ │ │ + 0x0114d700 3a204d61 696e2e68 730a0a20 20427569 : Main.hs.. Bui │ │ │ │ │ + 0x0114d710 6c642d64 6570656e 64733a0a 20202020 ld-depends:. │ │ │ │ │ + 0x0114d720 62617365 20202020 20202020 20202020 base │ │ │ │ │ + 0x0114d730 20202020 20202020 20203e3d 20342e34 >= 4.4 │ │ │ │ │ + 0x0114d740 20202020 20262620 3c20352c 0a202020 && < 5,. │ │ │ │ │ + 0x0114d750 20627974 65737472 696e6720 20202020 bytestring │ │ │ │ │ + 0x0114d760 20202020 20202020 2020203e 3d20302e >= 0. │ │ │ │ │ + 0x0114d770 392e3120 20202626 203c2030 2e31312c 9.1 && < 0.11, │ │ │ │ │ + 0x0114d780 0a202020 20686569 73742020 20202020 . heist │ │ │ │ │ + 0x0114d790 20202020 20202020 20202020 2020203e > │ │ │ │ │ + 0x0114d7a0 3d20312e 30202020 20202626 203c2031 = 1.0 && < 1 │ │ │ │ │ + 0x0114d7b0 2e322c0a 20202020 6c656e73 20202020 .2,. lens │ │ │ │ │ + 0x0114d7c0 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114d7d0 20203e3d 20332e37 2e362020 20262620 >= 3.7.6 && │ │ │ │ │ + 0x0114d7e0 3c20342e 31382c0a 20202020 6d61702d < 4.18,. map- │ │ │ │ │ + 0x0114d7f0 73796e74 61782020 20202020 20202020 syntax │ │ │ │ │ + 0x0114d800 20202020 20203e3d 20302e32 20202020 >= 0.2 │ │ │ │ │ + 0x0114d810 20262620 3c20302e 342c0a20 2020206d && < 0.4,. m │ │ │ │ │ + 0x0114d820 6f6e6164 2d636f6e 74726f6c 20202020 onad-control │ │ │ │ │ + 0x0114d830 20202020 20202020 203e3d20 312e3020 >= 1.0 │ │ │ │ │ + 0x0114d840 20202020 2626203c 20312e31 2c0a2020 && < 1.1,. │ │ │ │ │ + 0x0114d850 20206d74 6c202020 20202020 20202020 mtl │ │ │ │ │ + 0x0114d860 20202020 20202020 20202020 3e3d2032 >= 2 │ │ │ │ │ + 0x0114d870 20202020 20202026 26203c20 322e332c && < 2.3, │ │ │ │ │ + 0x0114d880 0a202020 20736e61 70202020 20202020 . snap │ │ │ │ │ + 0x0114d890 20202020 20202020 20202020 2020203e > │ │ │ │ │ + 0x0114d8a0 3d20312e 30202020 20202626 203c2031 = 1.0 && < 1 │ │ │ │ │ + 0x0114d8b0 2e322c0a 20202020 736e6170 2d636f72 .2,. snap-cor │ │ │ │ │ + 0x0114d8c0 65202020 20202020 20202020 20202020 e │ │ │ │ │ + 0x0114d8d0 20203e3d 20312e30 20202020 20262620 >= 1.0 && │ │ │ │ │ + 0x0114d8e0 3c20312e 312c0a20 20202073 6e61702d < 1.1,. snap- │ │ │ │ │ + 0x0114d8f0 73657276 65722020 20202020 20202020 server │ │ │ │ │ + 0x0114d900 20202020 203e3d20 312e3020 20202020 >= 1.0 │ │ │ │ │ + 0x0114d910 2626203c 20312e32 2c0a2020 2020736e && < 1.2,. sn │ │ │ │ │ + 0x0114d920 61702d6c 6f616465 722d7374 61746963 ap-loader-static │ │ │ │ │ + 0x0114d930 20202020 20202020 3e3d2031 2e302020 >= 1.0 │ │ │ │ │ + 0x0114d940 20202026 26203c20 312e312c 0a202020 && < 1.1,. │ │ │ │ │ + 0x0114d950 20746578 74202020 20202020 20202020 text │ │ │ │ │ + 0x0114d960 20202020 20202020 2020203e 3d20302e >= 0. │ │ │ │ │ + 0x0114d970 31312020 20202626 203c2031 2e332c0a 11 && < 1.3,. │ │ │ │ │ + 0x0114d980 20202020 74696d65 20202020 20202020 time │ │ │ │ │ + 0x0114d990 20202020 20202020 20202020 20203e3d >= │ │ │ │ │ + 0x0114d9a0 20312e31 20202020 20262620 3c20312e 1.1 && < 1. │ │ │ │ │ + 0x0114d9b0 392c0a20 20202078 6d6c6874 6d6c2020 9,. xmlhtml │ │ │ │ │ + 0x0114d9c0 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114d9d0 203e3d20 302e3120 20202020 2626203c >= 0.1 && < │ │ │ │ │ + 0x0114d9e0 20302e33 0a0a2020 69662066 6c616728 0.3.. if flag( │ │ │ │ │ + 0x0114d9f0 64657665 6c6f706d 656e7429 0a202020 development). │ │ │ │ │ + 0x0114da00 20627569 6c642d64 6570656e 64733a0a build-depends:. │ │ │ │ │ + 0x0114da10 20202020 2020736e 61702d6c 6f616465 snap-loade │ │ │ │ │ + 0x0114da20 722d6479 6e616d69 63203e3d 20312e30 r-dynamic >= 1.0 │ │ │ │ │ + 0x0114da30 20262620 3c20312e 310a2020 20206370 && < 1.1. cp │ │ │ │ │ + 0x0114da40 702d6f70 74696f6e 733a202d 44444556 p-options: -DDEV │ │ │ │ │ + 0x0114da50 454c4f50 4d454e54 0a202020 202d2d20 ELOPMENT. -- │ │ │ │ │ + 0x0114da60 496e2064 6576656c 6f706d65 6e74206d In development m │ │ │ │ │ + 0x0114da70 6f64652c 20737065 65642069 7320616c ode, speed is al │ │ │ │ │ + 0x0114da80 72656164 7920676f 696e6720 746f2073 ready going to s │ │ │ │ │ + 0x0114da90 75666665 722c2073 6f20736b 69700a20 uffer, so skip. │ │ │ │ │ + 0x0114daa0 2020202d 2d207468 65206661 6e637920 -- the fancy │ │ │ │ │ + 0x0114dab0 6f707469 6d697a61 74696f6e 20666c61 optimization fla │ │ │ │ │ + 0x0114dac0 67732e20 20416464 6974696f 6e616c6c gs. Additionall │ │ │ │ │ + 0x0114dad0 792c2064 69736162 6c652061 6c6c0a20 y, disable all. │ │ │ │ │ + 0x0114dae0 2020202d 2d207761 726e696e 67732e20 -- warnings. │ │ │ │ │ + 0x0114daf0 20546865 2068696e 74206c69 62726172 The hint librar │ │ │ │ │ + 0x0114db00 7920646f 65736e27 74206769 76652061 y doesn't give a │ │ │ │ │ + 0x0114db10 6e206f70 74696f6e 20746f20 65786563 n option to exec │ │ │ │ │ + 0x0114db20 7574650a 20202020 2d2d2063 6f6d7069 ute. -- compi │ │ │ │ │ + 0x0114db30 6c656420 636f6465 20776865 6e207468 led code when th │ │ │ │ │ + 0x0114db40 65726520 77657265 20616c73 6f207761 ere were also wa │ │ │ │ │ + 0x0114db50 726e696e 67732c20 736f2064 69736162 rnings, so disab │ │ │ │ │ + 0x0114db60 6c696e67 0a202020 202d2d20 7761726e ling. -- warn │ │ │ │ │ + 0x0114db70 696e6773 20616c6c 6f777320 71756963 ings allows quic │ │ │ │ │ + 0x0114db80 6b657220 776f726b 666c6f77 2e0a2020 ker workflow.. │ │ │ │ │ + 0x0114db90 20206768 632d6f70 74696f6e 733a202d ghc-options: - │ │ │ │ │ + 0x0114dba0 74687265 61646564 202d770a 2020656c threaded -w. el │ │ │ │ │ + 0x0114dbb0 73650a20 20202069 6620696d 706c2867 se. if impl(g │ │ │ │ │ + 0x0114dbc0 6863203e 3d20362e 31322e30 290a2020 hc >= 6.12.0). │ │ │ │ │ + 0x0114dbd0 20202020 6768632d 6f707469 6f6e733a ghc-options: │ │ │ │ │ + 0x0114dbe0 202d7468 72656164 6564202d 57616c6c -threaded -Wall │ │ │ │ │ + 0x0114dbf0 202d6677 61726e2d 74616273 202d6675 -fwarn-tabs -fu │ │ │ │ │ + 0x0114dc00 6e626f78 2d737472 6963742d 6669656c nbox-strict-fiel │ │ │ │ │ + 0x0114dc10 6473202d 4f320a20 20202020 20202020 ds -O2. │ │ │ │ │ + 0x0114dc20 20202020 20202020 20202d66 6e6f2d77 -fno-w │ │ │ │ │ + 0x0114dc30 61726e2d 6f727068 616e7320 2d666e6f arn-orphans -fno │ │ │ │ │ + 0x0114dc40 2d776172 6e2d756e 75736564 2d646f2d -warn-unused-do- │ │ │ │ │ + 0x0114dc50 62696e64 0a202020 20656c73 650a2020 bind. else. │ │ │ │ │ + 0x0114dc60 20202020 6768632d 6f707469 6f6e733a ghc-options: │ │ │ │ │ + 0x0114dc70 202d7468 72656164 6564202d 57616c6c -threaded -Wall │ │ │ │ │ + 0x0114dc80 202d6677 61726e2d 74616273 202d6675 -fwarn-tabs -fu │ │ │ │ │ + 0x0114dc90 6e626f78 2d737472 6963742d 6669656c nbox-strict-fiel │ │ │ │ │ + 0x0114dca0 6473202d 4f320a20 20202020 20202020 ds -O2. │ │ │ │ │ + 0x0114dcb0 20202020 20202020 20202d66 6e6f2d77 -fno-w │ │ │ │ │ + 0x0114dcc0 61726e2d 6f727068 616e730a 003c6831 arn-orphans..

Register a new │ │ │ │ │ + 0x0114dce0 75736572 3c2f6831 3e0a0a3c 62696e64 user

../new_user.Add Us │ │ │ │ │ + 0x0114dd30 65723c2f 62696e64 3e0a3c61 70706c79 er..../snaple │ │ │ │ │ + 0x0114dd60 74732f68 65697374 2f74656d 706c6174 ts/heist/templat │ │ │ │ │ + 0x0114dd70 65732f5f 6e65775f 75736572 2e74706c es/_new_user.tpl │ │ │ │ │ + 0x0114dd80 003c666f 726d206d 6574686f 643d2270 .
. < │ │ │ │ │ + 0x0114ddb0 7461626c 65206964 3d22696e 666f223e table id="info"> │ │ │ │ │ + 0x0114ddc0 0a202020 203c7472 3e0a2020 20202020 . . │ │ │ │ │ + 0x0114ddd0 3c74643e 4c6f6769 6e3a3c2f 74643e3c Login:< │ │ │ │ │ + 0x0114dde0 74643e3c 696e7075 74207479 70653d22 td>< │ │ │ │ │ + 0x0114de10 2f74643e 0a202020 203c2f74 723e0a20 /td>. . │ │ │ │ │ + 0x0114de20 2020203c 74723e0a 20202020 20203c74 . Password: │ │ │ │ │ + 0x0114de40 3c74643e 3c696e70 75742074 7970653d . │ │ │ │ │ + 0x0114de80 203c2f74 723e0a20 2020203c 74723e0a . . │ │ │ │ │ + 0x0114de90 20202020 20203c74 643e3c2f 74643e0a . │ │ │ │ │ + 0x0114dea0 20202020 20203c74 643e3c69 6e707574 . │ │ │ │ │ + 0x0114dee0 203c2f74 723e0a20 203c2f74 61626c65 . ..../sna │ │ │ │ │ + 0x0114df00 706c6574 732f6865 6973742f 74656d70 plets/heist/temp │ │ │ │ │ + 0x0114df10 6c617465 732f7573 6572666f 726d2e74 lates/userform.t │ │ │ │ │ + 0x0114df20 706c003c 6170706c 79207465 6d706c61 pl.. ..../snaplets │ │ │ │ │ + 0x0114df70 2f686569 73742f74 656d706c 61746573 /heist/templates │ │ │ │ │ + 0x0114df80 2f6e6577 5f757365 722e7470 6c003c61 /new_user.tpl.
. ..../s │ │ │ │ │ + 0x0114dfd0 6e61706c 6574732f 68656973 742f7465 naplets/heist/te │ │ │ │ │ + 0x0114dfe0 6d706c61 7465732f 6c6f6769 6e2e7470 mplates/login.tp │ │ │ │ │ + 0x0114dff0 6c003c68 313e536e 61702045 78616d70 l.

Snap Examp │ │ │ │ │ + 0x0114e000 6c652041 7070204c 6f67696e 3c2f6831 le App Login

..

.. │ │ │ │ │ + 0x0114e040 2f6c6f67 696e3c2f 62696e64 3e0a3c62 /login.Login... │ │ │ │ │ + 0x0114e090 3c703e44 6f6e2774 20686176 65206120

Don't have a │ │ │ │ │ + 0x0114e0a0 6c6f6769 6e207965 743f203c 61206872 login yet? C │ │ │ │ │ + 0x0114e0c0 72656174 65206120 6e657720 75736572 reate a new user │ │ │ │ │ + 0x0114e0d0 3c2f613e 3c2f703e 0a002e2f 736e6170

.../snap │ │ │ │ │ + 0x0114e0e0 6c657473 2f686569 73742f74 656d706c lets/heist/templ │ │ │ │ │ + 0x0114e0f0 61746573 2f5f6c6f 67696e2e 74706c00 ates/_login.tpl. │ │ │ │ │ + 0x0114e100 3c68746d 6c3e0a20 203c6865 61643e0a . . │ │ │ │ │ + 0x0114e110 20202020 3c746974 6c653e53 6e617020 Snap │ │ │ │ │ + 0x0114e120 77656220 73657276 65723c2f 7469746c web server</titl │ │ │ │ │ + 0x0114e130 653e0a20 2020203c 6c696e6b 2072656c e>. <link rel │ │ │ │ │ + 0x0114e140 3d227374 796c6573 68656574 22207479 ="stylesheet" ty │ │ │ │ │ + 0x0114e150 70653d22 74657874 2f637373 22206872 pe="text/css" hr │ │ │ │ │ + 0x0114e160 65663d22 2f736372 65656e2e 63737322 ef="/screen.css" │ │ │ │ │ + 0x0114e170 2f3e0a20 203c2f68 6561643e 0a20203c />. </head>. < │ │ │ │ │ + 0x0114e180 626f6479 3e0a2020 20203c64 69762069 body>. <div i │ │ │ │ │ + 0x0114e190 643d2263 6f6e7465 6e74223e 0a0a2020 d="content">.. │ │ │ │ │ + 0x0114e1a0 20202020 3c617070 6c792d63 6f6e7465 <apply-conte │ │ │ │ │ + 0x0114e1b0 6e742f3e 0a0a2020 20203c2f 6469763e nt/>.. </div> │ │ │ │ │ + 0x0114e1c0 0a20203c 2f626f64 793e0a3c 2f68746d . </body>.</htm │ │ │ │ │ + 0x0114e1d0 6c3e0a00 2e2f736e 61706c65 74732f68 l>.../snaplets/h │ │ │ │ │ + 0x0114e1e0 65697374 2f74656d 706c6174 65732f62 eist/templates/b │ │ │ │ │ + 0x0114e1f0 6173652e 74706c00 3c617070 6c792074 ase.tpl.<apply t │ │ │ │ │ + 0x0114e200 656d706c 6174653d 22626173 65223e0a emplate="base">. │ │ │ │ │ + 0x0114e210 0a20203c 69664c6f 67676564 496e3e0a . <ifLoggedIn>. │ │ │ │ │ + 0x0114e220 20202020 3c703e0a 20202020 20205468 <p>. Th │ │ │ │ │ + 0x0114e230 69732069 73206120 73696d70 6c652064 is is a simple d │ │ │ │ │ + 0x0114e240 656d6f20 70616765 20736572 76656420 emo page served │ │ │ │ │ + 0x0114e250 7573696e 670a2020 20202020 3c612068 using. <a h │ │ │ │ │ + 0x0114e260 7265663d 22687474 703a2f2f 736e6170 ref="http://snap │ │ │ │ │ + 0x0114e270 6672616d 65776f72 6b2e636f 6d2f646f framework.com/do │ │ │ │ │ + 0x0114e280 63732f74 75746f72 69616c73 2f686569 cs/tutorials/hei │ │ │ │ │ + 0x0114e290 7374223e 48656973 743c2f61 3e0a2020 st">Heist</a>. │ │ │ │ │ + 0x0114e2a0 20202020 616e6420 74686520 3c612068 and the <a h │ │ │ │ │ + 0x0114e2b0 7265663d 22687474 703a2f2f 736e6170 ref="http://snap │ │ │ │ │ + 0x0114e2c0 6672616d 65776f72 6b2e636f 6d2f223e framework.com/"> │ │ │ │ │ + 0x0114e2d0 536e6170 3c2f613e 20776562 20667261 Snap</a> web fra │ │ │ │ │ + 0x0114e2e0 6d65776f 726b2e0a 20202020 3c2f703e mework.. </p> │ │ │ │ │ + 0x0114e2f0 0a0a2020 20203c70 3e436f6e 67726174 .. <p>Congrat │ │ │ │ │ + 0x0114e300 73212020 596f7527 7265206c 6f676765 s! You're logge │ │ │ │ │ + 0x0114e310 6420696e 20617320 273c6c6f 67676564 d in as '<logged │ │ │ │ │ + 0x0114e320 496e5573 65722f3e 273c2f70 3e0a0a20 InUser/>'</p>.. │ │ │ │ │ + 0x0114e330 2020203c 703e3c61 20687265 663d222f <p><a href="/ │ │ │ │ │ + 0x0114e340 6c6f676f 7574223e 4c6f676f 75743c2f logout">Logout</ │ │ │ │ │ + 0x0114e350 613e3c2f 703e0a20 203c2f69 664c6f67 a></p>. </ifLog │ │ │ │ │ + 0x0114e360 67656449 6e3e0a0a 20203c69 664c6f67 gedIn>.. <ifLog │ │ │ │ │ + 0x0114e370 6765644f 75743e0a 20202020 3c617070 gedOut>. <app │ │ │ │ │ + 0x0114e380 6c792074 656d706c 6174653d 225f6c6f ly template="_lo │ │ │ │ │ + 0x0114e390 67696e22 2f3e0a20 203c2f69 664c6f67 gin"/>. </ifLog │ │ │ │ │ + 0x0114e3a0 6765644f 75743e0a 0a3c2f61 70706c79 gedOut>..</apply │ │ │ │ │ + 0x0114e3b0 3e0a002e 2f736e61 706c6574 732f6865 >.../snaplets/he │ │ │ │ │ + 0x0114e3c0 6973742f 74656d70 6c617465 732f696e ist/templates/in │ │ │ │ │ + 0x0114e3d0 6465782e 74706c00 68746d6c 207b0a20 dex.tpl.html {. │ │ │ │ │ 0x0114e3e0 20207061 6464696e 673a2030 3b0a2020 padding: 0;. │ │ │ │ │ 0x0114e3f0 206d6172 67696e3a 20303b0a 20202062 margin: 0;. b │ │ │ │ │ 0x0114e400 61636b67 726f756e 642d636f 6c6f723a ackground-color: │ │ │ │ │ 0x0114e410 20236666 66666666 3b0a2020 20666f6e #ffffff;. fon │ │ │ │ │ 0x0114e420 742d6661 6d696c79 3a205665 7264616e t-family: Verdan │ │ │ │ │ 0x0114e430 612c2048 656c7665 74696361 2c207361 a, Helvetica, sa │ │ │ │ │ 0x0114e440 6e732d73 65726966 3b0a7d0a 626f6479 ns-serif;.}.body │ │ │ │ │ @@ -2101,74 +2101,74 @@ │ │ │ │ │ 0x0114e760 616d203c 2d206765 74506172 616d2022 am <- getParam " │ │ │ │ │ 0x0114e770 6563686f 70617261 6d220a20 2020206d echoparam". m │ │ │ │ │ 0x0114e780 61796265 20287772 69746542 5320226d aybe (writeBS "m │ │ │ │ │ 0x0114e790 75737420 73706563 69667920 6563686f ust specify echo │ │ │ │ │ 0x0114e7a0 2f706172 616d2069 6e205552 4c22290a /param in URL"). │ │ │ │ │ 0x0114e7b0 20202020 20202020 20207772 69746542 writeB │ │ │ │ │ 0x0114e7c0 53207061 72616d0a 002e2f73 72632f4d S param.../src/M │ │ │ │ │ - 0x0114e7d0 61696e2e 68730070 6c616365 686f6c64 ain.hs.placehold │ │ │ │ │ - 0x0114e7e0 65720a00 2e2f6c6f 672f706c 61636568 er.../log/placeh │ │ │ │ │ - 0x0114e7f0 6f6c6465 72004e61 6d653a20 20202020 older.Name: │ │ │ │ │ - 0x0114e800 20202020 20202020 20202070 726f6a6e projn │ │ │ │ │ - 0x0114e810 616d650a 56657273 696f6e3a 20202020 ame.Version: │ │ │ │ │ - 0x0114e820 20202020 20202020 20302e31 0a53796e 0.1.Syn │ │ │ │ │ - 0x0114e830 6f707369 733a2020 20202020 20202020 opsis: │ │ │ │ │ - 0x0114e840 20205072 6f6a6563 74205379 6e6f7073 Project Synops │ │ │ │ │ - 0x0114e850 69732048 6572650a 44657363 72697074 is Here.Descript │ │ │ │ │ - 0x0114e860 696f6e3a 20202020 20202020 2050726f ion: Pro │ │ │ │ │ - 0x0114e870 6a656374 20446573 63726970 74696f6e ject Description │ │ │ │ │ - 0x0114e880 20486572 650a4c69 63656e73 653a2020 Here.License: │ │ │ │ │ - 0x0114e890 20202020 20202020 20202041 6c6c5269 AllRi │ │ │ │ │ - 0x0114e8a0 67687473 52657365 72766564 0a417574 ghtsReserved.Aut │ │ │ │ │ - 0x0114e8b0 686f723a 20202020 20202020 20202020 hor: │ │ │ │ │ - 0x0114e8c0 20204175 74686f72 0a4d6169 6e746169 Author.Maintai │ │ │ │ │ - 0x0114e8d0 6e65723a 20202020 20202020 20206d61 ner: ma │ │ │ │ │ - 0x0114e8e0 696e7461 696e6572 40657861 6d706c65 intainer@example │ │ │ │ │ - 0x0114e8f0 2e636f6d 0a537461 62696c69 74793a20 .com.Stability: │ │ │ │ │ - 0x0114e900 20202020 20202020 20204578 70657269 Experi │ │ │ │ │ - 0x0114e910 6d656e74 616c0a43 61746567 6f72793a mental.Category: │ │ │ │ │ - 0x0114e920 20202020 20202020 20202020 5765620a Web. │ │ │ │ │ - 0x0114e930 4275696c 642d7479 70653a20 20202020 Build-type: │ │ │ │ │ - 0x0114e940 20202020 2053696d 706c650a 43616261 Simple.Caba │ │ │ │ │ - 0x0114e950 6c2d7665 7273696f 6e3a2020 20202020 l-version: │ │ │ │ │ - 0x0114e960 203e3d31 2e320a0a 45786563 75746162 >=1.2..Executab │ │ │ │ │ - 0x0114e970 6c652070 726f6a6e 616d650a 20206873 le projname. hs │ │ │ │ │ - 0x0114e980 2d736f75 7263652d 64697273 3a207372 -source-dirs: sr │ │ │ │ │ - 0x0114e990 630a2020 6d61696e 2d69733a 204d6169 c. main-is: Mai │ │ │ │ │ - 0x0114e9a0 6e2e6873 0a0a2020 4275696c 642d6465 n.hs.. Build-de │ │ │ │ │ - 0x0114e9b0 70656e64 733a0a20 20202062 61736520 pends:. base │ │ │ │ │ - 0x0114e9c0 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114e9d0 20202020 203e3d20 34202020 20202626 >= 4 && │ │ │ │ │ - 0x0114e9e0 203c2035 2c0a2020 20206279 74657374 < 5,. bytest │ │ │ │ │ - 0x0114e9f0 72696e67 20202020 20202020 20202020 ring │ │ │ │ │ - 0x0114ea00 20202020 3e3d2030 2e392e31 20262620 >= 0.9.1 && │ │ │ │ │ - 0x0114ea10 3c20302e 31312c0a 20202020 6d746c20 < 0.11,. mtl │ │ │ │ │ - 0x0114ea20 20202020 20202020 20202020 20202020 │ │ │ │ │ - 0x0114ea30 20202020 20203e3d 20322020 20202026 >= 2 & │ │ │ │ │ - 0x0114ea40 26203c20 332c0a20 20202073 6e61702d & < 3,. snap- │ │ │ │ │ - 0x0114ea50 636f7265 20202020 20202020 20202020 core │ │ │ │ │ - 0x0114ea60 20202020 203e3d20 312e3020 20202626 >= 1.0 && │ │ │ │ │ - 0x0114ea70 203c2031 2e312c0a 20202020 736e6170 < 1.1,. snap │ │ │ │ │ - 0x0114ea80 2d736572 76657220 20202020 20202020 -server │ │ │ │ │ - 0x0114ea90 20202020 20203e3d 20312e30 20202026 >= 1.0 & │ │ │ │ │ - 0x0114eaa0 26203c20 312e320a 0a202069 6620696d & < 1.2.. if im │ │ │ │ │ - 0x0114eab0 706c2867 6863203e 3d20362e 31322e30 pl(ghc >= 6.12.0 │ │ │ │ │ - 0x0114eac0 290a2020 20206768 632d6f70 74696f6e ). ghc-option │ │ │ │ │ - 0x0114ead0 733a202d 74687265 61646564 202d5761 s: -threaded -Wa │ │ │ │ │ - 0x0114eae0 6c6c202d 66776172 6e2d7461 6273202d ll -fwarn-tabs - │ │ │ │ │ - 0x0114eaf0 66756e62 6f782d73 74726963 742d6669 funbox-strict-fi │ │ │ │ │ - 0x0114eb00 656c6473 202d4f32 0a202020 20202020 elds -O2. │ │ │ │ │ - 0x0114eb10 20202020 20202020 20202d66 6e6f2d77 -fno-w │ │ │ │ │ - 0x0114eb20 61726e2d 756e7573 65642d64 6f2d6269 arn-unused-do-bi │ │ │ │ │ - 0x0114eb30 6e640a20 20656c73 650a2020 20206768 nd. else. gh │ │ │ │ │ - 0x0114eb40 632d6f70 74696f6e 733a202d 74687265 c-options: -thre │ │ │ │ │ - 0x0114eb50 61646564 202d5761 6c6c202d 66776172 aded -Wall -fwar │ │ │ │ │ - 0x0114eb60 6e2d7461 6273202d 66756e62 6f782d73 n-tabs -funbox-s │ │ │ │ │ - 0x0114eb70 74726963 742d6669 656c6473 202d4f32 trict-fields -O2 │ │ │ │ │ - 0x0114eb80 0a002e2f 666f6f2e 63616261 6c003a73 .../foo.cabal.:s │ │ │ │ │ + 0x0114e7d0 61696e2e 6873004e 616d653a 20202020 ain.hs.Name: │ │ │ │ │ + 0x0114e7e0 20202020 20202020 20202020 70726f6a proj │ │ │ │ │ + 0x0114e7f0 6e616d65 0a566572 73696f6e 3a202020 name.Version: │ │ │ │ │ + 0x0114e800 20202020 20202020 2020302e 310a5379 0.1.Sy │ │ │ │ │ + 0x0114e810 6e6f7073 69733a20 20202020 20202020 nopsis: │ │ │ │ │ + 0x0114e820 20202050 726f6a65 63742053 796e6f70 Project Synop │ │ │ │ │ + 0x0114e830 73697320 48657265 0a446573 63726970 sis Here.Descrip │ │ │ │ │ + 0x0114e840 74696f6e 3a202020 20202020 20205072 tion: Pr │ │ │ │ │ + 0x0114e850 6f6a6563 74204465 73637269 7074696f oject Descriptio │ │ │ │ │ + 0x0114e860 6e204865 72650a4c 6963656e 73653a20 n Here.License: │ │ │ │ │ + 0x0114e870 20202020 20202020 20202020 416c6c52 AllR │ │ │ │ │ + 0x0114e880 69676874 73526573 65727665 640a4175 ightsReserved.Au │ │ │ │ │ + 0x0114e890 74686f72 3a202020 20202020 20202020 thor: │ │ │ │ │ + 0x0114e8a0 20202041 7574686f 720a4d61 696e7461 Author.Mainta │ │ │ │ │ + 0x0114e8b0 696e6572 3a202020 20202020 2020206d iner: m │ │ │ │ │ + 0x0114e8c0 61696e74 61696e65 72406578 616d706c aintainer@exampl │ │ │ │ │ + 0x0114e8d0 652e636f 6d0a5374 6162696c 6974793a e.com.Stability: │ │ │ │ │ + 0x0114e8e0 20202020 20202020 20202045 78706572 Exper │ │ │ │ │ + 0x0114e8f0 696d656e 74616c0a 43617465 676f7279 imental.Category │ │ │ │ │ + 0x0114e900 3a202020 20202020 20202020 20576562 : Web │ │ │ │ │ + 0x0114e910 0a427569 6c642d74 7970653a 20202020 .Build-type: │ │ │ │ │ + 0x0114e920 20202020 20205369 6d706c65 0a436162 Simple.Cab │ │ │ │ │ + 0x0114e930 616c2d76 65727369 6f6e3a20 20202020 al-version: │ │ │ │ │ + 0x0114e940 20203e3d 312e320a 0a457865 63757461 >=1.2..Executa │ │ │ │ │ + 0x0114e950 626c6520 70726f6a 6e616d65 0a202068 ble projname. h │ │ │ │ │ + 0x0114e960 732d736f 75726365 2d646972 733a2073 s-source-dirs: s │ │ │ │ │ + 0x0114e970 72630a20 206d6169 6e2d6973 3a204d61 rc. main-is: Ma │ │ │ │ │ + 0x0114e980 696e2e68 730a0a20 20427569 6c642d64 in.hs.. Build-d │ │ │ │ │ + 0x0114e990 6570656e 64733a0a 20202020 62617365 epends:. base │ │ │ │ │ + 0x0114e9a0 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114e9b0 20202020 20203e3d 20342020 20202026 >= 4 & │ │ │ │ │ + 0x0114e9c0 26203c20 352c0a20 20202062 79746573 & < 5,. bytes │ │ │ │ │ + 0x0114e9d0 7472696e 67202020 20202020 20202020 tring │ │ │ │ │ + 0x0114e9e0 20202020 203e3d20 302e392e 31202626 >= 0.9.1 && │ │ │ │ │ + 0x0114e9f0 203c2030 2e31312c 0a202020 206d746c < 0.11,. mtl │ │ │ │ │ + 0x0114ea00 20202020 20202020 20202020 20202020 │ │ │ │ │ + 0x0114ea10 20202020 2020203e 3d203220 20202020 >= 2 │ │ │ │ │ + 0x0114ea20 2626203c 20332c0a 20202020 736e6170 && < 3,. snap │ │ │ │ │ + 0x0114ea30 2d636f72 65202020 20202020 20202020 -core │ │ │ │ │ + 0x0114ea40 20202020 20203e3d 20312e30 20202026 >= 1.0 & │ │ │ │ │ + 0x0114ea50 26203c20 312e312c 0a202020 20736e61 & < 1.1,. sna │ │ │ │ │ + 0x0114ea60 702d7365 72766572 20202020 20202020 p-server │ │ │ │ │ + 0x0114ea70 20202020 2020203e 3d20312e 30202020 >= 1.0 │ │ │ │ │ + 0x0114ea80 2626203c 20312e32 0a0a2020 69662069 && < 1.2.. if i │ │ │ │ │ + 0x0114ea90 6d706c28 67686320 3e3d2036 2e31322e mpl(ghc >= 6.12. │ │ │ │ │ + 0x0114eaa0 30290a20 20202067 68632d6f 7074696f 0). ghc-optio │ │ │ │ │ + 0x0114eab0 6e733a20 2d746872 65616465 64202d57 ns: -threaded -W │ │ │ │ │ + 0x0114eac0 616c6c20 2d667761 726e2d74 61627320 all -fwarn-tabs │ │ │ │ │ + 0x0114ead0 2d66756e 626f782d 73747269 63742d66 -funbox-strict-f │ │ │ │ │ + 0x0114eae0 69656c64 73202d4f 320a2020 20202020 ields -O2. │ │ │ │ │ + 0x0114eaf0 20202020 20202020 2020202d 666e6f2d -fno- │ │ │ │ │ + 0x0114eb00 7761726e 2d756e75 7365642d 646f2d62 warn-unused-do-b │ │ │ │ │ + 0x0114eb10 696e640a 2020656c 73650a20 20202067 ind. else. g │ │ │ │ │ + 0x0114eb20 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ │ + 0x0114eb30 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ │ + 0x0114eb40 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ │ + 0x0114eb50 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ │ + 0x0114eb60 320a002e 2f666f6f 2e636162 616c0070 2.../foo.cabal.p │ │ │ │ │ + 0x0114eb70 6c616365 686f6c64 65720a00 2e2f6c6f laceholder.../lo │ │ │ │ │ + 0x0114eb80 672f706c 61636568 6f6c6465 72003a73 g/placeholder.:s │ │ │ │ │ 0x0114eb90 6574202d 69737263 0a3a7365 74202d68 et -isrc.:set -h │ │ │ │ │ 0x0114eba0 6964652d 7061636b 61676520 4d6f6e61 ide-package Mona │ │ │ │ │ 0x0114ebb0 64436174 6368494f 2d6d746c 0a3a7365 dCatchIO-mtl.:se │ │ │ │ │ 0x0114ebc0 74202d68 6964652d 7061636b 61676520 t -hide-package │ │ │ │ │ 0x0114ebd0 6d6f6e61 64732d66 640a3a73 6574202d monads-fd.:set - │ │ │ │ │ 0x0114ebe0 584f7665 726c6f61 64656453 7472696e XOverloadedStrin │ │ │ │ │ 0x0114ebf0 67730a00 2e2f2e67 68636900 2e2f7372 gs.../.ghci../sr │ │ │ │ ├── readelf --wide --decompress --hex-dump=.data {} │ │ │ │ │ @@ -37,18 +37,18 @@ │ │ │ │ │ 0x01297220 00000000 00000000 fceb1401 54a10e01 ............T... │ │ │ │ │ 0x01297230 18722901 39173501 00000000 54a10e01 .r).9.5.....T... │ │ │ │ │ 0x01297240 04722901 2e722901 00000000 64811201 .r)..r).....d... │ │ │ │ │ 0x01297250 00000000 00000000 00000000 f4eb1401 ................ │ │ │ │ │ 0x01297260 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ 0x01297270 8eeb1401 ec870e01 4c722901 60722901 ........Lr).`r). │ │ │ │ │ 0x01297280 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ - 0x01297290 00000000 82eb1401 64811201 00000000 ........d....... │ │ │ │ │ - 0x012972a0 00000000 00000000 f6e71401 ec870e01 ................ │ │ │ │ │ + 0x01297290 00000000 7ceb1401 64811201 00000000 ....|...d....... │ │ │ │ │ + 0x012972a0 00000000 00000000 6feb1401 ec870e01 ........o....... │ │ │ │ │ 0x012972b0 84722901 98722901 00000000 64811201 .r)..r).....d... │ │ │ │ │ - 0x012972c0 00000000 00000000 00000000 e4e71401 ................ │ │ │ │ │ + 0x012972c0 00000000 00000000 00000000 63eb1401 ............c... │ │ │ │ │ 0x012972d0 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ 0x012972e0 d7e71401 ec870e01 bc722901 d0722901 .........r)..r). │ │ │ │ │ 0x012972f0 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ 0x01297300 00000000 c9e71401 64811201 00000000 ........d....... │ │ │ │ │ 0x01297310 00000000 00000000 85e51401 ec870e01 ................ │ │ │ │ │ 0x01297320 f4722901 08732901 00000000 54a10e01 .r)..s).....T... │ │ │ │ │ 0x01297330 1d732901 39173501 00000000 54a10e01 .s).9.5.....T... │ │ │ │ │ @@ -60,83 +60,83 @@ │ │ │ │ │ 0x01297390 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ 0x012973a0 71e51401 64811201 00000000 00000000 q...d........... │ │ │ │ │ 0x012973b0 00000000 60e51401 64811201 00000000 ....`...d....... │ │ │ │ │ 0x012973c0 00000000 00000000 45e51401 54a10e01 ........E...T... │ │ │ │ │ 0x012973d0 b8732901 2e722901 00000000 54a10e01 .s)..r).....T... │ │ │ │ │ 0x012973e0 a4732901 ce732901 00000000 54a10e01 .s)..s).....T... │ │ │ │ │ 0x012973f0 90732901 de732901 00000000 54a10e01 .s)..s).....T... │ │ │ │ │ - 0x01297400 04722901 ee732901 00000000 54a10e01 .r)..s).....T... │ │ │ │ │ - 0x01297410 7c732901 fe732901 00000000 64811201 |s)..s).....d... │ │ │ │ │ + 0x01297400 7c732901 ee732901 00000000 54a10e01 |s)..s).....T... │ │ │ │ │ + 0x01297410 04722901 fe732901 00000000 64811201 .r)..s).....d... │ │ │ │ │ 0x01297420 00000000 00000000 00000000 31e51401 ............1... │ │ │ │ │ 0x01297430 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ 0x01297440 d8e31401 ec870e01 1c742901 30742901 .........t).0t). │ │ │ │ │ 0x01297450 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ - 0x01297460 00000000 c6db1401 ec870e01 84722901 .............r). │ │ │ │ │ - 0x01297470 54742901 00000000 64811201 00000000 Tt).....d....... │ │ │ │ │ - 0x01297480 00000000 00000000 9edb1401 64811201 ............d... │ │ │ │ │ - 0x01297490 00000000 00000000 00000000 5bdb1401 ............[... │ │ │ │ │ - 0x012974a0 ec870e01 78742901 8c742901 00000000 ....xt)..t)..... │ │ │ │ │ - 0x012974b0 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ - 0x012974c0 33db1401 64811201 00000000 00000000 3...d........... │ │ │ │ │ - 0x012974d0 00000000 b9d91401 ec870e01 b0742901 .............t). │ │ │ │ │ - 0x012974e0 c4742901 00000000 64811201 00000000 .t).....d....... │ │ │ │ │ - 0x012974f0 00000000 00000000 94d91401 64811201 ............d... │ │ │ │ │ - 0x01297500 00000000 00000000 00000000 d9d71401 ................ │ │ │ │ │ - 0x01297510 ec870e01 e8742901 fc742901 00000000 .....t)..t)..... │ │ │ │ │ - 0x01297520 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ - 0x01297530 b4d71401 64811201 00000000 00000000 ....d........... │ │ │ │ │ - 0x01297540 00000000 75d71401 ec870e01 20752901 ....u....... u). │ │ │ │ │ - 0x01297550 34752901 00000000 64811201 00000000 4u).....d....... │ │ │ │ │ - 0x01297560 00000000 00000000 4cd71401 64811201 ........L...d... │ │ │ │ │ - 0x01297570 00000000 00000000 00000000 c1d61401 ................ │ │ │ │ │ - 0x01297580 ec870e01 58752901 6c752901 00000000 ....Xu).lu)..... │ │ │ │ │ - 0x01297590 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ - 0x012975a0 9bd61401 64811201 00000000 00000000 ....d........... │ │ │ │ │ - 0x012975b0 00000000 b3d51401 ec870e01 90752901 .............u). │ │ │ │ │ - 0x012975c0 a4752901 00000000 64811201 00000000 .u).....d....... │ │ │ │ │ - 0x012975d0 00000000 00000000 8fd51401 64811201 ............d... │ │ │ │ │ + 0x01297460 00000000 b3e31401 64811201 00000000 ........d....... │ │ │ │ │ + 0x01297470 00000000 00000000 f8e11401 ec870e01 ................ │ │ │ │ │ + 0x01297480 54742901 68742901 00000000 64811201 Tt).ht).....d... │ │ │ │ │ + 0x01297490 00000000 00000000 00000000 d4e11401 ................ │ │ │ │ │ + 0x012974a0 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ + 0x012974b0 00e11401 ec870e01 8c742901 a0742901 .........t)..t). │ │ │ │ │ + 0x012974c0 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ + 0x012974d0 00000000 dae01401 64811201 00000000 ........d....... │ │ │ │ │ + 0x012974e0 00000000 00000000 f2df1401 ec870e01 ................ │ │ │ │ │ + 0x012974f0 c4742901 d8742901 00000000 64811201 .t)..t).....d... │ │ │ │ │ + 0x01297500 00000000 00000000 00000000 cddf1401 ................ │ │ │ │ │ + 0x01297510 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ + 0x01297520 8edf1401 ec870e01 fc742901 10752901 .........t)..u). │ │ │ │ │ + 0x01297530 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ + 0x01297540 00000000 66df1401 64811201 00000000 ....f...d....... │ │ │ │ │ + 0x01297550 00000000 00000000 23df1401 ec870e01 ........#....... │ │ │ │ │ + 0x01297560 34752901 48752901 00000000 64811201 4u).Hu).....d... │ │ │ │ │ + 0x01297570 00000000 00000000 00000000 fbde1401 ................ │ │ │ │ │ + 0x01297580 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ + 0x01297590 81dd1401 ec870e01 6c752901 80752901 ........lu)..u). │ │ │ │ │ + 0x012975a0 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ + 0x012975b0 00000000 58dd1401 64811201 00000000 ....X...d....... │ │ │ │ │ + 0x012975c0 00000000 00000000 cddc1401 ec870e01 ................ │ │ │ │ │ + 0x012975d0 a4752901 b8752901 00000000 64811201 .u)..u).....d... │ │ │ │ │ 0x012975e0 00000000 00000000 00000000 bbd41401 ................ │ │ │ │ │ - 0x012975f0 ec870e01 c8752901 dc752901 00000000 .....u)..u)..... │ │ │ │ │ + 0x012975f0 ec870e01 bc722901 dc752901 00000000 .....r)..u)..... │ │ │ │ │ 0x01297600 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ - 0x01297610 add41401 64811201 00000000 00000000 ....d........... │ │ │ │ │ - 0x01297620 00000000 77c71401 ec870e01 00762901 ....w........v). │ │ │ │ │ + 0x01297610 a6d41401 64811201 00000000 00000000 ....d........... │ │ │ │ │ + 0x01297620 00000000 5ad11401 ec870e01 00762901 ....Z........v). │ │ │ │ │ 0x01297630 14762901 00000000 64811201 00000000 .v).....d....... │ │ │ │ │ - 0x01297640 00000000 00000000 f2b31401 ec870e01 ................ │ │ │ │ │ + 0x01297640 00000000 00000000 d5bd1401 ec870e01 ................ │ │ │ │ │ 0x01297650 f4722901 38762901 00000000 64811201 .r).8v).....d... │ │ │ │ │ - 0x01297660 00000000 00000000 00000000 ddb31401 ................ │ │ │ │ │ + 0x01297660 00000000 00000000 00000000 c7bd1401 ................ │ │ │ │ │ 0x01297670 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ 0x01297680 91b01401 ec870e01 5c762901 70762901 ........\v).pv). │ │ │ │ │ 0x01297690 00000000 54a10e01 85762901 39173501 ....T....v).9.5. │ │ │ │ │ 0x012976a0 00000000 54a10e01 4d762901 96762901 ....T...Mv)..v). │ │ │ │ │ 0x012976b0 00000000 54a10e01 29762901 a6762901 ....T...)v)..v). │ │ │ │ │ 0x012976c0 00000000 54a10e01 f1752901 b6762901 ....T....u)..v). │ │ │ │ │ - 0x012976d0 00000000 54a10e01 b9752901 c6762901 ....T....u)..v). │ │ │ │ │ - 0x012976e0 00000000 54a10e01 81752901 d6762901 ....T....u)..v). │ │ │ │ │ - 0x012976f0 00000000 54a10e01 49752901 e6762901 ....T...Iu)..v). │ │ │ │ │ - 0x01297700 00000000 54a10e01 11752901 f6762901 ....T....u)..v). │ │ │ │ │ - 0x01297710 00000000 54a10e01 d9742901 06772901 ....T....t)..w). │ │ │ │ │ - 0x01297720 00000000 54a10e01 a1742901 16772901 ....T....t)..w). │ │ │ │ │ - 0x01297730 00000000 54a10e01 e5722901 26772901 ....T....r).&w). │ │ │ │ │ - 0x01297740 00000000 54a10e01 69742901 36772901 ....T...it).6w). │ │ │ │ │ - 0x01297750 00000000 54a10e01 75722901 46772901 ....T...ur).Fw). │ │ │ │ │ - 0x01297760 00000000 54a10e01 45742901 56772901 ....T...Et).Vw). │ │ │ │ │ + 0x012976d0 00000000 54a10e01 cd752901 c6762901 ....T....u)..v). │ │ │ │ │ + 0x012976e0 00000000 54a10e01 95752901 d6762901 ....T....u)..v). │ │ │ │ │ + 0x012976f0 00000000 54a10e01 5d752901 e6762901 ....T...]u)..v). │ │ │ │ │ + 0x01297700 00000000 54a10e01 25752901 f6762901 ....T...%u)..v). │ │ │ │ │ + 0x01297710 00000000 54a10e01 ed742901 06772901 ....T....t)..w). │ │ │ │ │ + 0x01297720 00000000 54a10e01 b5742901 16772901 ....T....t)..w). │ │ │ │ │ + 0x01297730 00000000 54a10e01 7d742901 26772901 ....T...}t).&w). │ │ │ │ │ + 0x01297740 00000000 54a10e01 45742901 36772901 ....T...Et).6w). │ │ │ │ │ + 0x01297750 00000000 54a10e01 ad722901 46772901 ....T....r).Fw). │ │ │ │ │ + 0x01297760 00000000 54a10e01 75722901 56772901 ....T...ur).Vw). │ │ │ │ │ 0x01297770 00000000 ec870e01 0e742901 66772901 .........t).fw). │ │ │ │ │ 0x01297780 00000000 64811201 00000000 00000000 ....d........... │ │ │ │ │ - 0x01297790 00000000 2aac1401 ec870e01 84722901 ....*........r). │ │ │ │ │ + 0x01297790 00000000 2aac1401 ec870e01 bc722901 ....*........r). │ │ │ │ │ 0x012977a0 84772901 00000000 64811201 00000000 .w).....d....... │ │ │ │ │ - 0x012977b0 00000000 00000000 17ac1401 64811201 ............d... │ │ │ │ │ - 0x012977c0 00000000 00000000 00000000 e8681401 .............h.. │ │ │ │ │ + 0x012977b0 00000000 00000000 1aac1401 64811201 ............d... │ │ │ │ │ + 0x012977c0 00000000 00000000 00000000 abaa1401 ................ │ │ │ │ │ 0x012977d0 ec870e01 a8772901 bc772901 00000000 .....w)..w)..... │ │ │ │ │ 0x012977e0 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ - 0x012977f0 d8681401 64811201 00000000 00000000 .h..d........... │ │ │ │ │ + 0x012977f0 98aa1401 64811201 00000000 00000000 ....d........... │ │ │ │ │ 0x01297800 00000000 69671401 ec870e01 e0772901 ....ig.......w). │ │ │ │ │ 0x01297810 f4772901 00000000 54a10e01 09782901 .w).....T....x). │ │ │ │ │ 0x01297820 39173501 00000000 54a10e01 d1772901 9.5.....T....w). │ │ │ │ │ - 0x01297830 1a782901 00000000 54a10e01 e5722901 .x).....T....r). │ │ │ │ │ - 0x01297840 2a782901 00000000 54a10e01 99772901 *x).....T....w). │ │ │ │ │ + 0x01297830 1a782901 00000000 54a10e01 99772901 .x).....T....w). │ │ │ │ │ + 0x01297840 2a782901 00000000 54a10e01 ad722901 *x).....T....r). │ │ │ │ │ 0x01297850 3a782901 00000000 54a10e01 75722901 :x).....T...ur). │ │ │ │ │ 0x01297860 4a782901 00000000 ec870e01 3e722901 Jx).........>r). │ │ │ │ │ 0x01297870 5a782901 00000000 64811201 00000000 Zx).....d....... │ │ │ │ │ 0x01297880 00000000 00000000 48671401 64811201 ........Hg..d... │ │ │ │ │ 0x01297890 00000000 00000000 00000000 41671401 ............Ag.. │ │ │ │ │ 0x012978a0 64811201 00000000 00000000 00000000 d............... │ │ │ │ │ 0x012978b0 31671401 64811201 00000000 00000000 1g..d...........