--- /srv/rebuilderd/tmp/rebuilderdA5ZCBK/inputs/snap-templates_1.0.0.2-5+b1_amd64.deb +++ /srv/rebuilderd/tmp/rebuilderdA5ZCBK/out/snap-templates_1.0.0.2-5+b1_amd64.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2025-02-01 19:42:39.000000 debian-binary │ -rw-r--r-- 0 0 0 896 2025-02-01 19:42:39.000000 control.tar.xz │ --rw-r--r-- 0 0 0 2187812 2025-02-01 19:42:39.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 2186672 2025-02-01 19:42:39.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.gnu.property │ │ │ │ Owner Data size Description │ │ │ │ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 ISA needed: x86-64-baseline │ │ │ │ │ │ │ │ Displaying notes found in: .note.gnu.build-id │ │ │ │ Owner Data size Description │ │ │ │ - GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 5a814acd26d1db7488dbbaa7c4b28f77156b5d74 │ │ │ │ + GNU 0x00000014 NT_GNU_BUILD_ID (unique build ID bitstring) Build ID: 57c9754dff706b4197ace1324ca5e999ce9f5db8 │ │ │ │ │ │ │ │ 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 │ │ │ ├── strings --all --bytes=8 {} │ │ │ │ @@ -1,8 +1,8 @@ │ │ │ │ -k]t/lib64/ld-linux-x86-64.so.2 │ │ │ │ +/lib64/ld-linux-x86-64.so.2 │ │ │ │ __gmon_start__ │ │ │ │ __gmpz_init │ │ │ │ __gmpn_popcount │ │ │ │ __gmpz_export │ │ │ │ __gmpn_sub_1 │ │ │ │ __gmpn_and_n │ │ │ │ __gmpn_add │ │ │ │ @@ -576,56 +576,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 │ │ │ │ -Name: projname │ │ │ │ -Version: 0.1 │ │ │ │ -Synopsis: Project Synopsis Here │ │ │ │ -Description: Project Description Here │ │ │ │ -License: AllRightsReserved │ │ │ │ -Author: Author │ │ │ │ -Maintainer: maintainer@example.com │ │ │ │ -Stability: Experimental │ │ │ │ -Category: Web │ │ │ │ -Build-type: Simple │ │ │ │ -Cabal-version: >=1.2 │ │ │ │ -Flag old-base │ │ │ │ - default: False │ │ │ │ - manual: False │ │ │ │ -Executable projname │ │ │ │ - hs-source-dirs: src │ │ │ │ - main-is: Tutorial.lhs │ │ │ │ - Build-depends: │ │ │ │ - base >= 4.4 && < 5, │ │ │ │ - bytestring >= 0.9.1 && < 0.11, │ │ │ │ - lens >= 3.7.6 && < 4.18, │ │ │ │ - monad-control >= 1.0 && < 1.1, │ │ │ │ - mtl >= 2 && < 2.3, │ │ │ │ - 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 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 │ │ │ │ @@ -916,138 +874,143 @@ │ │ │ │ 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 │ │ │ │ Stability: Experimental │ │ │ │ Category: Web │ │ │ │ Build-type: Simple │ │ │ │ Cabal-version: >=1.2 │ │ │ │ -Flag development │ │ │ │ - Description: Whether to build the server in development (interpreted) mode │ │ │ │ - Default: False │ │ │ │ Flag old-base │ │ │ │ default: False │ │ │ │ manual: False │ │ │ │ Executable projname │ │ │ │ hs-source-dirs: src │ │ │ │ - main-is: Main.hs │ │ │ │ + main-is: Tutorial.lhs │ │ │ │ Build-depends: │ │ │ │ base >= 4.4 && < 5, │ │ │ │ bytestring >= 0.9.1 && < 0.11, │ │ │ │ - heist >= 1.0 && < 1.2, │ │ │ │ lens >= 3.7.6 && < 4.18, │ │ │ │ - map-syntax >= 0.2 && < 0.4, │ │ │ │ monad-control >= 1.0 && < 1.1, │ │ │ │ mtl >= 2 && < 2.3, │ │ │ │ snap >= 1.0 && < 1.2, │ │ │ │ snap-core >= 1.0 && < 1.1, │ │ │ │ - snap-server >= 1.0 && < 1.2, │ │ │ │ - snap-loader-static >= 1.0 && < 1.1, │ │ │ │ - text >= 0.11 && < 1.3, │ │ │ │ - time >= 1.1 && < 1.9, │ │ │ │ - xmlhtml >= 0.1 && < 0.3 │ │ │ │ - if flag(development) │ │ │ │ - build-depends: │ │ │ │ - snap-loader-dynamic >= 1.0 && < 1.1 │ │ │ │ - cpp-options: -DDEVELOPMENT │ │ │ │ - -- In development mode, speed is already going to suffer, so skip │ │ │ │ - -- the fancy optimization flags. Additionally, disable all │ │ │ │ - -- warnings. The hint library doesn't give an option to execute │ │ │ │ - -- compiled code when there were also warnings, so disabling │ │ │ │ - -- warnings allows quicker workflow. │ │ │ │ - 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 │ │ │ │ - │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -./snaplets/heist/templates/login.tpl │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -./snaplets/heist/templates/new_user.tpl │ │ │ │ -
│ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ - │ │ │ │ -
Login:
Password:
│ │ │ │ -./snaplets/heist/templates/userform.tpl │ │ │ │ - │ │ │ │ - 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 │ │ │ │ - padding: 0; │ │ │ │ - margin: 0; │ │ │ │ - background-color: #ffffff; │ │ │ │ - font-family: Verdana, Helvetica, sans-serif; │ │ │ │ - padding: 0; │ │ │ │ - margin: 0; │ │ │ │ - text-decoration: underline; │ │ │ │ -a :hover { │ │ │ │ - cursor: pointer; │ │ │ │ - text-decoration: underline; │ │ │ │ - border: none; │ │ │ │ -#content { │ │ │ │ - padding-left: 1em; │ │ │ │ - font-size: 60%; │ │ │ │ -./static/screen.css │ │ │ │ + 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 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 │ │ │ │ +upgrade, you might have to swap out this file for a newer version. But in │ │ │ │ +most cases you'll never need to modify this code. │ │ │ │ +module Main where │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ +import Control.Exception (SomeException, try) │ │ │ │ +import qualified Data.Text as T │ │ │ │ +import Snap.Http.Server │ │ │ │ +import Snap.Snaplet │ │ │ │ +import Snap.Snaplet.Config │ │ │ │ +import Snap.Core │ │ │ │ +import System.IO │ │ │ │ +import Site │ │ │ │ +#ifdef DEVELOPMENT │ │ │ │ +import Snap.Loader.Dynamic │ │ │ │ +import Snap.Loader.Static │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ +-- | This is the entry point for this web server application. It supports │ │ │ │ +-- easily switching between interpreting source and running statically compiled │ │ │ │ +-- code. │ │ │ │ +-- In either mode, the generated program should be run from the root of the │ │ │ │ +-- project tree. When it is run, it locates its templates, static content, and │ │ │ │ +-- source files in development mode, relative to the current working directory. │ │ │ │ +-- When compiled with the development flag, only changes to the libraries, your │ │ │ │ +-- cabal file, or this file should require a recompile to be picked up. │ │ │ │ +-- Everything else is interpreted at runtime. There are a few consequences of │ │ │ │ +-- this. │ │ │ │ +-- First, this is much slower. Running the interpreter takes a significant │ │ │ │ +-- chunk of time (a couple tenths of a second on the author's machine, at this │ │ │ │ +-- time), regardless of the simplicity of the loaded code. In order to │ │ │ │ +-- recompile and re-load server state as infrequently as possible, the source │ │ │ │ +-- directories are watched for updates, as are any extra directories specified │ │ │ │ +-- below. │ │ │ │ +-- Second, the generated server binary is MUCH larger, since it links in the │ │ │ │ +-- GHC API (via the hint library). │ │ │ │ +-- Third, and the reason you would ever want to actually compile with │ │ │ │ +-- development mode, is that it enables a faster development cycle. You can │ │ │ │ +-- simply edit a file, save your changes, and hit reload to see your changes │ │ │ │ +-- reflected immediately. │ │ │ │ +-- When this is compiled without the development flag, all the actions are │ │ │ │ +-- statically compiled in. This results in faster execution, a smaller binary │ │ │ │ +-- size, and having to recompile the server for any code change. │ │ │ │ +main :: IO () │ │ │ │ +main = do │ │ │ │ + -- Depending on the version of loadSnapTH in scope, this either enables │ │ │ │ + -- dynamic reloading, or compiles it without. The last argument to │ │ │ │ + -- loadSnapTH is a list of additional directories to watch for changes to │ │ │ │ + -- trigger reloads in development mode. It doesn't need to include source │ │ │ │ + -- directories, those are picked up automatically by the splice. │ │ │ │ + (conf, site, cleanup) <- $(loadSnapTH [| getConf |] │ │ │ │ + 'getActions │ │ │ │ + ["snaplets/heist/templates"]) │ │ │ │ + _ <- try $ httpServe conf site :: IO (Either SomeException ()) │ │ │ │ + cleanup │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ +-- | This action loads the config used by this application. The loaded config │ │ │ │ +-- is returned as the first element of the tuple produced by the loadSnapTH │ │ │ │ +-- Splice. The type is not solidly fixed, though it must be an IO action that │ │ │ │ +-- produces the same type as 'getActions' takes. It also must be an instance of │ │ │ │ +-- Typeable. If the type of this is changed, a full recompile will be needed to │ │ │ │ +-- pick up the change, even in development mode. │ │ │ │ +-- This action is only run once, regardless of whether development or │ │ │ │ +-- production mode is in use. │ │ │ │ +getConf :: IO (Config Snap AppConfig) │ │ │ │ +getConf = commandLineAppConfig defaultConfig │ │ │ │ +------------------------------------------------------------------------------ │ │ │ │ +-- | This function generates the the site handler and cleanup action from the │ │ │ │ +-- configuration. In production mode, this action is only run once. In │ │ │ │ +-- development mode, this action is run whenever the application is reloaded. │ │ │ │ +-- Development mode also makes sure that the cleanup actions are run │ │ │ │ +-- appropriately before shutdown. The cleanup action returned from loadSnapTH │ │ │ │ +-- should still be used after the server has stopped handling requests, as the │ │ │ │ +-- cleanup actions are only automatically run when a reload is triggered. │ │ │ │ +-- This sample doesn't actually use the config passed in, but more │ │ │ │ +-- 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 │ │ │ │ @@ -1131,136 +1094,142 @@ │ │ │ │ , _auth :: Snaplet (AuthManager App) │ │ │ │ makeLenses ''App │ │ │ │ instance HasHeist App where │ │ │ │ heistLens = subSnaplet heist │ │ │ │ ------------------------------------------------------------------------------ │ │ │ │ type AppHandler = Handler App App │ │ │ │ ./src/Application.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 │ │ │ │ -upgrade, you might have to swap out this file for a newer version. But in │ │ │ │ -most cases you'll never need to modify this code. │ │ │ │ -module Main where │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ -import Control.Exception (SomeException, try) │ │ │ │ -import qualified Data.Text as T │ │ │ │ -import Snap.Http.Server │ │ │ │ -import Snap.Snaplet │ │ │ │ -import Snap.Snaplet.Config │ │ │ │ -import Snap.Core │ │ │ │ -import System.IO │ │ │ │ -import Site │ │ │ │ -#ifdef DEVELOPMENT │ │ │ │ -import Snap.Loader.Dynamic │ │ │ │ -import Snap.Loader.Static │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ --- | This is the entry point for this web server application. It supports │ │ │ │ --- easily switching between interpreting source and running statically compiled │ │ │ │ --- code. │ │ │ │ --- In either mode, the generated program should be run from the root of the │ │ │ │ --- project tree. When it is run, it locates its templates, static content, and │ │ │ │ --- source files in development mode, relative to the current working directory. │ │ │ │ --- When compiled with the development flag, only changes to the libraries, your │ │ │ │ --- cabal file, or this file should require a recompile to be picked up. │ │ │ │ --- Everything else is interpreted at runtime. There are a few consequences of │ │ │ │ --- this. │ │ │ │ --- First, this is much slower. Running the interpreter takes a significant │ │ │ │ --- chunk of time (a couple tenths of a second on the author's machine, at this │ │ │ │ --- time), regardless of the simplicity of the loaded code. In order to │ │ │ │ --- recompile and re-load server state as infrequently as possible, the source │ │ │ │ --- directories are watched for updates, as are any extra directories specified │ │ │ │ --- below. │ │ │ │ --- Second, the generated server binary is MUCH larger, since it links in the │ │ │ │ --- GHC API (via the hint library). │ │ │ │ --- Third, and the reason you would ever want to actually compile with │ │ │ │ --- development mode, is that it enables a faster development cycle. You can │ │ │ │ --- simply edit a file, save your changes, and hit reload to see your changes │ │ │ │ --- reflected immediately. │ │ │ │ --- When this is compiled without the development flag, all the actions are │ │ │ │ --- statically compiled in. This results in faster execution, a smaller binary │ │ │ │ --- size, and having to recompile the server for any code change. │ │ │ │ -main :: IO () │ │ │ │ -main = do │ │ │ │ - -- Depending on the version of loadSnapTH in scope, this either enables │ │ │ │ - -- dynamic reloading, or compiles it without. The last argument to │ │ │ │ - -- loadSnapTH is a list of additional directories to watch for changes to │ │ │ │ - -- trigger reloads in development mode. It doesn't need to include source │ │ │ │ - -- directories, those are picked up automatically by the splice. │ │ │ │ - (conf, site, cleanup) <- $(loadSnapTH [| getConf |] │ │ │ │ - 'getActions │ │ │ │ - ["snaplets/heist/templates"]) │ │ │ │ - _ <- try $ httpServe conf site :: IO (Either SomeException ()) │ │ │ │ - cleanup │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ --- | This action loads the config used by this application. The loaded config │ │ │ │ --- is returned as the first element of the tuple produced by the loadSnapTH │ │ │ │ --- Splice. The type is not solidly fixed, though it must be an IO action that │ │ │ │ --- produces the same type as 'getActions' takes. It also must be an instance of │ │ │ │ --- Typeable. If the type of this is changed, a full recompile will be needed to │ │ │ │ --- pick up the change, even in development mode. │ │ │ │ --- This action is only run once, regardless of whether development or │ │ │ │ --- production mode is in use. │ │ │ │ -getConf :: IO (Config Snap AppConfig) │ │ │ │ -getConf = commandLineAppConfig defaultConfig │ │ │ │ ------------------------------------------------------------------------------- │ │ │ │ --- | This function generates the the site handler and cleanup action from the │ │ │ │ --- configuration. In production mode, this action is only run once. In │ │ │ │ --- development mode, this action is run whenever the application is reloaded. │ │ │ │ --- Development mode also makes sure that the cleanup actions are run │ │ │ │ --- appropriately before shutdown. The cleanup action returned from loadSnapTH │ │ │ │ --- should still be used after the server has stopped handling requests, as the │ │ │ │ --- cleanup actions are only automatically run when a reload is triggered. │ │ │ │ --- This sample doesn't actually use the config passed in, but more │ │ │ │ --- 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) │ │ │ │ -./snaplets/heist/templates │ │ │ │ -./snaplets/heist │ │ │ │ -./snaplets │ │ │ │ -./static │ │ │ │ -:set -isrc │ │ │ │ -:set -hide-package MonadCatchIO-mtl │ │ │ │ -:set -hide-package monads-fd │ │ │ │ -:set -XOverloadedStrings │ │ │ │ Name: projname │ │ │ │ Version: 0.1 │ │ │ │ Synopsis: Project Synopsis Here │ │ │ │ Description: Project Description Here │ │ │ │ License: AllRightsReserved │ │ │ │ Author: Author │ │ │ │ Maintainer: maintainer@example.com │ │ │ │ Stability: Experimental │ │ │ │ Category: Web │ │ │ │ Build-type: Simple │ │ │ │ Cabal-version: >=1.2 │ │ │ │ +Flag development │ │ │ │ + Description: Whether to build the server in development (interpreted) mode │ │ │ │ + Default: False │ │ │ │ +Flag old-base │ │ │ │ + default: False │ │ │ │ + manual: False │ │ │ │ Executable projname │ │ │ │ hs-source-dirs: src │ │ │ │ main-is: Main.hs │ │ │ │ Build-depends: │ │ │ │ - base >= 4 && < 5, │ │ │ │ - bytestring >= 0.9.1 && < 0.11, │ │ │ │ - mtl >= 2 && < 3, │ │ │ │ - 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 │ │ │ │ + base >= 4.4 && < 5, │ │ │ │ + bytestring >= 0.9.1 && < 0.11, │ │ │ │ + heist >= 1.0 && < 1.2, │ │ │ │ + lens >= 3.7.6 && < 4.18, │ │ │ │ + map-syntax >= 0.2 && < 0.4, │ │ │ │ + monad-control >= 1.0 && < 1.1, │ │ │ │ + mtl >= 2 && < 2.3, │ │ │ │ + snap >= 1.0 && < 1.2, │ │ │ │ + snap-core >= 1.0 && < 1.1, │ │ │ │ + snap-server >= 1.0 && < 1.2, │ │ │ │ + snap-loader-static >= 1.0 && < 1.1, │ │ │ │ + text >= 0.11 && < 1.3, │ │ │ │ + time >= 1.1 && < 1.9, │ │ │ │ + xmlhtml >= 0.1 && < 0.3 │ │ │ │ + if flag(development) │ │ │ │ + build-depends: │ │ │ │ + snap-loader-dynamic >= 1.0 && < 1.1 │ │ │ │ + cpp-options: -DDEVELOPMENT │ │ │ │ + -- In development mode, speed is already going to suffer, so skip │ │ │ │ + -- the fancy optimization flags. Additionally, disable all │ │ │ │ + -- warnings. The hint library doesn't give an option to execute │ │ │ │ + -- compiled code when there were also warnings, so disabling │ │ │ │ + -- warnings allows quicker workflow. │ │ │ │ + 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 │ │ │ │ + │ │ │ │ + │ │ │ │ + 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 │ │ │ │ +

Snap Example App Login

│ │ │ │ +

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

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

│ │ │ │ +./snaplets/heist/templates/_login.tpl │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
Login:
Password:
│ │ │ │ +./snaplets/heist/templates/userform.tpl │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +./snaplets/heist/templates/login.tpl │ │ │ │ + │ │ │ │ + Snap web server │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +
│ │ │ │ + │ │ │ │ +./snaplets/heist/templates/base.tpl │ │ │ │ + │ │ │ │ + │ │ │ │ + │ │ │ │ +./snaplets/heist/templates/new_user.tpl │ │ │ │ +

Register a new user

│ │ │ │ +/new_user │ │ │ │ +Add User │ │ │ │ + │ │ │ │ +./snaplets/heist/templates/_new_user.tpl │ │ │ │ + padding: 0; │ │ │ │ + margin: 0; │ │ │ │ + background-color: #ffffff; │ │ │ │ + font-family: Verdana, Helvetica, sans-serif; │ │ │ │ + padding: 0; │ │ │ │ + margin: 0; │ │ │ │ + text-decoration: underline; │ │ │ │ +a :hover { │ │ │ │ + cursor: pointer; │ │ │ │ + text-decoration: underline; │ │ │ │ + border: none; │ │ │ │ +#content { │ │ │ │ + padding-left: 1em; │ │ │ │ + font-size: 60%; │ │ │ │ +./static/screen.css │ │ │ │ +./snaplets/heist/templates │ │ │ │ +./snaplets/heist │ │ │ │ +./snaplets │ │ │ │ +./static │ │ │ │ {-# LANGUAGE OverloadedStrings #-} │ │ │ │ module Main where │ │ │ │ import Control.Applicative │ │ │ │ import Snap.Core │ │ │ │ import Snap.Util.FileServe │ │ │ │ import Snap.Http.Server │ │ │ │ main :: IO () │ │ │ │ @@ -1273,14 +1242,45 @@ │ │ │ │ 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 │ │ │ │ +:set -isrc │ │ │ │ +:set -hide-package MonadCatchIO-mtl │ │ │ │ +:set -hide-package monads-fd │ │ │ │ +:set -XOverloadedStrings │ │ │ │ +Name: projname │ │ │ │ +Version: 0.1 │ │ │ │ +Synopsis: Project Synopsis Here │ │ │ │ +Description: Project Description Here │ │ │ │ +License: AllRightsReserved │ │ │ │ +Author: Author │ │ │ │ +Maintainer: maintainer@example.com │ │ │ │ +Stability: Experimental │ │ │ │ +Category: Web │ │ │ │ +Build-type: Simple │ │ │ │ +Cabal-version: >=1.2 │ │ │ │ +Executable projname │ │ │ │ + hs-source-dirs: src │ │ │ │ + main-is: Main.hs │ │ │ │ + Build-depends: │ │ │ │ + base >= 4 && < 5, │ │ │ │ + bytestring >= 0.9.1 && < 0.11, │ │ │ │ + mtl >= 2 && < 3, │ │ │ │ + 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 │ │ │ │ main:Main.Help │ │ │ │ Data.Text.concat: size overflow │ │ │ │ overflowError │ │ │ │ breakOnAll │ │ │ │ : empty input │ │ │ │ Data.Text. │ │ │ │ Negative index │ │ │ ├── objdump --line-numbers --disassemble --demangle --reloc --no-show-raw-insn --section=.text {} │ │ │ │ @@ -6565,16 +6565,16 @@ │ │ │ │ add %esi,0x4a(%rbp) │ │ │ │ add $0x18,%r12 │ │ │ │ cmp 0x358(%r13),%r12 │ │ │ │ ja 40c826 <__gmpz_get_d_2exp@plt+0x65a6> │ │ │ │ movq $0x40c2d0,-0x10(%r12) │ │ │ │ mov 0x8(%rbp),%rax │ │ │ │ mov %rax,(%r12) │ │ │ │ - lea 0xd40ca1(%rip),%rdi │ │ │ │ - lea 0xd4060a(%rip),%rsi │ │ │ │ + lea 0xd40c81(%rip),%rdi │ │ │ │ + lea 0xd405ca(%rip),%rsi │ │ │ │ lea -0x10(%r12),%r14 │ │ │ │ add $0x10,%rbp │ │ │ │ jmp 40bb28 <__gmpz_get_d_2exp@plt+0x58a8> │ │ │ │ movq $0x18,0x388(%r13) │ │ │ │ jmp faec98 <__gmpz_get_d_2exp@plt+0xba8a18> │ │ │ │ movq $0x40c878,-0x10(%rbp) │ │ │ │ lea 0xd41aa3(%rip),%rsi │ │ │ │ @@ -6665,16 +6665,16 @@ │ │ │ │ add %esi,0x62(%rbp) │ │ │ │ add $0x18,%r12 │ │ │ │ cmp 0x358(%r13),%r12 │ │ │ │ ja 40c9ae <__gmpz_get_d_2exp@plt+0x672e> │ │ │ │ movq $0x40c3a0,-0x10(%r12) │ │ │ │ mov 0x10(%rbp),%rax │ │ │ │ mov %rax,(%r12) │ │ │ │ - lea 0xd40b19(%rip),%rdi │ │ │ │ - lea 0xd40482(%rip),%rsi │ │ │ │ + lea 0xd40af9(%rip),%rdi │ │ │ │ + lea 0xd40442(%rip),%rsi │ │ │ │ lea -0x10(%r12),%r14 │ │ │ │ add $0x18,%rbp │ │ │ │ jmp 40bb28 <__gmpz_get_d_2exp@plt+0x58a8> │ │ │ │ movq $0x18,0x388(%r13) │ │ │ │ jmp faec98 <__gmpz_get_d_2exp@plt+0xba8a18> │ │ │ │ movq $0x40ca08,0x0(%rbp) │ │ │ │ lea 0xd418cb(%rip),%rsi │ │ │ │ @@ -215872,15 +215872,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ lea -0x10(%rbp),%rax │ │ │ │ cmp %r15,%rax │ │ │ │ jb 4cccf1 <__gmpz_get_d_2exp@plt+0xc6a71> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0xb0b01c(%rip),%r14 │ │ │ │ + lea 0xb0b317(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%al │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -719993,15 +719993,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ lea -0x10(%rbp),%rax │ │ │ │ cmp %r15,%rax │ │ │ │ jb 68b559 <__gmpz_get_d_2exp@plt+0x2852d9> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x94c7b4(%rip),%r14 │ │ │ │ + lea 0x94caaf(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -720652,15 +720652,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ lea -0x10(%rbp),%rax │ │ │ │ cmp %r15,%rax │ │ │ │ jb 68bf21 <__gmpz_get_d_2exp@plt+0x285ca1> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x94bdec(%rip),%r14 │ │ │ │ + lea 0x94c0e7(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -721118,15 +721118,15 @@ │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 68c609 <__gmpz_get_d_2exp@plt+0x286389> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x94b704(%rip),%r14 │ │ │ │ + lea 0x94b9ff(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -721968,15 +721968,15 @@ │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 68d2f9 <__gmpz_get_d_2exp@plt+0x287079> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x94aa14(%rip),%r14 │ │ │ │ + lea 0x94ad0f(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -722807,15 +722807,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 68df55 <__gmpz_get_d_2exp@plt+0x287cd5> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ - lea 0x949db8(%rip),%r14 │ │ │ │ + lea 0x94a0b3(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f18ef0 <__gmpz_get_d_2exp@plt+0xb12c70> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax) │ │ │ │ add (%rax),%al │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -723244,15 +723244,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 68e5fd <__gmpz_get_d_2exp@plt+0x28837d> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ - lea 0x949710(%rip),%r14 │ │ │ │ + lea 0x949a0b(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f18ef0 <__gmpz_get_d_2exp@plt+0xb12c70> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax) │ │ │ │ add (%rax),%al │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -748894,15 +748894,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x932671(%rip),%r14 │ │ │ │ + lea 0x93296c(%rip),%r14 │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -749589,15 +749589,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x931c39(%rip),%r14 │ │ │ │ + lea 0x931f34(%rip),%r14 │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -750350,15 +750350,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x931101(%rip),%r14 │ │ │ │ + lea 0x9313fc(%rip),%r14 │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -750995,15 +750995,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %dl,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %cl,-0x75(%rax) │ │ │ │ jae 6a75c4 <__gmpz_get_d_2exp@plt+0x2a1344> │ │ │ │ - lea 0x930749(%rip),%r14 │ │ │ │ + lea 0x930a44(%rip),%r14 │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -751387,15 +751387,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x930101(%rip),%r14 │ │ │ │ + lea 0x9303fc(%rip),%r14 │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -752141,15 +752141,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %dl,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %cl,-0x75(%rax) │ │ │ │ jae 6a8774 <__gmpz_get_d_2exp@plt+0x2a24f4> │ │ │ │ - lea 0x92f599(%rip),%r14 │ │ │ │ + lea 0x92f894(%rip),%r14 │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ add %eax,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ adc (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -841736,15 +841736,15 @@ │ │ │ │ movq $0x6f6ad0,-0x30(%r12) │ │ │ │ mov %rax,-0x20(%r12) │ │ │ │ mov %rcx,-0x18(%r12) │ │ │ │ mov %rdx,-0x10(%r12) │ │ │ │ mov %rsi,-0x8(%r12) │ │ │ │ mov %rbx,(%r12) │ │ │ │ lea -0x30(%r12),%rsi │ │ │ │ - lea 0x8e1149(%rip),%r14 │ │ │ │ + lea 0x8e1444(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ movq $0x38,0x388(%r13) │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax,%rax,1) │ │ │ │ (bad) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -841792,15 +841792,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ lea -0x10(%rbp),%rax │ │ │ │ cmp %r15,%rax │ │ │ │ jb 6f6ca9 <__gmpz_get_d_2exp@plt+0x2f0a29> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x8e1064(%rip),%r14 │ │ │ │ + lea 0x8e135f(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -842365,15 +842365,15 @@ │ │ │ │ movq $0x6f7428,-0x30(%r12) │ │ │ │ mov %rax,-0x20(%r12) │ │ │ │ mov %rcx,-0x18(%r12) │ │ │ │ mov %rdx,-0x10(%r12) │ │ │ │ mov %rsi,-0x8(%r12) │ │ │ │ mov %rbx,(%r12) │ │ │ │ lea -0x30(%r12),%rsi │ │ │ │ - lea 0x8e07c1(%rip),%r14 │ │ │ │ + lea 0x8e0abc(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ movq $0x38,0x388(%r13) │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax,%rax,1) │ │ │ │ (bad) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -842422,15 +842422,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ lea -0x10(%rbp),%rax │ │ │ │ cmp %r15,%rax │ │ │ │ jb 6f7631 <__gmpz_get_d_2exp@plt+0x2f13b1> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x8e06dc(%rip),%r14 │ │ │ │ + lea 0x8e09d7(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -842746,15 +842746,15 @@ │ │ │ │ movq $0x6f7a20,-0x30(%r12) │ │ │ │ mov %rax,-0x20(%r12) │ │ │ │ mov %rcx,-0x18(%r12) │ │ │ │ mov %rdx,-0x10(%r12) │ │ │ │ mov %rsi,-0x8(%r12) │ │ │ │ mov %rbx,(%r12) │ │ │ │ lea -0x30(%r12),%rsi │ │ │ │ - lea 0x8e01e1(%rip),%r14 │ │ │ │ + lea 0x8e04dc(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ movq $0x38,0x388(%r13) │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax,%rax,1) │ │ │ │ (bad) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -842892,15 +842892,15 @@ │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 6f7d61 <__gmpz_get_d_2exp@plt+0x2f1ae1> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x8dffac(%rip),%r14 │ │ │ │ + lea 0x8e02a7(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -843498,15 +843498,15 @@ │ │ │ │ mov %rax,-0x28(%r12) │ │ │ │ mov %rcx,-0x20(%r12) │ │ │ │ mov %rdx,-0x18(%r12) │ │ │ │ mov %rsi,-0x10(%r12) │ │ │ │ mov %rdi,-0x8(%r12) │ │ │ │ mov %rbx,(%r12) │ │ │ │ lea -0x38(%r12),%rsi │ │ │ │ - lea 0x8df648(%rip),%r14 │ │ │ │ + lea 0x8df943(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ movq $0x40,0x388(%r13) │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax) │ │ │ │ (bad) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -843756,15 +843756,15 @@ │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 6f8ab9 <__gmpz_get_d_2exp@plt+0x2f2839> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ mov 0x10(%rbx),%rsi │ │ │ │ - lea 0x8df254(%rip),%r14 │ │ │ │ + lea 0x8df54f(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl (%rax) │ │ │ │ add (%rax),%eax │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -844415,15 +844415,15 @@ │ │ │ │ mov 0x18(%rbx),%rcx │ │ │ │ mov 0x20(%rbx),%rbx │ │ │ │ movq $0x6f92e0,-0x20(%r12) │ │ │ │ mov %rax,-0x10(%r12) │ │ │ │ mov %rcx,-0x8(%r12) │ │ │ │ mov %rbx,(%r12) │ │ │ │ lea -0x20(%r12),%rsi │ │ │ │ - lea 0x8de88b(%rip),%r14 │ │ │ │ + lea 0x8deb86(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ movq $0x28,0x388(%r13) │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax) │ │ │ │ add $0x0,%al │ │ │ │ add %al,(%rax) │ │ │ │ @@ -844562,15 +844562,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 6f96c5 <__gmpz_get_d_2exp@plt+0x2f3445> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ - lea 0x8de648(%rip),%r14 │ │ │ │ + lea 0x8de943(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f18ef0 <__gmpz_get_d_2exp@plt+0xb12c70> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax) │ │ │ │ add (%rax),%al │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -844892,15 +844892,15 @@ │ │ │ │ mov 0x28(%rbx),%rbx │ │ │ │ movq $0x6f9a48,-0x28(%r12) │ │ │ │ mov %rax,-0x18(%r12) │ │ │ │ mov %rcx,-0x10(%r12) │ │ │ │ mov %rdx,-0x8(%r12) │ │ │ │ mov %rbx,(%r12) │ │ │ │ lea -0x28(%r12),%rsi │ │ │ │ - lea 0x8de102(%rip),%r14 │ │ │ │ + lea 0x8de3fd(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f19000 <__gmpz_get_d_2exp@plt+0xb12d80> │ │ │ │ movq $0x30,0x388(%r13) │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopw 0x0(%rax,%rax,1) │ │ │ │ add $0x0,%eax │ │ │ │ add %al,(%rax) │ │ │ │ @@ -844941,15 +844941,15 @@ │ │ │ │ add %al,(%rax) │ │ │ │ add %cl,-0x73(%rax) │ │ │ │ rex.RB │ │ │ │ lock cmp %r15,%rax │ │ │ │ jb 6f9ce5 <__gmpz_get_d_2exp@plt+0x2f3a65> │ │ │ │ movq $0xfb5418,-0x10(%rbp) │ │ │ │ mov %rbx,-0x8(%rbp) │ │ │ │ - lea 0x8de028(%rip),%r14 │ │ │ │ + lea 0x8de323(%rip),%r14 │ │ │ │ add $0xfffffffffffffff0,%rbp │ │ │ │ jmp f18ef0 <__gmpz_get_d_2exp@plt+0xb12c70> │ │ │ │ jmp *-0x10(%r13) │ │ │ │ nopl 0x0(%rax) │ │ │ │ add (%rax),%al │ │ │ │ add %al,(%rax) │ │ │ │ add %al,(%rax) │ │ │ │ @@ -3308127,15 +3308127,15 @@ │ │ │ │ mov (%rax,%rbx,8),%rsi │ │ │ │ add $0x1,%rbx │ │ │ │ call f8e590 <__gmpz_get_d_2exp@plt+0xb88310> │ │ │ │ cmp %ebx,0x3b4423(%rip) │ │ │ │ jg f8fdc0 <__gmpz_get_d_2exp@plt+0xb89b40> │ │ │ │ add $0x28,%rsp │ │ │ │ mov %rbp,%rdi │ │ │ │ - mov $0xfd7d04,%esi │ │ │ │ + mov $0xfd7fff,%esi │ │ │ │ xor %eax,%eax │ │ │ │ pop %rbx │ │ │ │ pop %rbp │ │ │ │ pop %r12 │ │ │ │ pop %r13 │ │ │ │ pop %r14 │ │ │ │ pop %r15 │ │ │ │ @@ -3314400,15 +3314400,15 @@ │ │ │ │ call f95300 <__gmpz_get_d_2exp@plt+0xb8f080> │ │ │ │ mov 0x3ad85f(%rip),%eax │ │ │ │ movsd 0x8(%rsp),%xmm4 │ │ │ │ cmp %eax,%r15d │ │ │ │ jb f969d0 <__gmpz_get_d_2exp@plt+0xb90750> │ │ │ │ cmpb $0x0,0x3ad849(%rip) │ │ │ │ jne f96ec0 <__gmpz_get_d_2exp@plt+0xb90c40> │ │ │ │ - mov $0xfd7d04,%edi │ │ │ │ + mov $0xfd7fff,%edi │ │ │ │ xor %eax,%eax │ │ │ │ movsd %xmm4,0x8(%rsp) │ │ │ │ call f95300 <__gmpz_get_d_2exp@plt+0xb8f080> │ │ │ │ pxor %xmm1,%xmm1 │ │ │ │ pxor %xmm0,%xmm0 │ │ │ │ movsd 0x8(%rsp),%xmm4 │ │ │ │ cvtsi2sdq 0x3adcf2(%rip),%xmm1 │ │ │ │ @@ -3314776,15 +3314776,15 @@ │ │ │ │ mov $0xff4b5f,%edi │ │ │ │ xor %eax,%eax │ │ │ │ call f90810 <__gmpz_get_d_2exp@plt+0xb8a590> │ │ │ │ mov $0x11340a8,%edi │ │ │ │ xor %eax,%eax │ │ │ │ call f90810 <__gmpz_get_d_2exp@plt+0xb8a590> │ │ │ │ add $0x28,%rsp │ │ │ │ - mov $0xfd7d04,%edi │ │ │ │ + mov $0xfd7fff,%edi │ │ │ │ xor %eax,%eax │ │ │ │ pop %rbx │ │ │ │ pop %rbp │ │ │ │ pop %r12 │ │ │ │ pop %r13 │ │ │ │ pop %r14 │ │ │ │ pop %r15 │ │ │ │ @@ -3373471,15 +3373471,15 @@ │ │ │ │ call 405f60 <__errno_location@plt> │ │ │ │ mov (%rax),%edi │ │ │ │ call 405af0 │ │ │ │ mov $0xff905a,%edi │ │ │ │ mov %rax,%rsi │ │ │ │ xor %eax,%eax │ │ │ │ call f90810 <__gmpz_get_d_2exp@plt+0xb8a590> │ │ │ │ - mov $0xfd7d04,%edi │ │ │ │ + mov $0xfd7fff,%edi │ │ │ │ xor %eax,%eax │ │ │ │ call f90810 <__gmpz_get_d_2exp@plt+0xb8a590> │ │ │ │ add $0x100,%rsp │ │ │ │ mov %r12,%rdi │ │ │ │ pop %rbx │ │ │ │ pop %rbp │ │ │ │ pop %r12 │ │ │ ├── readelf --wide --decompress --hex-dump=.rodata {} │ │ │ │ @@ -40,2137 +40,2137 @@ │ │ │ │ 0x00fd1250 75637475 72652069 6e207468 65206375 ucture in the cu │ │ │ │ 0x00fd1260 7272656e 74206469 72656374 6f727900 rrent directory. │ │ │ │ 0x00fd1270 20202020 3c616374 696f6e3e 2063616e can │ │ │ │ 0x00fd1280 20626520 6f6e6520 6f663a00 2020736e be one of:. sn │ │ │ │ 0x00fd1290 6170203c 61637469 6f6e3e00 55736167 ap .Usag │ │ │ │ 0x00fd12a0 653a0053 6e617020 312e302e 302e3020 e:.Snap 1.0.0.0 │ │ │ │ 0x00fd12b0 50726f6a 65637420 4b69636b 73746172 Project Kickstar │ │ │ │ - 0x00fd12c0 74657200 4e616d65 3a202020 20202020 ter.Name: │ │ │ │ - 0x00fd12d0 20202020 20202020 2070726f 6a6e616d projnam │ │ │ │ - 0x00fd12e0 650a5665 7273696f 6e3a2020 20202020 e.Version: │ │ │ │ - 0x00fd12f0 20202020 20202030 2e310a53 796e6f70 0.1.Synop │ │ │ │ - 0x00fd1300 7369733a 20202020 20202020 20202020 sis: │ │ │ │ - 0x00fd1310 50726f6a 65637420 53796e6f 70736973 Project Synopsis │ │ │ │ - 0x00fd1320 20486572 650a4465 73637269 7074696f Here.Descriptio │ │ │ │ - 0x00fd1330 6e3a2020 20202020 20202050 726f6a65 n: Proje │ │ │ │ - 0x00fd1340 63742044 65736372 69707469 6f6e2048 ct Description H │ │ │ │ - 0x00fd1350 6572650a 4c696365 6e73653a 20202020 ere.License: │ │ │ │ - 0x00fd1360 20202020 20202020 20416c6c 52696768 AllRigh │ │ │ │ - 0x00fd1370 74735265 73657276 65640a41 7574686f tsReserved.Autho │ │ │ │ - 0x00fd1380 723a2020 20202020 20202020 20202020 r: │ │ │ │ - 0x00fd1390 41757468 6f720a4d 61696e74 61696e65 Author.Maintaine │ │ │ │ - 0x00fd13a0 723a2020 20202020 20202020 6d61696e r: main │ │ │ │ - 0x00fd13b0 7461696e 65724065 78616d70 6c652e63 tainer@example.c │ │ │ │ - 0x00fd13c0 6f6d0a53 74616269 6c697479 3a202020 om.Stability: │ │ │ │ - 0x00fd13d0 20202020 20202020 45787065 72696d65 Experime │ │ │ │ - 0x00fd13e0 6e74616c 0a436174 65676f72 793a2020 ntal.Category: │ │ │ │ - 0x00fd13f0 20202020 20202020 20205765 620a4275 Web.Bu │ │ │ │ - 0x00fd1400 696c642d 74797065 3a202020 20202020 ild-type: │ │ │ │ - 0x00fd1410 20202053 696d706c 650a4361 62616c2d Simple.Cabal- │ │ │ │ - 0x00fd1420 76657273 696f6e3a 20202020 2020203e version: > │ │ │ │ - 0x00fd1430 3d312e32 0a0a466c 6167206f 6c642d62 =1.2..Flag old-b │ │ │ │ - 0x00fd1440 6173650a 20206465 6661756c 743a2046 ase. default: F │ │ │ │ - 0x00fd1450 616c7365 0a20206d 616e7561 6c3a2046 alse. manual: F │ │ │ │ - 0x00fd1460 616c7365 0a0a4578 65637574 61626c65 alse..Executable │ │ │ │ - 0x00fd1470 2070726f 6a6e616d 650a2020 68732d73 projname. hs-s │ │ │ │ - 0x00fd1480 6f757263 652d6469 72733a20 7372630a ource-dirs: src. │ │ │ │ - 0x00fd1490 20206d61 696e2d69 733a2054 75746f72 main-is: Tutor │ │ │ │ - 0x00fd14a0 69616c2e 6c68730a 0a202042 75696c64 ial.lhs.. Build │ │ │ │ - 0x00fd14b0 2d646570 656e6473 3a0a2020 20206261 -depends:. ba │ │ │ │ - 0x00fd14c0 73652020 20202020 20202020 20202020 se │ │ │ │ - 0x00fd14d0 20202020 20202020 3e3d2034 2e342020 >= 4.4 │ │ │ │ - 0x00fd14e0 20202026 26203c20 352c0a20 20202062 && < 5,. b │ │ │ │ - 0x00fd14f0 79746573 7472696e 67202020 20202020 ytestring │ │ │ │ - 0x00fd1500 20202020 20202020 203e3d20 302e392e >= 0.9. │ │ │ │ - 0x00fd1510 31202020 2626203c 20302e31 312c0a20 1 && < 0.11,. │ │ │ │ - 0x00fd1520 2020206c 656e7320 20202020 20202020 lens │ │ │ │ - 0x00fd1530 20202020 20202020 20202020 203e3d20 >= │ │ │ │ - 0x00fd1540 332e372e 36202020 2626203c 20342e31 3.7.6 && < 4.1 │ │ │ │ - 0x00fd1550 382c0a20 2020206d 6f6e6164 2d636f6e 8,. monad-con │ │ │ │ - 0x00fd1560 74726f6c 20202020 20202020 20202020 trol │ │ │ │ - 0x00fd1570 203e3d20 312e3020 20202020 2626203c >= 1.0 && < │ │ │ │ - 0x00fd1580 20312e31 2c0a2020 20206d74 6c202020 1.1,. mtl │ │ │ │ - 0x00fd1590 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd15a0 20202020 3e3d2032 20202020 20202026 >= 2 & │ │ │ │ - 0x00fd15b0 26203c20 322e332c 0a202020 20736e61 & < 2.3,. sna │ │ │ │ - 0x00fd15c0 70202020 20202020 20202020 20202020 p │ │ │ │ - 0x00fd15d0 20202020 2020203e 3d20312e 30202020 >= 1.0 │ │ │ │ - 0x00fd15e0 20202626 203c2031 2e322c0a 20202020 && < 1.2,. │ │ │ │ - 0x00fd15f0 736e6170 2d636f72 65202020 20202020 snap-core │ │ │ │ - 0x00fd1600 20202020 20202020 20203e3d 20312e30 >= 1.0 │ │ │ │ - 0x00fd1610 20202020 20262620 3c20312e 312c0a20 && < 1.1,. │ │ │ │ - 0x00fd1620 20202073 6e61702d 73657276 65722020 snap-server │ │ │ │ - 0x00fd1630 20202020 20202020 20202020 203e3d20 >= │ │ │ │ - 0x00fd1640 312e3020 20202020 2626203c 20312e32 1.0 && < 1.2 │ │ │ │ - 0x00fd1650 0a0a2020 69662069 6d706c28 67686320 .. if impl(ghc │ │ │ │ - 0x00fd1660 3e3d2036 2e31322e 30290a20 20202067 >= 6.12.0). g │ │ │ │ - 0x00fd1670 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ - 0x00fd1680 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ - 0x00fd1690 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ - 0x00fd16a0 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ - 0x00fd16b0 320a2020 20202020 20202020 20202020 2. │ │ │ │ - 0x00fd16c0 2020202d 666e6f2d 7761726e 2d756e75 -fno-warn-unu │ │ │ │ - 0x00fd16d0 7365642d 646f2d62 696e640a 2020656c sed-do-bind. el │ │ │ │ - 0x00fd16e0 73650a20 20202067 68632d6f 7074696f se. ghc-optio │ │ │ │ - 0x00fd16f0 6e733a20 2d746872 65616465 64202d57 ns: -threaded -W │ │ │ │ - 0x00fd1700 616c6c20 2d667761 726e2d74 61627320 all -fwarn-tabs │ │ │ │ - 0x00fd1710 2d66756e 626f782d 73747269 63742d66 -funbox-strict-f │ │ │ │ - 0x00fd1720 69656c64 73202d4f 320a003e 207b2d23 ields -O2..> {-# │ │ │ │ - 0x00fd1730 204c414e 47554147 45204f76 65726c6f LANGUAGE Overlo │ │ │ │ - 0x00fd1740 61646564 53747269 6e677320 232d7d0a adedStrings #-}. │ │ │ │ - 0x00fd1750 3e206d6f 64756c65 20506172 74322077 > module Part2 w │ │ │ │ - 0x00fd1760 68657265 0a0a3e20 696d706f 72742020 here..> import │ │ │ │ - 0x00fd1770 20202020 20202020 20536e61 702e536e Snap.Sn │ │ │ │ - 0x00fd1780 61706c65 740a0a3e 20646174 6120466f aplet..> data Fo │ │ │ │ - 0x00fd1790 6f203d20 466f6f0a 3e0a3e20 64617461 o = Foo.>.> data │ │ │ │ - 0x00fd17a0 20426172 203d2042 61720a3e 0a3e2066 Bar = Bar.>.> f │ │ │ │ - 0x00fd17b0 6f6f496e 6974203a 3a20536e 61706c65 ooInit :: Snaple │ │ │ │ - 0x00fd17c0 74496e69 74206220 466f6f0a 3e20666f tInit b Foo.> fo │ │ │ │ - 0x00fd17d0 6f496e69 74203d20 6d616b65 536e6170 oInit = makeSnap │ │ │ │ - 0x00fd17e0 6c657420 22666f6f 22202246 6f6f2073 let "foo" "Foo s │ │ │ │ - 0x00fd17f0 6e61706c 65742220 4e6f7468 696e6720 naplet" Nothing │ │ │ │ - 0x00fd1800 2420646f 0a3e2020 20202072 65747572 $ do.> retur │ │ │ │ - 0x00fd1810 6e20466f 6f0a3e0a 3e206261 72496e69 n Foo.>.> barIni │ │ │ │ - 0x00fd1820 74203a3a 20536e61 706c6574 4c656e73 t :: SnapletLens │ │ │ │ - 0x00fd1830 20622046 6f6f202d 3e20536e 61706c65 b Foo -> Snaple │ │ │ │ - 0x00fd1840 74496e69 74206220 4261720a 3e206261 tInit b Bar.> ba │ │ │ │ - 0x00fd1850 72496e69 74205f68 203d206d 616b6553 rInit _h = makeS │ │ │ │ - 0x00fd1860 6e61706c 65742022 62617222 20224261 naplet "bar" "Ba │ │ │ │ - 0x00fd1870 7220736e 61706c65 7422204e 6f746869 r snaplet" Nothi │ │ │ │ - 0x00fd1880 6e672024 20646f0a 3e202020 20207265 ng $ do.> re │ │ │ │ - 0x00fd1890 7475726e 20426172 0a002e2f 7372632f turn Bar.../src/ │ │ │ │ - 0x00fd18a0 50617274 322e6c68 73005768 61742041 Part2.lhs.What A │ │ │ │ - 0x00fd18b0 72652053 6e61706c 6574733f 0a3d3d3d re Snaplets?.=== │ │ │ │ - 0x00fd18c0 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d0a ===============. │ │ │ │ - 0x00fd18d0 0a412073 6e61706c 65742069 73206120 .A snaplet is a │ │ │ │ - 0x00fd18e0 636f6d70 6f736162 6c652077 65622061 composable web a │ │ │ │ - 0x00fd18f0 70706c69 63617469 6f6e2e20 20536e61 pplication. Sna │ │ │ │ - 0x00fd1900 706c6574 7320616c 6c6f7720 796f7520 plets allow you │ │ │ │ - 0x00fd1910 746f2062 75696c64 0a73656c 662d636f to build.self-co │ │ │ │ - 0x00fd1920 6e746169 6e656420 70696563 6573206f ntained pieces o │ │ │ │ - 0x00fd1930 66206675 6e637469 6f6e616c 69747920 f functionality │ │ │ │ - 0x00fd1940 616e6420 676c7565 20746865 6d20746f and glue them to │ │ │ │ - 0x00fd1950 67657468 65722074 6f206d61 6b65206c gether to make l │ │ │ │ - 0x00fd1960 61726765 720a6170 706c6963 6174696f arger.applicatio │ │ │ │ - 0x00fd1970 6e732e20 20486572 65206172 6520736f ns. Here are so │ │ │ │ - 0x00fd1980 6d65206f 66207468 65207468 696e6773 me of the things │ │ │ │ - 0x00fd1990 2070726f 76696465 64206279 20746865 provided by the │ │ │ │ - 0x00fd19a0 20736e61 706c6574 20415049 3a0a0a20 snaplet API:.. │ │ │ │ - 0x00fd19b0 202d2049 6e667261 73747275 63747572 - Infrastructur │ │ │ │ - 0x00fd19c0 6520666f 72206170 706c6963 6174696f e for applicatio │ │ │ │ - 0x00fd19d0 6e207374 6174652f 656e7669 726f6e6d n state/environm │ │ │ │ - 0x00fd19e0 656e740a 0a20202d 20536e61 706c6574 ent.. - Snaplet │ │ │ │ - 0x00fd19f0 20696e69 7469616c 697a6174 696f6e2c initialization, │ │ │ │ - 0x00fd1a00 2072656c 6f61642c 20616e64 20636c65 reload, and cle │ │ │ │ - 0x00fd1a10 616e7570 0a0a2020 2d204d61 6e616765 anup.. - Manage │ │ │ │ - 0x00fd1a20 6d656e74 206f6620 66696c65 73797374 ment of filesyst │ │ │ │ - 0x00fd1a30 656d2064 61746120 616e6420 6175746f em data and auto │ │ │ │ - 0x00fd1a40 6d617469 6320736e 61706c65 7420696e matic snaplet in │ │ │ │ - 0x00fd1a50 7374616c 6c617469 6f6e0a0a 20202d20 stallation.. - │ │ │ │ - 0x00fd1a60 556e6966 69656420 636f6e66 69672066 Unified config f │ │ │ │ - 0x00fd1a70 696c6520 696e6672 61737472 75637475 ile infrastructu │ │ │ │ - 0x00fd1a80 72650a0a 4f6e6520 6578616d 706c6520 re..One example │ │ │ │ - 0x00fd1a90 6d696768 74206265 20612077 696b6920 might be a wiki │ │ │ │ - 0x00fd1aa0 736e6170 6c65742e 20204974 20776f75 snaplet. It wou │ │ │ │ - 0x00fd1ab0 6c642062 65206469 73747269 62757465 ld be distribute │ │ │ │ - 0x00fd1ac0 64206173 20612068 61736b65 6c6c0a70 d as a haskell.p │ │ │ │ - 0x00fd1ad0 61636b61 67652074 68617420 776f756c ackage that woul │ │ │ │ - 0x00fd1ae0 64206265 20696e73 74616c6c 65642077 d be installed w │ │ │ │ - 0x00fd1af0 69746820 63616261 6c20616e 6420776f ith cabal and wo │ │ │ │ - 0x00fd1b00 756c6420 70726f62 61626c79 20696e63 uld probably inc │ │ │ │ - 0x00fd1b10 6c756465 20636f64 652c0a63 6f6e6669 lude code,.confi │ │ │ │ - 0x00fd1b20 67206669 6c65732c 2048544d 4c207465 g files, HTML te │ │ │ │ - 0x00fd1b30 6d706c61 7465732c 20737479 6c657368 mplates, stylesh │ │ │ │ - 0x00fd1b40 65657473 2c204a61 76615363 72697074 eets, JavaScript │ │ │ │ - 0x00fd1b50 2c20696d 61676573 2c206574 632e2020 , images, etc. │ │ │ │ - 0x00fd1b60 5468650a 736e6170 6c657427 7320636f The.snaplet's co │ │ │ │ - 0x00fd1b70 64652077 6f756c64 2070726f 76696465 de would provide │ │ │ │ - 0x00fd1b80 20746865 206e6563 65737361 72792041 the necessary A │ │ │ │ - 0x00fd1b90 50492074 6f206c65 7420796f 75722061 PI to let your a │ │ │ │ - 0x00fd1ba0 70706c69 63617469 6f6e0a69 6e746572 pplication.inter │ │ │ │ - 0x00fd1bb0 61637420 7365616d 6c657373 6c792077 act seamlessly w │ │ │ │ - 0x00fd1bc0 69746820 74686520 77696b69 2066756e ith the wiki fun │ │ │ │ - 0x00fd1bd0 6374696f 6e616c69 74792e20 20576865 ctionality. Whe │ │ │ │ - 0x00fd1be0 6e20796f 75207275 6e20796f 75720a61 n you run your.a │ │ │ │ - 0x00fd1bf0 70706c69 63617469 6f6e2066 6f722074 pplication for t │ │ │ │ - 0x00fd1c00 68652066 69727374 2074696d 652c2061 he first time, a │ │ │ │ - 0x00fd1c10 6c6c206f 66207468 65207769 6b692073 ll of the wiki s │ │ │ │ - 0x00fd1c20 6e61706c 65742773 2066696c 65737973 naplet's filesys │ │ │ │ - 0x00fd1c30 74656d20 7265736f 75726365 730a7769 tem resources.wi │ │ │ │ - 0x00fd1c40 6c6c2061 75746f6d 61746963 616c6c79 ll automatically │ │ │ │ - 0x00fd1c50 20626520 636f7069 65642069 6e746f20 be copied into │ │ │ │ - 0x00fd1c60 74686520 61707072 6f707269 61746520 the appropriate │ │ │ │ - 0x00fd1c70 706c6163 65732e20 20546865 6e20796f places. Then yo │ │ │ │ - 0x00fd1c80 75207769 6c6c0a69 6d6d6564 69617465 u will.immediate │ │ │ │ - 0x00fd1c90 6c792062 65206162 6c652074 6f206375 ly be able to cu │ │ │ │ - 0x00fd1ca0 73746f6d 697a6520 74686520 77696b69 stomize the wiki │ │ │ │ - 0x00fd1cb0 20746f20 66697420 796f7572 206e6565 to fit your nee │ │ │ │ - 0x00fd1cc0 64732062 79206564 6974696e 6720636f ds by editing co │ │ │ │ - 0x00fd1cd0 6e666967 0a66696c 65732c20 70726f76 nfig.files, prov │ │ │ │ - 0x00fd1ce0 6964696e 6720796f 7572206f 776e2073 iding your own s │ │ │ │ - 0x00fd1cf0 74796c65 73686565 74732c20 6574632e tylesheets, etc. │ │ │ │ - 0x00fd1d00 20205765 2077696c 6c206469 73637573 We will discus │ │ │ │ - 0x00fd1d10 73207468 69732069 6e206d6f 72650a64 s this in more.d │ │ │ │ - 0x00fd1d20 65746169 6c206c61 7465722e 0a0a4120 etail later...A │ │ │ │ - 0x00fd1d30 736e6170 6c657420 63616e20 72657072 snaplet can repr │ │ │ │ - 0x00fd1d40 6573656e 7420616e 79746869 6e672066 esent anything f │ │ │ │ - 0x00fd1d50 726f6d20 6261636b 656e6420 4861736b rom backend Hask │ │ │ │ - 0x00fd1d60 656c6c20 696e6672 61737472 75637475 ell infrastructu │ │ │ │ - 0x00fd1d70 72652077 69746820 6e6f0a75 73657220 re with no.user │ │ │ │ - 0x00fd1d80 66616369 6e672066 756e6374 696f6e61 facing functiona │ │ │ │ - 0x00fd1d90 6c697479 20746f20 6120736d 616c6c20 lity to a small │ │ │ │ - 0x00fd1da0 77696467 6574206c 696b6520 61206368 widget like a ch │ │ │ │ - 0x00fd1db0 61742062 6f782074 68617420 676f6573 at box that goes │ │ │ │ - 0x00fd1dc0 20696e20 7468650a 636f726e 6572206f in the.corner o │ │ │ │ - 0x00fd1dd0 66206120 77656220 70616765 20746f20 f a web page to │ │ │ │ - 0x00fd1de0 616e2065 6e746972 65207374 616e6461 an entire standa │ │ │ │ - 0x00fd1df0 6c6f6e65 20776562 73697465 206c696b lone website lik │ │ │ │ - 0x00fd1e00 65206120 626c6f67 206f7220 666f7275 e a blog or foru │ │ │ │ - 0x00fd1e10 6d2e0a54 68652070 6f737369 62696c69 m..The possibili │ │ │ │ - 0x00fd1e20 74696573 20617265 20656e64 6c657373 ties are endless │ │ │ │ - 0x00fd1e30 2e202041 20736e61 706c6574 20697320 . A snaplet is │ │ │ │ - 0x00fd1e40 61207765 62206170 706c6963 6174696f a web applicatio │ │ │ │ - 0x00fd1e50 6e2c2061 6e642077 65620a61 70706c69 n, and web.appli │ │ │ │ - 0x00fd1e60 63617469 6f6e7320 61726520 736e6170 cations are snap │ │ │ │ - 0x00fd1e70 6c657473 2e202054 68697320 6d65616e lets. This mean │ │ │ │ - 0x00fd1e80 73207468 61742075 73696e67 20736e61 s that using sna │ │ │ │ - 0x00fd1e90 706c6574 7320616e 64207772 6974696e plets and writin │ │ │ │ - 0x00fd1ea0 670a736e 61706c65 74732061 72652061 g.snaplets are a │ │ │ │ - 0x00fd1eb0 6c6d6f73 74207468 65207361 6d652074 lmost the same t │ │ │ │ - 0x00fd1ec0 68696e67 2c20616e 64206974 27732074 hing, and it's t │ │ │ │ - 0x00fd1ed0 72697669 616c2074 6f206472 6f702061 rivial to drop a │ │ │ │ - 0x00fd1ee0 2077686f 6c652077 65627369 74650a69 whole website.i │ │ │ │ - 0x00fd1ef0 6e746f20 616e6f74 68657220 6f6e652e nto another one. │ │ │ │ - 0x00fd1f00 0a0a5765 27726520 7265616c 6c792065 ..We're really e │ │ │ │ - 0x00fd1f10 78636974 65642061 626f7574 20746865 xcited about the │ │ │ │ - 0x00fd1f20 20706f73 73696269 6c697469 65732061 possibilities a │ │ │ │ - 0x00fd1f30 7661696c 61626c65 20776974 6820736e vailable with sn │ │ │ │ - 0x00fd1f40 61706c65 74732e20 20496e0a 66616374 aplets. In.fact │ │ │ │ - 0x00fd1f50 2c20536e 61702061 6c726561 64792073 , Snap already s │ │ │ │ - 0x00fd1f60 68697073 20776974 6820736e 61706c65 hips with snaple │ │ │ │ - 0x00fd1f70 74732066 6f722073 65737369 6f6e732c ts for sessions, │ │ │ │ - 0x00fd1f80 20617574 68656e74 69636174 696f6e2c authentication, │ │ │ │ - 0x00fd1f90 20616e64 0a74656d 706c6174 696e6720 and.templating │ │ │ │ - 0x00fd1fa0 28776974 68204865 69737429 2c202054 (with Heist), T │ │ │ │ - 0x00fd1fb0 68697320 67697665 7320796f 75207573 his gives you us │ │ │ │ - 0x00fd1fc0 6566756c 2066756e 6374696f 6e616c69 eful functionali │ │ │ │ - 0x00fd1fd0 7479206f 7574206f 66207468 6520626f ty out of the bo │ │ │ │ - 0x00fd1fe0 782c0a61 6e64206a 756d7020 73746172 x,.and jump star │ │ │ │ - 0x00fd1ff0 74732079 6f757220 6f776e20 736e6170 ts your own snap │ │ │ │ - 0x00fd2000 6c657420 64657665 6c6f706d 656e7420 let development │ │ │ │ - 0x00fd2010 62792064 656d6f6e 73747261 74696e67 by demonstrating │ │ │ │ - 0x00fd2020 20736f6d 65207573 6566756c 0a646573 some useful.des │ │ │ │ - 0x00fd2030 69676e20 70617474 65726e73 2e202053 ign patterns. S │ │ │ │ - 0x00fd2040 6f207769 74686f75 74206675 72746865 o without furthe │ │ │ │ - 0x00fd2050 72206164 6f2c206c 65742773 20676574 r ado, let's get │ │ │ │ - 0x00fd2060 20737461 72746564 2e0a0a53 6e61706c started...Snapl │ │ │ │ - 0x00fd2070 6574204f 76657276 6965770a 3d3d3d3d et Overview.==== │ │ │ │ - 0x00fd2080 3d3d3d3d 3d3d3d3d 3d3d3d3d 0a0a5468 ============..Th │ │ │ │ - 0x00fd2090 65206865 61727420 6f662074 68652073 e heart of the s │ │ │ │ - 0x00fd20a0 6e61706c 65747320 696e6672 61737472 naplets infrastr │ │ │ │ - 0x00fd20b0 75637475 72652069 73207374 61746520 ucture is state │ │ │ │ - 0x00fd20c0 6d616e61 67656d65 6e742e20 204d6f73 management. Mos │ │ │ │ - 0x00fd20d0 74206e6f 6e747269 7669616c 0a706965 t nontrivial.pie │ │ │ │ - 0x00fd20e0 63657320 6f662061 20776562 20617070 ces of a web app │ │ │ │ - 0x00fd20f0 206e6565 6420736f 6d65206b 696e6420 need some kind │ │ │ │ - 0x00fd2100 6f662073 74617465 206f7220 656e7669 of state or envi │ │ │ │ - 0x00fd2110 726f6e6d 656e7420 64617461 2e202043 ronment data. C │ │ │ │ - 0x00fd2120 6f6d706f 6e656e74 730a7468 61742064 omponents.that d │ │ │ │ - 0x00fd2130 6f206e6f 74206e65 65642061 6e79206b o not need any k │ │ │ │ - 0x00fd2140 696e6420 6f662073 74617465 206f7220 ind of state or │ │ │ │ - 0x00fd2150 656e7669 726f6e6d 656e7420 61726520 environment are │ │ │ │ - 0x00fd2160 70726f62 61626c79 206d6f72 650a6170 probably more.ap │ │ │ │ - 0x00fd2170 70726f70 72696174 65206173 20612073 propriate as a s │ │ │ │ - 0x00fd2180 74616e64 616c6f6e 65206c69 62726172 tandalone librar │ │ │ │ - 0x00fd2190 79207468 616e2061 73206120 736e6170 y than as a snap │ │ │ │ - 0x00fd21a0 6c65742e 0a0a4265 666f7265 20776520 let...Before we │ │ │ │ - 0x00fd21b0 636f6e74 696e7565 2c207765 206d7573 continue, we mus │ │ │ │ - 0x00fd21c0 7420636c 61726966 7920616e 20696d70 t clarify an imp │ │ │ │ - 0x00fd21d0 6f727461 6e742070 6f696e74 2e202054 ortant point. T │ │ │ │ - 0x00fd21e0 68652053 6e617020 77656220 73657276 he Snap web serv │ │ │ │ - 0x00fd21f0 65720a70 726f6365 73736573 20656163 er.processes eac │ │ │ │ - 0x00fd2200 68207265 71756573 7420696e 20697473 h request in its │ │ │ │ - 0x00fd2210 206f776e 20677265 656e2074 68726561 own green threa │ │ │ │ - 0x00fd2220 642e2020 54686973 206d6561 6e732074 d. This means t │ │ │ │ - 0x00fd2230 68617420 65616368 20726571 75657374 hat each request │ │ │ │ - 0x00fd2240 0a77696c 6c207265 63656976 65206120 .will receive a │ │ │ │ - 0x00fd2250 73657061 72617465 20636f70 79206f66 separate copy of │ │ │ │ - 0x00fd2260 20746865 20737461 74652064 6566696e the state defin │ │ │ │ - 0x00fd2270 65642062 7920796f 75722061 70706c69 ed by your appli │ │ │ │ - 0x00fd2280 63617469 6f6e2061 6e640a73 6e61706c cation and.snapl │ │ │ │ - 0x00fd2290 6574732c 20616e64 206d6f64 69666963 ets, and modific │ │ │ │ - 0x00fd22a0 6174696f 6e732074 6f207468 61742073 ations to that s │ │ │ │ - 0x00fd22b0 74617465 206f6e6c 79206166 66656374 tate only affect │ │ │ │ - 0x00fd22c0 20746865 206c6f63 616c2074 68726561 the local threa │ │ │ │ - 0x00fd22d0 64207468 61740a67 656e6572 61746573 d that.generates │ │ │ │ - 0x00fd22e0 20612073 696e676c 65207265 73706f6e a single respon │ │ │ │ - 0x00fd22f0 73652e20 2046726f 6d206e6f 77206f6e se. From now on │ │ │ │ - 0x00fd2300 2c207768 656e2077 65207461 6c6b2061 , when we talk a │ │ │ │ - 0x00fd2310 626f7574 20737461 74652074 68697320 bout state this │ │ │ │ - 0x00fd2320 69730a77 68617420 77652061 72652074 is.what we are t │ │ │ │ - 0x00fd2330 616c6b69 6e672061 626f7574 2e202049 alking about. I │ │ │ │ - 0x00fd2340 6620796f 75206e65 65642067 6c6f6261 f you need globa │ │ │ │ - 0x00fd2350 6c206170 706c6963 6174696f 6e207374 l application st │ │ │ │ - 0x00fd2360 6174652c 20796f75 20686176 6520746f ate, you have to │ │ │ │ - 0x00fd2370 0a757365 20612074 68726561 642d7361 .use a thread-sa │ │ │ │ - 0x00fd2380 66652063 6f6e7374 72756374 20737563 fe construct suc │ │ │ │ - 0x00fd2390 68206173 20616e20 4d566172 206f7220 h as an MVar or │ │ │ │ - 0x00fd23a0 494f5265 662e0a0a 54686973 20706f73 IORef...This pos │ │ │ │ - 0x00fd23b0 74206973 20777269 7474656e 20696e20 t is written in │ │ │ │ - 0x00fd23c0 6c697465 72617465 20486173 6b656c6c literate Haskell │ │ │ │ - 0x00fd23d0 2e202049 74207573 65732061 20736d61 . It uses a sma │ │ │ │ - 0x00fd23e0 6c6c2065 78746572 6e616c20 6d6f6475 ll external modu │ │ │ │ - 0x00fd23f0 6c650a63 616c6c65 64205061 72743220 le.called Part2 │ │ │ │ - 0x00fd2400 74686174 20697320 5b617661 696c6162 that is [availab │ │ │ │ - 0x00fd2410 6c650a68 6572655d 28687474 70733a2f le.here](https:/ │ │ │ │ - 0x00fd2420 2f676974 6875622e 636f6d2f 736e6170 /github.com/snap │ │ │ │ - 0x00fd2430 6672616d 65776f72 6b2f736e 61702d74 framework/snap-t │ │ │ │ - 0x00fd2440 656d706c 61746573 2f626c6f 622f6d61 emplates/blob/ma │ │ │ │ - 0x00fd2450 73746572 2f70726f 6a656374 5f74656d ster/project_tem │ │ │ │ - 0x00fd2460 706c6174 652f7475 746f7269 616c2f73 plate/tutorial/s │ │ │ │ - 0x00fd2470 72632f50 61727432 2e6c6873 292e0a59 rc/Part2.lhs)..Y │ │ │ │ - 0x00fd2480 6f752063 616e2061 6c736f20 696e7374 ou can also inst │ │ │ │ - 0x00fd2490 616c6c20 74686520 66756c6c 20636f64 all the full cod │ │ │ │ - 0x00fd24a0 6520696e 20746865 20637572 72656e74 e in the current │ │ │ │ - 0x00fd24b0 20646972 6563746f 72792077 69746820 directory with │ │ │ │ - 0x00fd24c0 74686520 636f6d6d 616e640a 60736e61 the command.`sna │ │ │ │ - 0x00fd24d0 7020696e 69742074 75746f72 69616c60 p init tutorial` │ │ │ │ - 0x00fd24e0 2e202046 69727374 20776520 6e656564 . First we need │ │ │ │ - 0x00fd24f0 20746f20 67657420 696d706f 72747320 to get imports │ │ │ │ - 0x00fd2500 6f757420 6f662074 68652077 61792e0a out of the way.. │ │ │ │ - 0x00fd2510 0a3e207b 2d23204c 414e4755 41474520 .> {-# LANGUAGE │ │ │ │ - 0x00fd2520 54656d70 6c617465 4861736b 656c6c20 TemplateHaskell │ │ │ │ - 0x00fd2530 232d7d0a 3e207b2d 23204c41 4e475541 #-}.> {-# LANGUA │ │ │ │ - 0x00fd2540 4745204f 7665726c 6f616465 64537472 GE OverloadedStr │ │ │ │ - 0x00fd2550 696e6773 20232d7d 0a3e0a3e 206d6f64 ings #-}.>.> mod │ │ │ │ - 0x00fd2560 756c6520 4d61696e 20776865 72650a3e ule Main where.> │ │ │ │ - 0x00fd2570 0a3e2069 6d706f72 74202020 20202020 .> import │ │ │ │ - 0x00fd2580 20202020 436f6e74 726f6c2e 4170706c Control.Appl │ │ │ │ - 0x00fd2590 69636174 69766520 28283c7c 3e29290a icative ((<|>)). │ │ │ │ - 0x00fd25a0 3e20696d 706f7274 20202020 20202020 > import │ │ │ │ - 0x00fd25b0 20202043 6f6e7472 6f6c2e4c 656e732e Control.Lens. │ │ │ │ - 0x00fd25c0 54480a3e 20696d70 6f727420 20202020 TH.> import │ │ │ │ - 0x00fd25d0 20202020 2020436f 6e74726f 6c2e4d6f Control.Mo │ │ │ │ - 0x00fd25e0 6e61642e 494f2e43 6c617373 20286c69 nad.IO.Class (li │ │ │ │ - 0x00fd25f0 6674494f 290a3e20 696d706f 72742020 ftIO).> import │ │ │ │ - 0x00fd2600 20202020 20202020 20436f6e 74726f6c Control │ │ │ │ - 0x00fd2610 2e4d6f6e 61642e53 74617465 2e436c61 .Monad.State.Cla │ │ │ │ - 0x00fd2620 73732028 67657473 290a3e20 696d706f ss (gets).> impo │ │ │ │ - 0x00fd2630 72742020 20202020 20202020 20446174 rt Dat │ │ │ │ - 0x00fd2640 612e494f 5265660a 3e20696d 706f7274 a.IORef.> import │ │ │ │ - 0x00fd2650 20717561 6c696669 65642044 6174612e qualified Data. │ │ │ │ - 0x00fd2660 42797465 53747269 6e672e43 68617238 ByteString.Char8 │ │ │ │ - 0x00fd2670 20617320 420a3e20 696d706f 72742020 as B.> import │ │ │ │ - 0x00fd2680 20202020 20202020 20446174 612e4d61 Data.Ma │ │ │ │ - 0x00fd2690 7962650a 3e20696d 706f7274 20202020 ybe.> import │ │ │ │ - 0x00fd26a0 20202020 20202053 6e61700a 3e20696d Snap.> im │ │ │ │ - 0x00fd26b0 706f7274 20202020 20202020 20202053 port S │ │ │ │ - 0x00fd26c0 6e61702e 536e6170 6c65742e 48656973 nap.Snaplet.Heis │ │ │ │ - 0x00fd26d0 740a3e20 696d706f 72742020 20202020 t.> import │ │ │ │ - 0x00fd26e0 20202020 20506172 74320a0a 57652073 Part2..We s │ │ │ │ - 0x00fd26f0 74617274 206f7572 20617070 6c696361 tart our applica │ │ │ │ - 0x00fd2700 74696f6e 20627920 64656669 6e696e67 tion by defining │ │ │ │ - 0x00fd2710 20612064 61746120 73747275 63747572 a data structur │ │ │ │ - 0x00fd2720 6520746f 20686f6c 64207468 65207374 e to hold the st │ │ │ │ - 0x00fd2730 6174652e 20205468 69730a64 61746120 ate. This.data │ │ │ │ - 0x00fd2740 73747275 63747572 6520696e 636c7564 structure includ │ │ │ │ - 0x00fd2750 65732074 68652073 74617465 206f6620 es the state of │ │ │ │ - 0x00fd2760 616c6c20 736e6170 6c657473 20287772 all snaplets (wr │ │ │ │ - 0x00fd2770 61707065 6420696e 20612053 6e61706c apped in a Snapl │ │ │ │ - 0x00fd2780 65742920 75736564 0a627920 6f757220 et) used.by our │ │ │ │ - 0x00fd2790 6170706c 69636174 696f6e20 61732077 application as w │ │ │ │ - 0x00fd27a0 656c6c20 61732061 6e79206f 74686572 ell as any other │ │ │ │ - 0x00fd27b0 20737461 74652077 65206d69 67687420 state we might │ │ │ │ - 0x00fd27c0 77616e74 2e0a0a3e 20646174 61204170 want...> data Ap │ │ │ │ - 0x00fd27d0 70203d20 4170700a 3e202020 20207b20 p = App.> { │ │ │ │ - 0x00fd27e0 5f686569 73742020 20202020 203a3a20 _heist :: │ │ │ │ - 0x00fd27f0 536e6170 6c657420 28486569 73742041 Snaplet (Heist A │ │ │ │ - 0x00fd2800 7070290a 3e202020 20202c20 5f666f6f pp).> , _foo │ │ │ │ - 0x00fd2810 20202020 20202020 203a3a20 536e6170 :: Snap │ │ │ │ - 0x00fd2820 6c657420 466f6f0a 3e202020 20202c20 let Foo.> , │ │ │ │ - 0x00fd2830 5f626172 20202020 20202020 203a3a20 _bar :: │ │ │ │ - 0x00fd2840 536e6170 6c657420 4261720a 3e202020 Snaplet Bar.> │ │ │ │ - 0x00fd2850 20202c20 5f636f6d 70616e79 4e616d65 , _companyName │ │ │ │ - 0x00fd2860 203a3a20 494f5265 6620422e 42797465 :: IORef B.Byte │ │ │ │ - 0x00fd2870 53747269 6e670a3e 20202020 207d0a3e String.> }.> │ │ │ │ - 0x00fd2880 0a3e206d 616b654c 656e7365 73202727 .> makeLenses '' │ │ │ │ - 0x00fd2890 4170700a 0a546865 20666965 6c64206e App..The field n │ │ │ │ - 0x00fd28a0 616d6573 20626567 696e2077 69746820 ames begin with │ │ │ │ - 0x00fd28b0 616e2075 6e646572 73636f72 65206265 an underscore be │ │ │ │ - 0x00fd28c0 63617573 65206f66 20736f6d 65206d6f cause of some mo │ │ │ │ - 0x00fd28d0 72652063 6f6d706c 69636174 65640a74 re complicated.t │ │ │ │ - 0x00fd28e0 68696e67 7320676f 696e6720 6f6e2075 hings going on u │ │ │ │ - 0x00fd28f0 6e646572 20746865 20686f6f 642e2020 nder the hood. │ │ │ │ - 0x00fd2900 486f7765 7665722c 20616c6c 20796f75 However, all you │ │ │ │ - 0x00fd2910 206e6565 6420746f 206b6e6f 77207269 need to know ri │ │ │ │ - 0x00fd2920 67687420 6e6f7720 69730a74 68617420 ght now is.that │ │ │ │ - 0x00fd2930 796f7520 73686f75 6c642070 72656669 you should prefi │ │ │ │ - 0x00fd2940 78207468 696e6773 20776974 6820616e x things with an │ │ │ │ - 0x00fd2950 20756e64 65727363 6f726520 616e6420 underscore and │ │ │ │ - 0x00fd2960 7468656e 2063616c 6c20606d 616b654c then call `makeL │ │ │ │ - 0x00fd2970 656e7365 73602e0a 54686973 206c6574 enses`..This let │ │ │ │ - 0x00fd2980 7320796f 75207573 65207468 65206e61 s you use the na │ │ │ │ - 0x00fd2990 6d657320 77697468 6f757420 616e2075 mes without an u │ │ │ │ - 0x00fd29a0 6e646572 73636f72 6520696e 20746865 nderscore in the │ │ │ │ - 0x00fd29b0 20726573 74206f66 20796f75 720a6170 rest of your.ap │ │ │ │ - 0x00fd29c0 706c6963 6174696f 6e2e0a0a 54686520 plication...The │ │ │ │ - 0x00fd29d0 6e657874 20746869 6e672077 65206e65 next thing we ne │ │ │ │ - 0x00fd29e0 65642074 6f20646f 20697320 64656669 ed to do is defi │ │ │ │ - 0x00fd29f0 6e652061 6e20696e 69746961 6c697a65 ne an initialize │ │ │ │ - 0x00fd2a00 722e0a0a 3e206170 70496e69 74203a3a r...> appInit :: │ │ │ │ - 0x00fd2a10 20536e61 706c6574 496e6974 20417070 SnapletInit App │ │ │ │ - 0x00fd2a20 20417070 0a3e2061 7070496e 6974203d App.> appInit = │ │ │ │ - 0x00fd2a30 206d616b 65536e61 706c6574 20226d79 makeSnaplet "my │ │ │ │ - 0x00fd2a40 61707022 20224d79 20657861 6d706c65 app" "My example │ │ │ │ - 0x00fd2a50 20617070 6c696361 74696f6e 22204e6f application" No │ │ │ │ - 0x00fd2a60 7468696e 67202420 646f0a3e 20202020 thing $ do.> │ │ │ │ - 0x00fd2a70 20687320 3c2d206e 65737453 6e61706c hs <- nestSnapl │ │ │ │ - 0x00fd2a80 65742022 68656973 74222068 65697374 et "heist" heist │ │ │ │ - 0x00fd2a90 20242068 65697374 496e6974 20227465 $ heistInit "te │ │ │ │ - 0x00fd2aa0 6d706c61 74657322 0a3e2020 20202066 mplates".> f │ │ │ │ - 0x00fd2ab0 73203c2d 206e6573 74536e61 706c6574 s <- nestSnaplet │ │ │ │ - 0x00fd2ac0 2022666f 6f222066 6f6f2024 20666f6f "foo" foo $ foo │ │ │ │ - 0x00fd2ad0 496e6974 0a3e2020 20202062 73203c2d Init.> bs <- │ │ │ │ - 0x00fd2ae0 206e6573 74536e61 706c6574 20222220 nestSnaplet "" │ │ │ │ - 0x00fd2af0 62617220 24206e61 6d65536e 61706c65 bar $ nameSnaple │ │ │ │ - 0x00fd2b00 7420226e 65776e61 6d652220 24206261 t "newname" $ ba │ │ │ │ - 0x00fd2b10 72496e69 7420666f 6f0a3e20 20202020 rInit foo.> │ │ │ │ - 0x00fd2b20 61646452 6f757465 73205b20 28226865 addRoutes [ ("he │ │ │ │ - 0x00fd2b30 6c6c6f22 2c207772 69746554 65787420 llo", writeText │ │ │ │ - 0x00fd2b40 2268656c 6c6f2077 6f726c64 22290a3e "hello world").> │ │ │ │ - 0x00fd2b50 20202020 20202020 20202020 2020202c , │ │ │ │ - 0x00fd2b60 20282266 6f6f6e61 6d65222c 20776974 ("fooname", wit │ │ │ │ - 0x00fd2b70 6820666f 6f206e61 6d655061 6765290a h foo namePage). │ │ │ │ - 0x00fd2b80 3e202020 20202020 20202020 20202020 > │ │ │ │ - 0x00fd2b90 2c202822 6261726e 616d6522 2c207769 , ("barname", wi │ │ │ │ - 0x00fd2ba0 74682062 6172206e 616d6550 61676529 th bar namePage) │ │ │ │ - 0x00fd2bb0 0a3e2020 20202020 20202020 20202020 .> │ │ │ │ - 0x00fd2bc0 202c2028 22636f6d 70616e79 222c2063 , ("company", c │ │ │ │ - 0x00fd2bd0 6f6d7061 6e794861 6e646c65 72290a3e ompanyHandler).> │ │ │ │ - 0x00fd2be0 20202020 20202020 20202020 2020205d ] │ │ │ │ - 0x00fd2bf0 0a3e2020 20202077 72617053 69746520 .> wrapSite │ │ │ │ - 0x00fd2c00 283c7c3e 20686569 73745365 72766529 (<|> heistServe) │ │ │ │ - 0x00fd2c10 0a3e2020 20202072 6566203c 2d206c69 .> ref <- li │ │ │ │ - 0x00fd2c20 6674494f 2024206e 6577494f 52656620 ftIO $ newIORef │ │ │ │ - 0x00fd2c30 22666f6f 436f7270 220a3e20 20202020 "fooCorp".> │ │ │ │ - 0x00fd2c40 72657475 726e2024 20417070 20687320 return $ App hs │ │ │ │ - 0x00fd2c50 66732062 73207265 660a0a46 6f72206e fs bs ref..For n │ │ │ │ - 0x00fd2c60 6f772064 6f6e2774 20776f72 72792061 ow don't worry a │ │ │ │ - 0x00fd2c70 626f7574 20616c6c 20746865 20646574 bout all the det │ │ │ │ - 0x00fd2c80 61696c73 206f6620 74686973 20636f64 ails of this cod │ │ │ │ - 0x00fd2c90 652e2020 5765276c 6c20776f 726b2074 e. We'll work t │ │ │ │ - 0x00fd2ca0 68726f75 67682074 68650a69 6e646976 hrough the.indiv │ │ │ │ - 0x00fd2cb0 69647561 6c207069 65636573 206f6e65 idual pieces one │ │ │ │ - 0x00fd2cc0 20617420 61207469 6d652e20 20546865 at a time. The │ │ │ │ - 0x00fd2cd0 20626173 69632069 64656120 68657265 basic idea here │ │ │ │ - 0x00fd2ce0 20697320 74686174 20746f20 696e6974 is that to init │ │ │ │ - 0x00fd2cf0 69616c69 7a652061 6e0a6170 706c6963 ialize an.applic │ │ │ │ - 0x00fd2d00 6174696f 6e2c2077 65206669 72737420 ation, we first │ │ │ │ - 0x00fd2d10 696e6974 69616c69 7a652065 61636820 initialize each │ │ │ │ - 0x00fd2d20 6f662074 68652073 6e61706c 6574732c of the snaplets, │ │ │ │ - 0x00fd2d30 20616464 20736f6d 6520726f 75746573 add some routes │ │ │ │ - 0x00fd2d40 2c207275 6e20610a 66756e63 74696f6e , run a.function │ │ │ │ - 0x00fd2d50 20777261 7070696e 6720616c 6c207468 wrapping all th │ │ │ │ - 0x00fd2d60 6520726f 75746573 2c20616e 64207265 e routes, and re │ │ │ │ - 0x00fd2d70 7475726e 20746865 20726573 756c7469 turn the resulti │ │ │ │ - 0x00fd2d80 6e672073 74617465 20646174 610a7374 ng state data.st │ │ │ │ - 0x00fd2d90 72756374 7572652e 20205468 69732065 ructure. This e │ │ │ │ - 0x00fd2da0 78616d70 6c652064 656d6f6e 73747261 xample demonstra │ │ │ │ - 0x00fd2db0 74657320 74686520 75736520 6f662061 tes the use of a │ │ │ │ - 0x00fd2dc0 20666577 206f6620 74686520 6d6f7374 few of the most │ │ │ │ - 0x00fd2dd0 20636f6d 6d6f6e0a 736e6170 6c657420 common.snaplet │ │ │ │ - 0x00fd2de0 66756e63 74696f6e 732e0a0a 6e657374 functions...nest │ │ │ │ - 0x00fd2df0 536e6170 6c65740a 2d2d2d2d 2d2d2d2d Snaplet.-------- │ │ │ │ - 0x00fd2e00 2d2d2d0a 0a416c6c 2063616c 6c732074 ---..All calls t │ │ │ │ - 0x00fd2e10 6f206368 696c6420 736e6170 6c657420 o child snaplet │ │ │ │ - 0x00fd2e20 696e6974 69616c69 7a657220 66756e63 initializer func │ │ │ │ - 0x00fd2e30 74696f6e 73206d75 73742062 65207772 tions must be wr │ │ │ │ - 0x00fd2e40 61707065 6420696e 20612063 616c6c20 apped in a call │ │ │ │ - 0x00fd2e50 746f0a6e 65737453 6e61706c 65742e20 to.nestSnaplet. │ │ │ │ - 0x00fd2e60 20546865 20666972 73742070 6172616d The first param │ │ │ │ - 0x00fd2e70 65746572 20697320 61205552 4c207061 eter is a URL pa │ │ │ │ - 0x00fd2e80 74682073 65676d65 6e742074 68617420 th segment that │ │ │ │ - 0x00fd2e90 69732075 73656420 746f2070 72656669 is used to prefi │ │ │ │ - 0x00fd2ea0 780a616c 6c20726f 75746573 20646566 x.all routes def │ │ │ │ - 0x00fd2eb0 696e6564 20627920 74686520 736e6170 ined by the snap │ │ │ │ - 0x00fd2ec0 6c65742e 20205468 6973206c 65747320 let. This lets │ │ │ │ - 0x00fd2ed0 796f7520 656e7375 72652074 68617420 you ensure that │ │ │ │ - 0x00fd2ee0 74686572 65207769 6c6c2062 65206e6f there will be no │ │ │ │ - 0x00fd2ef0 0a70726f 626c656d 73207769 74682064 .problems with d │ │ │ │ - 0x00fd2f00 75706c69 63617465 20726f75 74657320 uplicate routes │ │ │ │ - 0x00fd2f10 64656669 6e656420 696e2064 69666665 defined in diffe │ │ │ │ - 0x00fd2f20 72656e74 20736e61 706c6574 732e2020 rent snaplets. │ │ │ │ - 0x00fd2f30 49662074 68652066 6f6f0a73 6e61706c If the foo.snapl │ │ │ │ - 0x00fd2f40 65742064 6566696e 65732061 20726f75 et defines a rou │ │ │ │ - 0x00fd2f50 74652060 2f666f6f 70616765 602c2074 te `/foopage`, t │ │ │ │ - 0x00fd2f60 68656e20 696e2074 68652061 626f7665 hen in the above │ │ │ │ - 0x00fd2f70 20657861 6d706c65 2c207468 61742070 example, that p │ │ │ │ - 0x00fd2f80 61676520 77696c6c 0a626520 61766169 age will.be avai │ │ │ │ - 0x00fd2f90 6c61626c 65206174 20602f66 6f6f2f66 lable at `/foo/f │ │ │ │ - 0x00fd2fa0 6f6f7061 6765602e 2020536f 6d657469 oopage`. Someti │ │ │ │ - 0x00fd2fb0 6d657320 74686f75 67682c20 796f7520 mes though, you │ │ │ │ - 0x00fd2fc0 6d696768 74207761 6e742061 20736e61 might want a sna │ │ │ │ - 0x00fd2fd0 706c6574 27730a72 6f757465 7320746f plet's.routes to │ │ │ │ - 0x00fd2fe0 20626520 61766169 6c61626c 65206174 be available at │ │ │ │ - 0x00fd2ff0 20746865 20746f70 206c6576 656c2e20 the top level. │ │ │ │ - 0x00fd3000 20546f20 646f2074 6861742c 206a7573 To do that, jus │ │ │ │ - 0x00fd3010 74207061 73732061 6e20656d 70747920 t pass an empty │ │ │ │ - 0x00fd3020 73747269 6e670a74 6f206e65 7374536e string.to nestSn │ │ │ │ - 0x00fd3030 61706c65 74206173 2073686f 776e2061 aplet as shown a │ │ │ │ - 0x00fd3040 626f7665 20776974 68207468 65206261 bove with the ba │ │ │ │ - 0x00fd3050 7220736e 61706c65 742e0a0a 496e206f r snaplet...In o │ │ │ │ - 0x00fd3060 75722065 78616d70 6c652061 626f7665 ur example above │ │ │ │ - 0x00fd3070 2c207468 65206261 7220736e 61706c65 , the bar snaple │ │ │ │ - 0x00fd3080 7420646f 65732073 6f6d6574 68696e67 t does something │ │ │ │ - 0x00fd3090 20746861 74206e65 65647320 746f206b that needs to k │ │ │ │ - 0x00fd30a0 6e6f7720 61626f75 740a7468 6520666f now about.the fo │ │ │ │ - 0x00fd30b0 6f20736e 61706c65 742e2020 4d617962 o snaplet. Mayb │ │ │ │ - 0x00fd30c0 6520666f 6f206973 20612064 61746162 e foo is a datab │ │ │ │ - 0x00fd30d0 61736520 736e6170 6c657420 616e6420 ase snaplet and │ │ │ │ - 0x00fd30e0 62617220 77616e74 7320746f 2073746f bar wants to sto │ │ │ │ - 0x00fd30f0 7265206f 720a7265 61642073 6f6d6574 re or.read somet │ │ │ │ - 0x00fd3100 68696e67 2e202049 6e206f72 64657220 hing. In order │ │ │ │ - 0x00fd3110 746f206d 616b6520 74686174 20686170 to make that hap │ │ │ │ - 0x00fd3120 70656e2c 20697420 6e656564 7320746f pen, it needs to │ │ │ │ - 0x00fd3130 20686176 65206120 2268616e 646c6522 have a "handle" │ │ │ │ - 0x00fd3140 20746f0a 74686520 736e6170 6c65742e to.the snaplet. │ │ │ │ - 0x00fd3150 20204f75 72206861 6e646c65 73206172 Our handles ar │ │ │ │ - 0x00fd3160 65207768 61746576 65722066 69656c64 e whatever field │ │ │ │ - 0x00fd3170 206e616d 65732077 65207573 65642069 names we used i │ │ │ │ - 0x00fd3180 6e207468 65204170 70206461 74610a73 n the App data.s │ │ │ │ - 0x00fd3190 74727563 74757265 206d696e 75732074 tructure minus t │ │ │ │ - 0x00fd31a0 68652069 6e697469 616c2075 6e646572 he initial under │ │ │ │ - 0x00fd31b0 73636f72 65206368 61726163 7465722e score character. │ │ │ │ - 0x00fd31c0 20205468 65792061 72652061 75746f6d They are autom │ │ │ │ - 0x00fd31d0 61746963 616c6c79 0a67656e 65726174 atically.generat │ │ │ │ - 0x00fd31e0 65642062 79207468 6520606d 616b654c ed by the `makeL │ │ │ │ - 0x00fd31f0 656e7365 73602066 756e6374 696f6e2e enses` function. │ │ │ │ - 0x00fd3200 2020466f 72206e6f 77206974 27732073 For now it's s │ │ │ │ - 0x00fd3210 75666669 6369656e 7420746f 20746869 ufficient to thi │ │ │ │ - 0x00fd3220 6e6b206f 660a7468 656d2061 73206120 nk of.them as a │ │ │ │ - 0x00fd3230 67657474 65722061 6e642061 20736574 getter and a set │ │ │ │ - 0x00fd3240 74657220 636f6d62 696e6564 2028746f ter combined (to │ │ │ │ - 0x00fd3250 20757365 20616e20 4f4f206d 65746170 use an OO metap │ │ │ │ - 0x00fd3260 686f7229 2e0a0a54 68652073 65636f6e hor)...The secon │ │ │ │ - 0x00fd3270 64207061 72616d65 74657220 746f206e d parameter to n │ │ │ │ - 0x00fd3280 65737453 6e61706c 65742069 73207468 estSnaplet is th │ │ │ │ - 0x00fd3290 65206c65 6e732074 6f207468 6520736e e lens to the sn │ │ │ │ - 0x00fd32a0 61706c65 7420796f 75277265 206e6573 aplet you're nes │ │ │ │ - 0x00fd32b0 74696e67 2e0a496e 206f7264 65722074 ting..In order t │ │ │ │ - 0x00fd32c0 6f20706c 61636520 61207069 65636520 o place a piece │ │ │ │ - 0x00fd32d0 696e746f 20746865 2070757a 7a6c652c into the puzzle, │ │ │ │ - 0x00fd32e0 20796f75 206e6565 6420746f 206b6e6f you need to kno │ │ │ │ - 0x00fd32f0 77207768 65726520 69742067 6f65732e w where it goes. │ │ │ │ - 0x00fd3300 0a0a6e61 6d65536e 61706c65 740a2d2d ..nameSnaplet.-- │ │ │ │ - 0x00fd3310 2d2d2d2d 2d2d2d2d 2d0a0a54 68652061 ---------..The a │ │ │ │ - 0x00fd3320 7574686f 72206f66 20612073 6e61706c uthor of a snapl │ │ │ │ - 0x00fd3330 65742064 6566696e 65732061 20646566 et defines a def │ │ │ │ - 0x00fd3340 61756c74 206e616d 6520666f 72207468 ault name for th │ │ │ │ - 0x00fd3350 6520736e 61706c65 7420696e 20746865 e snaplet in the │ │ │ │ - 0x00fd3360 20666972 73740a61 7267756d 656e7420 first.argument │ │ │ │ - 0x00fd3370 746f2074 6865206d 616b6553 6e61706c to the makeSnapl │ │ │ │ - 0x00fd3380 65742066 756e6374 696f6e2e 20205468 et function. Th │ │ │ │ - 0x00fd3390 6973206e 616d6520 69732075 73656420 is name is used │ │ │ │ - 0x00fd33a0 666f7220 74686520 736e6170 6c657427 for the snaplet' │ │ │ │ - 0x00fd33b0 730a6469 72656374 6f727920 696e2074 s.directory in t │ │ │ │ - 0x00fd33c0 68652066 696c6573 79737465 6d2e2020 he filesystem. │ │ │ │ - 0x00fd33d0 49662079 6f752064 6f6e2774 2077616e If you don't wan │ │ │ │ - 0x00fd33e0 7420746f 20757365 20746865 20646566 t to use the def │ │ │ │ - 0x00fd33f0 61756c74 206e616d 652c2079 6f750a63 ault name, you.c │ │ │ │ - 0x00fd3400 616e206f 76657272 69646520 69742077 an override it w │ │ │ │ - 0x00fd3410 69746820 74686520 606e616d 65536e61 ith the `nameSna │ │ │ │ - 0x00fd3420 706c6574 60206675 6e637469 6f6e2e20 plet` function. │ │ │ │ - 0x00fd3430 20416c73 6f2c2069 6620796f 75207761 Also, if you wa │ │ │ │ - 0x00fd3440 6e742074 6f206861 76652074 776f0a69 nt to have two.i │ │ │ │ - 0x00fd3450 6e737461 6e636573 206f6620 74686520 nstances of the │ │ │ │ - 0x00fd3460 73616d65 20736e61 706c6574 2c207468 same snaplet, th │ │ │ │ - 0x00fd3470 656e2079 6f752077 696c6c20 6e656564 en you will need │ │ │ │ - 0x00fd3480 20746f20 75736520 606e616d 65536e61 to use `nameSna │ │ │ │ - 0x00fd3490 706c6574 6020746f 20676976 650a6174 plet` to give.at │ │ │ │ - 0x00fd34a0 206c6561 7374206f 6e65206f 66207468 least one of th │ │ │ │ - 0x00fd34b0 656d2061 20756e69 71756520 6e616d65 em a unique name │ │ │ │ - 0x00fd34c0 2e0a0a61 6464526f 75746573 0a2d2d2d ...addRoutes.--- │ │ │ │ - 0x00fd34d0 2d2d2d2d 2d2d0a0a 54686520 60616464 ------..The `add │ │ │ │ - 0x00fd34e0 526f7574 65736020 66756e63 74696f6e Routes` function │ │ │ │ - 0x00fd34f0 20697320 686f7720 616e2061 70706c69 is how an appli │ │ │ │ - 0x00fd3500 63617469 6f6e2028 6f722073 6e61706c cation (or snapl │ │ │ │ - 0x00fd3510 65742920 64656669 6e657320 6974730a et) defines its. │ │ │ │ - 0x00fd3520 726f7574 65732e20 20556e64 65722074 routes. Under t │ │ │ │ - 0x00fd3530 68652068 6f6f6420 74686520 736e6170 he hood the snap │ │ │ │ - 0x00fd3540 6c657420 696e6672 61737472 75637475 let infrastructu │ │ │ │ - 0x00fd3550 7265206d 65726765 7320616c 6c207468 re merges all th │ │ │ │ - 0x00fd3560 6520726f 75746573 2066726f 6d0a616c e routes from.al │ │ │ │ - 0x00fd3570 6c20736e 61706c65 74732c20 70726570 l snaplets, prep │ │ │ │ - 0x00fd3580 656e6473 20707265 66697865 73206672 ends prefixes fr │ │ │ │ - 0x00fd3590 6f6d2060 6e657374 536e6170 6c657460 om `nestSnaplet` │ │ │ │ - 0x00fd35a0 2063616c 6c732c20 616e6420 70617373 calls, and pass │ │ │ │ - 0x00fd35b0 65732074 6865206c 6973740a 746f2053 es the list.to S │ │ │ │ - 0x00fd35c0 6e617027 730a5b72 6f757465 5d286874 nap's.[route](ht │ │ │ │ - 0x00fd35d0 74703a2f 2f686163 6b616765 2e686173 tp://hackage.has │ │ │ │ - 0x00fd35e0 6b656c6c 2e6f7267 2f706163 6b616765 kell.org/package │ │ │ │ - 0x00fd35f0 732f6172 63686976 652f736e 61702d63 s/archive/snap-c │ │ │ │ - 0x00fd3600 6f72652f 302e352e 312e342f 646f632f ore/0.5.1.4/doc/ │ │ │ │ - 0x00fd3610 68746d6c 2f536e61 702d5479 7065732e html/Snap-Types. │ │ │ │ - 0x00fd3620 68746d6c 23763a72 6f757465 290a6675 html#v:route).fu │ │ │ │ - 0x00fd3630 6e637469 6f6e2e0a 0a412072 6f757465 nction...A route │ │ │ │ - 0x00fd3640 20697320 61207475 706c6520 6f662061 is a tuple of a │ │ │ │ - 0x00fd3650 2055524c 20616e64 20612068 616e646c URL and a handl │ │ │ │ - 0x00fd3660 65722066 756e6374 696f6e20 74686174 er function that │ │ │ │ - 0x00fd3670 2077696c 6c206265 2063616c 6c656420 will be called │ │ │ │ - 0x00fd3680 7768656e 0a746865 2055524c 20697320 when.the URL is │ │ │ │ - 0x00fd3690 72657175 65737465 642e2020 48616e64 requested. Hand │ │ │ │ - 0x00fd36a0 6c657220 69732061 20777261 70706572 ler is a wrapper │ │ │ │ - 0x00fd36b0 2061726f 756e6420 74686520 536e6170 around the Snap │ │ │ │ - 0x00fd36c0 206d6f6e 61642074 68617420 68616e64 monad that hand │ │ │ │ - 0x00fd36d0 6c65730a 74686520 736e6170 6c657427 les.the snaplet' │ │ │ │ - 0x00fd36e0 7320696e 66726173 74727563 74757265 s infrastructure │ │ │ │ - 0x00fd36f0 2e202044 7572696e 6720696e 69746961 . During initia │ │ │ │ - 0x00fd3700 6c697a61 74696f6e 2c20736e 61706c65 lization, snaple │ │ │ │ - 0x00fd3710 74732075 73652074 68650a60 496e6974 ts use the.`Init │ │ │ │ - 0x00fd3720 69616c69 7a657260 206d6f6e 61642e20 ializer` monad. │ │ │ │ - 0x00fd3730 20447572 696e6720 72756e74 696d652c During runtime, │ │ │ │ - 0x00fd3740 20746865 79207573 65207468 65206048 they use the `H │ │ │ │ - 0x00fd3750 616e646c 65726020 6d6f6e61 642e2020 andler` monad. │ │ │ │ - 0x00fd3760 5765276c 6c0a6469 73637573 73206048 We'll.discuss `H │ │ │ │ - 0x00fd3770 616e646c 65726020 696e206d 6f726520 andler` in more │ │ │ │ - 0x00fd3780 64657461 696c206c 61746572 2e202049 detail later. I │ │ │ │ - 0x00fd3790 6620796f 75277265 2066616d 696c6961 f you're familia │ │ │ │ - 0x00fd37a0 72207769 74682053 6e617027 73206f6c r with Snap's ol │ │ │ │ - 0x00fd37b0 640a6578 74656e73 696f6e20 73797374 d.extension syst │ │ │ │ - 0x00fd37c0 656d2c20 796f7520 63616e20 7468696e em, you can thin │ │ │ │ - 0x00fd37d0 6b206f66 20697420 61732072 6f756768 k of it as rough │ │ │ │ - 0x00fd37e0 6c792065 71756976 616c656e 7420746f ly equivalent to │ │ │ │ - 0x00fd37f0 20746865 20417070 6c696361 74696f6e the Application │ │ │ │ - 0x00fd3800 0a6d6f6e 61642e20 20497420 68617320 .monad. It has │ │ │ │ - 0x00fd3810 6120604d 6f6e6164 53746174 65602069 a `MonadState` i │ │ │ │ - 0x00fd3820 6e737461 6e636520 74686174 206c6574 nstance that let │ │ │ │ - 0x00fd3830 7320796f 75206163 63657373 20616e64 s you access and │ │ │ │ - 0x00fd3840 206d6f64 69667920 7468650a 63757272 modify the.curr │ │ │ │ - 0x00fd3850 656e7420 736e6170 6c657427 73207374 ent snaplet's st │ │ │ │ - 0x00fd3860 6174652c 20616e64 20612060 4d6f6e61 ate, and a `Mona │ │ │ │ - 0x00fd3870 64536e61 70602069 6e737461 6e636520 dSnap` instance │ │ │ │ - 0x00fd3880 70726f76 6964696e 67207468 650a7265 providing the.re │ │ │ │ - 0x00fd3890 71756573 742d7072 6f636573 73696e67 quest-processing │ │ │ │ - 0x00fd38a0 2066756e 6374696f 6e732064 6566696e functions defin │ │ │ │ - 0x00fd38b0 65642069 6e20536e 61702e54 79706573 ed in Snap.Types │ │ │ │ - 0x00fd38c0 2e0a0a77 72617053 6974650a 2d2d2d2d ...wrapSite.---- │ │ │ │ - 0x00fd38d0 2d2d2d2d 2d2d2d2d 0a0a6077 72617053 --------..`wrapS │ │ │ │ - 0x00fd38e0 69746560 20616c6c 6f777320 796f7520 ite` allows you │ │ │ │ - 0x00fd38f0 746f2061 70706c79 20616e20 61726269 to apply an arbi │ │ │ │ - 0x00fd3900 74726172 79206048 616e646c 65726020 trary `Handler` │ │ │ │ - 0x00fd3910 7472616e 73666f72 6d617469 6f6e2074 transformation t │ │ │ │ - 0x00fd3920 6f0a7468 6520746f 702d6c65 76656c20 o.the top-level │ │ │ │ - 0x00fd3930 68616e64 6c65722e 20205468 69732069 handler. This i │ │ │ │ - 0x00fd3940 73207573 6566756c 20696620 796f7520 s useful if you │ │ │ │ - 0x00fd3950 77616e74 20746f20 646f2073 6f6d6520 want to do some │ │ │ │ - 0x00fd3960 67656e65 7269630a 70726f63 65737369 generic.processi │ │ │ │ - 0x00fd3970 6e672061 74207468 65206265 67696e6e ng at the beginn │ │ │ │ - 0x00fd3980 696e6720 6f722065 6e64206f 66206576 ing or end of ev │ │ │ │ - 0x00fd3990 65727920 72657175 6573742e 2020466f ery request. Fo │ │ │ │ - 0x00fd39a0 7220696e 7374616e 63652c20 61207365 r instance, a se │ │ │ │ - 0x00fd39b0 7373696f 6e0a736e 61706c65 74206d69 ssion.snaplet mi │ │ │ │ - 0x00fd39c0 67687420 75736520 69742074 6f20746f ght use it to to │ │ │ │ - 0x00fd39d0 75636820 61207365 7373696f 6e206163 uch a session ac │ │ │ │ - 0x00fd39e0 74697669 74792074 6f6b656e 20626566 tivity token bef │ │ │ │ - 0x00fd39f0 6f726520 726f7574 696e6720 68617070 ore routing happ │ │ │ │ - 0x00fd3a00 656e732e 0a497420 636f756c 6420616c ens..It could al │ │ │ │ - 0x00fd3a10 736f2062 65207573 65642074 6f20696d so be used to im │ │ │ │ - 0x00fd3a20 706c656d 656e7420 63757374 6f6d206c plement custom l │ │ │ │ - 0x00fd3a30 6f676769 6e672e20 20546865 20657861 ogging. The exa │ │ │ │ - 0x00fd3a40 6d706c65 2061626f 76652075 73657320 mple above uses │ │ │ │ - 0x00fd3a50 69740a74 6f206465 66696e65 20686569 it.to define hei │ │ │ │ - 0x00fd3a60 73745365 72766520 2870726f 76696465 stServe (provide │ │ │ │ - 0x00fd3a70 64206279 20746865 20486569 73742073 d by the Heist s │ │ │ │ - 0x00fd3a80 6e61706c 65742920 61732074 68652064 naplet) as the d │ │ │ │ - 0x00fd3a90 65666175 6c742068 616e646c 65722074 efault handler t │ │ │ │ - 0x00fd3aa0 6f0a6265 20747269 65642069 66206e6f o.be tried if no │ │ │ │ - 0x00fd3ab0 206f7468 65722068 616e646c 6572206d other handler m │ │ │ │ - 0x00fd3ac0 61746368 65642e20 20546869 73206d61 atched. This ma │ │ │ │ - 0x00fd3ad0 79207365 656d206c 696b6520 616e2065 y seem like an e │ │ │ │ - 0x00fd3ae0 61737920 77617920 746f2064 6566696e asy way to defin │ │ │ │ - 0x00fd3af0 650a726f 75746573 2c206275 74206966 e.routes, but if │ │ │ │ - 0x00fd3b00 20796f75 20737472 696e6720 7468656d you string them │ │ │ │ - 0x00fd3b10 20616c6c 20746f67 65746865 7220696e all together in │ │ │ │ - 0x00fd3b20 20746869 73207761 79206561 63682068 this way each h │ │ │ │ - 0x00fd3b30 616e646c 65722077 696c6c20 62650a65 andler will be.e │ │ │ │ - 0x00fd3b40 76616c75 61746564 20736571 75656e74 valuated sequent │ │ │ │ - 0x00fd3b50 69616c6c 7920616e 6420796f 75276c6c ially and you'll │ │ │ │ - 0x00fd3b60 20676574 204f286e 29207469 6d652063 get O(n) time c │ │ │ │ - 0x00fd3b70 6f6d706c 65786974 792c2077 68657265 omplexity, where │ │ │ │ - 0x00fd3b80 61732072 6f757465 730a6465 66696e65 as routes.define │ │ │ │ - 0x00fd3b90 64207769 74682060 61646452 6f757465 d with `addRoute │ │ │ │ - 0x00fd3ba0 73602068 61766520 4f286c6f 67206e29 s` have O(log n) │ │ │ │ - 0x00fd3bb0 2074696d 6520636f 6d706c65 78697479 time complexity │ │ │ │ - 0x00fd3bc0 2e202054 68657265 666f7265 2c20696e . Therefore, in │ │ │ │ - 0x00fd3bd0 20610a72 65616c2d 776f726c 64206170 a.real-world ap │ │ │ │ - 0x00fd3be0 706c6963 6174696f 6e20796f 7520776f plication you wo │ │ │ │ - 0x00fd3bf0 756c6420 70726f62 61626c79 2077616e uld probably wan │ │ │ │ - 0x00fd3c00 7420746f 20686176 65206028 22222c20 t to have `("", │ │ │ │ - 0x00fd3c10 68656973 74536572 76652960 20696e0a heistServe)` in. │ │ │ │ - 0x00fd3c20 74686520 6c697374 20706173 73656420 the list passed │ │ │ │ - 0x00fd3c30 746f2060 61646452 6f757465 73602e0a to `addRoutes`.. │ │ │ │ - 0x00fd3c40 0a776974 680a2d2d 2d2d0a0a 54686520 .with.----..The │ │ │ │ - 0x00fd3c50 6c617374 20756e66 616d696c 69617220 last unfamiliar │ │ │ │ - 0x00fd3c60 66756e63 74696f6e 20696e20 74686520 function in the │ │ │ │ - 0x00fd3c70 6578616d 706c6520 69732060 77697468 example is `with │ │ │ │ - 0x00fd3c80 602e2020 48657265 20697420 6163636f `. Here it acco │ │ │ │ - 0x00fd3c90 6d70616e 69657320 610a6361 6c6c2074 mpanies a.call t │ │ │ │ - 0x00fd3ca0 6f207468 65206675 6e637469 6f6e2060 o the function ` │ │ │ │ - 0x00fd3cb0 6e616d65 50616765 602e2020 606e616d namePage`. `nam │ │ │ │ - 0x00fd3cc0 65506167 65602069 73206120 73696d70 ePage` is a simp │ │ │ │ - 0x00fd3cd0 6c652065 78616d70 6c652068 616e646c le example handl │ │ │ │ - 0x00fd3ce0 65722061 6e640a6c 6f6f6b73 206c696b er and.looks lik │ │ │ │ - 0x00fd3cf0 65207468 69732e0a 0a3e206e 616d6550 e this...> nameP │ │ │ │ - 0x00fd3d00 61676520 3a3a2048 616e646c 65722062 age :: Handler b │ │ │ │ - 0x00fd3d10 20762028 290a3e20 6e616d65 50616765 v ().> namePage │ │ │ │ - 0x00fd3d20 203d2064 6f0a3e20 20202020 6d6e616d = do.> mnam │ │ │ │ - 0x00fd3d30 65203c2d 20676574 536e6170 6c65744e e <- getSnapletN │ │ │ │ - 0x00fd3d40 616d650a 3e202020 20207772 69746554 ame.> writeT │ │ │ │ - 0x00fd3d50 65787420 24206672 6f6d4d61 79626520 ext $ fromMaybe │ │ │ │ - 0x00fd3d60 22546869 73207368 6f756c64 6e277420 "This shouldn't │ │ │ │ - 0x00fd3d70 68617070 656e2220 6d6e616d 650a0a54 happen" mname..T │ │ │ │ - 0x00fd3d80 68697320 66756e63 74696f6e 20697320 his function is │ │ │ │ - 0x00fd3d90 61206765 6e657269 63206861 6e646c65 a generic handle │ │ │ │ - 0x00fd3da0 72207468 61742067 65747320 74686520 r that gets the │ │ │ │ - 0x00fd3db0 6e616d65 206f6620 74686520 63757272 name of the curr │ │ │ │ - 0x00fd3dc0 656e7420 736e6170 6c65740a 616e6420 ent snaplet.and │ │ │ │ - 0x00fd3dd0 77726974 65732069 7420696e 746f2074 writes it into t │ │ │ │ - 0x00fd3de0 68652072 6573706f 6e736520 77697468 he response with │ │ │ │ - 0x00fd3df0 20746865 20607772 69746554 65787460 the `writeText` │ │ │ │ - 0x00fd3e00 2066756e 6374696f 6e206465 66696e65 function define │ │ │ │ - 0x00fd3e10 64206279 20746865 0a736e61 702d636f d by the.snap-co │ │ │ │ - 0x00fd3e20 72652070 726f6a65 63742e20 20546865 re project. The │ │ │ │ - 0x00fd3e30 20747970 65207661 72696162 6c657320 type variables │ │ │ │ - 0x00fd3e40 27622720 616e6420 27762720 696e6469 'b' and 'v' indi │ │ │ │ - 0x00fd3e50 63617465 20746861 74207468 69732066 cate that this f │ │ │ │ - 0x00fd3e60 756e6374 696f6e0a 77696c6c 20776f72 unction.will wor │ │ │ │ - 0x00fd3e70 6b20696e 20616e79 20736e61 706c6574 k in any snaplet │ │ │ │ - 0x00fd3e80 20776974 6820616e 79206261 73652061 with any base a │ │ │ │ - 0x00fd3e90 70706c69 63617469 6f6e2e20 20546865 pplication. The │ │ │ │ - 0x00fd3ea0 20277769 74682720 66756e63 74696f6e 'with' function │ │ │ │ - 0x00fd3eb0 2069730a 75736564 20746f20 72756e20 is.used to run │ │ │ │ - 0x00fd3ec0 606e616d 65506167 65602069 6e207468 `namePage` in th │ │ │ │ - 0x00fd3ed0 6520636f 6e746578 74206f66 20746865 e context of the │ │ │ │ - 0x00fd3ee0 20736e61 706c6574 7320666f 6f20616e snaplets foo an │ │ │ │ - 0x00fd3ef0 64206261 7220666f 72207468 650a636f d bar for the.co │ │ │ │ - 0x00fd3f00 72726573 706f6e64 696e6720 726f7574 rresponding rout │ │ │ │ - 0x00fd3f10 65732e0a 0a536974 65205265 6c6f6164 es...Site Reload │ │ │ │ - 0x00fd3f20 696e670a 2d2d2d2d 2d2d2d2d 2d2d2d2d ing.------------ │ │ │ │ - 0x00fd3f30 2d2d0a0a 536e6170 6c657420 496e6974 --..Snaplet Init │ │ │ │ - 0x00fd3f40 69616c69 7a657273 20736572 76652064 ializers serve d │ │ │ │ - 0x00fd3f50 75616c20 70757270 6f736520 61732062 ual purpose as b │ │ │ │ - 0x00fd3f60 6f746820 696e6974 69616c69 7a657273 oth initializers │ │ │ │ - 0x00fd3f70 20616e64 2072656c 6f616465 72732e0a and reloaders.. │ │ │ │ - 0x00fd3f80 52656c6f 61647320 61726520 74726967 Reloads are trig │ │ │ │ - 0x00fd3f90 67657265 64206279 20612073 70656369 gered by a speci │ │ │ │ - 0x00fd3fa0 616c2068 616e646c 65722074 68617420 al handler that │ │ │ │ - 0x00fd3fb0 69732062 6f756e64 20746f20 7468650a is bound to the. │ │ │ │ - 0x00fd3fc0 602f6164 6d696e2f 72656c6f 61646020 `/admin/reload` │ │ │ │ - 0x00fd3fd0 726f7574 652e2020 54686973 2068616e route. This han │ │ │ │ - 0x00fd3fe0 646c6572 2072652d 72756e73 20746865 dler re-runs the │ │ │ │ - 0x00fd3ff0 20736974 6520696e 69746961 6c697a65 site initialize │ │ │ │ - 0x00fd4000 7220616e 64206966 20697420 69730a73 r and if it is.s │ │ │ │ - 0x00fd4010 75636365 73736675 6c2c206c 6f616473 uccessful, loads │ │ │ │ - 0x00fd4020 20746865 206e6577 6c792067 656e6572 the newly gener │ │ │ │ - 0x00fd4030 61746564 20696e2d 6d656d6f 72792073 ated in-memory s │ │ │ │ - 0x00fd4040 74617465 2e202054 6f207072 6576656e tate. To preven │ │ │ │ - 0x00fd4050 74206465 6e69616c 206f660a 73657276 t denial of.serv │ │ │ │ - 0x00fd4060 69636520 61747461 636b732c 20746865 ice attacks, the │ │ │ │ - 0x00fd4070 2072656c 6f616420 726f7574 65206973 reload route is │ │ │ │ - 0x00fd4080 206f6e6c 79206163 63657373 69626c65 only accessible │ │ │ │ - 0x00fd4090 2066726f 6d206c6f 63616c68 6f73742e from localhost. │ │ │ │ - 0x00fd40a0 0a0a4966 20746865 72652061 72652061 ..If there are a │ │ │ │ - 0x00fd40b0 6e792065 72726f72 73206475 72696e67 ny errors during │ │ │ │ - 0x00fd40c0 2072656c 6f61642c 20796f75 20776f75 reload, you wou │ │ │ │ - 0x00fd40d0 6c64206e 61747572 616c6c79 2077616e ld naturally wan │ │ │ │ - 0x00fd40e0 7420746f 20736565 20746865 6d20696e t to see them in │ │ │ │ - 0x00fd40f0 0a746865 20485454 50207265 73706f6e .the HTTP respon │ │ │ │ - 0x00fd4100 73652072 65747572 6e656420 62792074 se returned by t │ │ │ │ - 0x00fd4110 68652073 65727665 722e2020 486f7765 he server. Howe │ │ │ │ - 0x00fd4120 7665722c 20776865 6e207468 65736520 ver, when these │ │ │ │ - 0x00fd4130 73616d65 0a696e69 7469616c 697a6572 same.initializer │ │ │ │ - 0x00fd4140 73206172 65207275 6e207768 656e2079 s are run when y │ │ │ │ - 0x00fd4150 6f752066 69727374 20737461 72742079 ou first start y │ │ │ │ - 0x00fd4160 6f757220 6170702c 20796f75 2077696c our app, you wil │ │ │ │ - 0x00fd4170 6c207761 6e742074 6f207365 650a7374 l want to see.st │ │ │ │ - 0x00fd4180 61747573 206d6573 73616765 73207072 atus messages pr │ │ │ │ - 0x00fd4190 696e7465 6420746f 20746865 20636f6e inted to the con │ │ │ │ - 0x00fd41a0 736f6c65 2e202054 6f206d61 6b652074 sole. To make t │ │ │ │ - 0x00fd41b0 68697320 706f7373 69626c65 20776520 his possible we │ │ │ │ - 0x00fd41c0 70726f76 69646520 7468650a 60707269 provide the.`pri │ │ │ │ - 0x00fd41d0 6e74496e 666f6020 66756e63 74696f6e ntInfo` function │ │ │ │ - 0x00fd41e0 2e202059 6f752073 686f756c 64207573 . You should us │ │ │ │ - 0x00fd41f0 65206974 20746f20 6f757470 75742061 e it to output a │ │ │ │ - 0x00fd4200 6e792069 6e666f72 6d617469 6f6e616c ny informational │ │ │ │ - 0x00fd4210 206d6573 73616765 730a6765 6e657261 messages.genera │ │ │ │ - 0x00fd4220 74656420 62792079 6f757220 696e6974 ted by your init │ │ │ │ - 0x00fd4230 69616c69 7a657273 2e202049 6620796f ializers. If yo │ │ │ │ - 0x00fd4240 75207072 696e7420 64697265 63746c79 u print directly │ │ │ │ - 0x00fd4250 20746f20 7374616e 64617264 206f7574 to standard out │ │ │ │ - 0x00fd4260 70757420 6f720a73 74616e64 61726420 put or.standard │ │ │ │ - 0x00fd4270 6572726f 722c2074 68656e20 74686f73 error, then thos │ │ │ │ - 0x00fd4280 65206d65 73736167 65732077 696c6c20 e messages will │ │ │ │ - 0x00fd4290 6e6f7420 62652061 7661696c 61626c65 not be available │ │ │ │ - 0x00fd42a0 20696e20 796f7572 2062726f 77736572 in your browser │ │ │ │ - 0x00fd42b0 20776865 6e0a796f 75207265 6c6f6164 when.you reload │ │ │ │ - 0x00fd42c0 20746865 20736974 652e0a0a 576f726b the site...Work │ │ │ │ - 0x00fd42d0 696e6720 77697468 20737461 74650a2d ing with state.- │ │ │ │ - 0x00fd42e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd42f0 2d0a0a60 48616e64 6c657220 62207660 -..`Handler b v` │ │ │ │ - 0x00fd4300 20686173 20612060 4d6f6e61 64537461 has a `MonadSta │ │ │ │ - 0x00fd4310 74652076 6020696e 7374616e 63652e20 te v` instance. │ │ │ │ - 0x00fd4320 20546869 73206d65 616e7320 74686174 This means that │ │ │ │ - 0x00fd4330 20796f75 2063616e 20616363 6573730a you can access. │ │ │ │ - 0x00fd4340 616c6c20 796f7572 20736e61 706c6574 all your snaplet │ │ │ │ - 0x00fd4350 20737461 74652074 68726f75 67682074 state through t │ │ │ │ - 0x00fd4360 68652067 65742c20 7075742c 20676574 he get, put, get │ │ │ │ - 0x00fd4370 732c2061 6e64206d 6f646966 79206675 s, and modify fu │ │ │ │ - 0x00fd4380 6e637469 6f6e7320 74686174 0a617265 nctions that.are │ │ │ │ - 0x00fd4390 2070726f 6261626c 79206661 6d696c69 probably famili │ │ │ │ - 0x00fd43a0 61722066 726f6d20 74686520 73746174 ar from the stat │ │ │ │ - 0x00fd43b0 65206d6f 6e61642e 2020496e 206f7572 e monad. In our │ │ │ │ - 0x00fd43c0 20657861 6d706c65 20617070 6c696361 example applica │ │ │ │ - 0x00fd43d0 74696f6e 2077650a 64656d6f 6e737472 tion we.demonstr │ │ │ │ - 0x00fd43e0 61746520 74686973 20776974 68206063 ate this with `c │ │ │ │ - 0x00fd43f0 6f6d7061 6e794861 6e646c65 72602e0a ompanyHandler`.. │ │ │ │ - 0x00fd4400 0a3e2063 6f6d7061 6e794861 6e646c65 .> companyHandle │ │ │ │ - 0x00fd4410 72203a3a 2048616e 646c6572 20417070 r :: Handler App │ │ │ │ - 0x00fd4420 20417070 2028290a 3e20636f 6d70616e App ().> compan │ │ │ │ - 0x00fd4430 7948616e 646c6572 203d206d 6574686f yHandler = metho │ │ │ │ - 0x00fd4440 64204745 54206765 74746572 203c7c3e d GET getter <|> │ │ │ │ - 0x00fd4450 206d6574 686f6420 504f5354 20736574 method POST set │ │ │ │ - 0x00fd4460 7465720a 3e202020 77686572 650a3e20 ter.> where.> │ │ │ │ - 0x00fd4470 20202020 67657474 6572203d 20646f0a getter = do. │ │ │ │ - 0x00fd4480 3e202020 20202020 20206e61 6d655265 > nameRe │ │ │ │ - 0x00fd4490 66203c2d 20676574 73205f63 6f6d7061 f <- gets _compa │ │ │ │ - 0x00fd44a0 6e794e61 6d650a3e 20202020 20202020 nyName.> │ │ │ │ - 0x00fd44b0 206e616d 65203c2d 206c6966 74494f20 name <- liftIO │ │ │ │ - 0x00fd44c0 24207265 6164494f 52656620 6e616d65 $ readIORef name │ │ │ │ - 0x00fd44d0 5265660a 3e202020 20202020 20207772 Ref.> wr │ │ │ │ - 0x00fd44e0 69746542 53206e61 6d650a3e 20202020 iteBS name.> │ │ │ │ - 0x00fd44f0 20736574 74657220 3d20646f 0a3e2020 setter = do.> │ │ │ │ - 0x00fd4500 20202020 2020206d 6e616d65 203c2d20 mname <- │ │ │ │ - 0x00fd4510 67657450 6172616d 20226e61 6d65220a getParam "name". │ │ │ │ - 0x00fd4520 3e202020 20202020 20206e61 6d655265 > nameRe │ │ │ │ - 0x00fd4530 66203c2d 20676574 73205f63 6f6d7061 f <- gets _compa │ │ │ │ - 0x00fd4540 6e794e61 6d650a3e 20202020 20202020 nyName.> │ │ │ │ - 0x00fd4550 206c6966 74494f20 24206d61 79626520 liftIO $ maybe │ │ │ │ - 0x00fd4560 28726574 75726e20 28292920 28777269 (return ()) (wri │ │ │ │ - 0x00fd4570 7465494f 52656620 6e616d65 52656629 teIORef nameRef) │ │ │ │ - 0x00fd4580 206d6e61 6d650a3e 20202020 20202020 mname.> │ │ │ │ - 0x00fd4590 20676574 7465720a 0a496620 796f7520 getter..If you │ │ │ │ - 0x00fd45a0 73657420 61204745 54207265 71756573 set a GET reques │ │ │ │ - 0x00fd45b0 7420746f 20602f63 6f6d7061 6e79602c t to `/company`, │ │ │ │ - 0x00fd45c0 20796f75 276c6c20 67657420 74686520 you'll get the │ │ │ │ - 0x00fd45d0 73747269 6e672022 666f6f43 6f727022 string "fooCorp" │ │ │ │ - 0x00fd45e0 20626163 6b2e0a49 6620796f 75207365 back..If you se │ │ │ │ - 0x00fd45f0 6e642061 20504f53 54207265 71756573 nd a POST reques │ │ │ │ - 0x00fd4600 742c2069 74207769 6c6c2073 65742074 t, it will set t │ │ │ │ - 0x00fd4610 68652049 4f526566 2068656c 6420696e he IORef held in │ │ │ │ - 0x00fd4620 20746865 20605f63 6f6d7061 6e794e61 the `_companyNa │ │ │ │ - 0x00fd4630 6d65600a 6669656c 6420696e 20746865 me`.field in the │ │ │ │ - 0x00fd4640 20604170 70602064 61746120 73747275 `App` data stru │ │ │ │ - 0x00fd4650 63747572 6520746f 20746865 2076616c cture to the val │ │ │ │ - 0x00fd4660 7565206f 66207468 6520606e 616d6560 ue of the `name` │ │ │ │ - 0x00fd4670 20666965 6c642e20 20546865 6e206974 field. Then it │ │ │ │ - 0x00fd4680 0a63616c 6c732074 68652067 65747465 .calls the gette │ │ │ │ - 0x00fd4690 7220746f 20726574 75726e20 74686174 r to return that │ │ │ │ - 0x00fd46a0 2076616c 75652062 61636b20 746f2079 value back to y │ │ │ │ - 0x00fd46b0 6f752073 6f20796f 75206361 6e207365 ou so you can se │ │ │ │ - 0x00fd46c0 65206974 20776173 0a616374 75616c6c e it was.actuall │ │ │ │ - 0x00fd46d0 79206368 616e6765 642e2020 41676169 y changed. Agai │ │ │ │ - 0x00fd46e0 6e2c2072 656d656d 62657220 74686174 n, remember that │ │ │ │ - 0x00fd46f0 20746869 73206368 616e6765 206f6e6c this change onl │ │ │ │ - 0x00fd4700 79207065 72736973 74732061 63726f73 y persists acros │ │ │ │ - 0x00fd4710 730a7265 71756573 74732062 65636175 s.requests becau │ │ │ │ - 0x00fd4720 73652077 65207573 65642061 6e20494f se we used an IO │ │ │ │ - 0x00fd4730 5265662e 20204966 20605f63 6f6d7061 Ref. If `_compa │ │ │ │ - 0x00fd4740 6e794e61 6d656020 77617320 6a757374 nyName` was just │ │ │ │ - 0x00fd4750 20612070 6c61696e 20737472 696e670a a plain string. │ │ │ │ - 0x00fd4760 616e6420 77652068 61642075 73656420 and we had used │ │ │ │ - 0x00fd4770 6d6f6469 66792c20 74686520 6368616e modify, the chan │ │ │ │ - 0x00fd4780 67656420 72657375 6c742077 6f756c64 ged result would │ │ │ │ - 0x00fd4790 206f6e6c 79206265 20766973 69626c65 only be visible │ │ │ │ - 0x00fd47a0 20696e20 74686520 72657374 0a6f6620 in the rest.of │ │ │ │ - 0x00fd47b0 74686520 70726f63 65737369 6e672066 the processing f │ │ │ │ - 0x00fd47c0 6f722074 68617420 72657175 6573742e or that request. │ │ │ │ - 0x00fd47d0 0a0a5468 65204865 69737420 536e6170 ..The Heist Snap │ │ │ │ - 0x00fd47e0 6c65740a 3d3d3d3d 3d3d3d3d 3d3d3d3d let.============ │ │ │ │ - 0x00fd47f0 3d3d3d3d 3d0a0a54 68652061 73747574 =====..The astut │ │ │ │ - 0x00fd4800 65207265 61646572 206d6967 68742061 e reader might a │ │ │ │ - 0x00fd4810 736b2077 68792074 68657265 20697320 sk why there is │ │ │ │ - 0x00fd4820 6e6f2060 77697468 20686569 73746020 no `with heist` │ │ │ │ - 0x00fd4830 696e2066 726f6e74 206f6620 74686520 in front of the │ │ │ │ - 0x00fd4840 63616c6c 0a746f20 60686569 73745365 call.to `heistSe │ │ │ │ - 0x00fd4850 72766560 2e202041 6e642069 6e646565 rve`. And indee │ │ │ │ - 0x00fd4860 642c2074 68617420 776f756c 64206e6f d, that would no │ │ │ │ - 0x00fd4870 726d616c 6c792062 65207468 65206361 rmally be the ca │ │ │ │ - 0x00fd4880 73652e20 20427574 20776520 64656369 se. But we deci │ │ │ │ - 0x00fd4890 6465640a 74686174 20616e20 6170706c ded.that an appl │ │ │ │ - 0x00fd48a0 69636174 696f6e20 77696c6c 206e6576 ication will nev │ │ │ │ - 0x00fd48b0 6572206e 65656420 6d6f7265 20746861 er need more tha │ │ │ │ - 0x00fd48c0 6e206f6e 6520696e 7374616e 6365206f n one instance o │ │ │ │ - 0x00fd48d0 66206120 48656973 7420736e 61706c65 f a Heist snaple │ │ │ │ - 0x00fd48e0 742e0a53 6f207765 2070726f 76696465 t..So we provide │ │ │ │ - 0x00fd48f0 64206120 74797065 20636c61 73732063 d a type class c │ │ │ │ - 0x00fd4900 616c6c65 64206048 61734865 69737460 alled `HasHeist` │ │ │ │ - 0x00fd4910 20746861 7420616c 6c6f7773 20616e20 that allows an │ │ │ │ - 0x00fd4920 6170706c 69636174 696f6e20 746f0a64 application to.d │ │ │ │ - 0x00fd4930 6566696e 65207468 6520676c 6f62616c efine the global │ │ │ │ - 0x00fd4940 20726566 6572656e 63652074 6f206974 reference to it │ │ │ │ - 0x00fd4950 73204865 69737420 736e6170 6c657420 s Heist snaplet │ │ │ │ - 0x00fd4960 62792077 72697469 6e672061 20604861 by writing a `Ha │ │ │ │ - 0x00fd4970 73486569 7374600a 696e7374 616e6365 sHeist`.instance │ │ │ │ - 0x00fd4980 2e202049 6e207468 69732065 78616d70 . In this examp │ │ │ │ - 0x00fd4990 6c652077 65206465 66696e65 20746865 le we define the │ │ │ │ - 0x00fd49a0 20696e73 74616e63 65206173 20666f6c instance as fol │ │ │ │ - 0x00fd49b0 6c6f7773 3a0a0a3e 20696e73 74616e63 lows:..> instanc │ │ │ │ - 0x00fd49c0 65204861 73486569 73742041 70702077 e HasHeist App w │ │ │ │ - 0x00fd49d0 68657265 20686569 73744c65 6e73203d here heistLens = │ │ │ │ - 0x00fd49e0 20737562 536e6170 6c657420 68656973 subSnaplet heis │ │ │ │ - 0x00fd49f0 740a0a4e 6f772061 6c6c2077 65206e65 t..Now all we ne │ │ │ │ - 0x00fd4a00 65642069 73206120 73696d70 6c65206d ed is a simple m │ │ │ │ - 0x00fd4a10 61696e20 66756e63 74696f6e 20746f20 ain function to │ │ │ │ - 0x00fd4a20 73657276 65206f75 72206170 706c6963 serve our applic │ │ │ │ - 0x00fd4a30 6174696f 6e2e0a0a 3e206d61 696e203a ation...> main : │ │ │ │ - 0x00fd4a40 3a20494f 2028290a 3e206d61 696e203d : IO ().> main = │ │ │ │ - 0x00fd4a50 20736572 7665536e 61706c65 74206465 serveSnaplet de │ │ │ │ - 0x00fd4a60 6661756c 74436f6e 66696720 61707049 faultConfig appI │ │ │ │ - 0x00fd4a70 6e69740a 0a546869 7320636f 6d706c65 nit..This comple │ │ │ │ - 0x00fd4a80 74657320 61206675 6c6c2077 6f726b69 tes a full worki │ │ │ │ - 0x00fd4a90 6e672061 70706c69 63617469 6f6e2e20 ng application. │ │ │ │ - 0x00fd4aa0 20576520 64696420 6c656176 65206f75 We did leave ou │ │ │ │ - 0x00fd4ab0 74206120 6c697474 6c652064 756d6d79 t a little dummy │ │ │ │ - 0x00fd4ac0 0a636f64 6520666f 72207468 6520466f .code for the Fo │ │ │ │ - 0x00fd4ad0 6f20616e 64204261 7220736e 61706c65 o and Bar snaple │ │ │ │ - 0x00fd4ae0 74732e20 20546869 7320636f 64652069 ts. This code i │ │ │ │ - 0x00fd4af0 7320696e 636c7564 65642069 6e205061 s included in Pa │ │ │ │ - 0x00fd4b00 7274322e 68732e20 20466f72 0a6d6f72 rt2.hs. For.mor │ │ │ │ - 0x00fd4b10 6520696e 666f726d 6174696f 6e206c6f e information lo │ │ │ │ - 0x00fd4b20 6f6b2069 6e206f75 72205b41 50490a64 ok in our [API.d │ │ │ │ - 0x00fd4b30 6f63756d 656e7461 74696f6e 5d286874 ocumentation](ht │ │ │ │ - 0x00fd4b40 74703a2f 2f686163 6b616765 2e686173 tp://hackage.has │ │ │ │ - 0x00fd4b50 6b656c6c 2e6f7267 2f706163 6b616765 kell.org/package │ │ │ │ - 0x00fd4b60 2f736e61 70292c20 73706563 69666963 /snap), specific │ │ │ │ - 0x00fd4b70 616c6c79 20746865 0a536e61 702e536e ally the.Snap.Sn │ │ │ │ - 0x00fd4b80 61706c65 74206d6f 64756c65 2e20204e aplet module. N │ │ │ │ - 0x00fd4b90 6f207265 616c6c79 2c207468 61742077 o really, that w │ │ │ │ - 0x00fd4ba0 61736e27 74206120 6a6f6b65 2e202054 asn't a joke. T │ │ │ │ - 0x00fd4bb0 68652041 50492064 6f637320 61726520 he API docs are │ │ │ │ - 0x00fd4bc0 77726974 74656e0a 61732070 726f7365 written.as prose │ │ │ │ - 0x00fd4bd0 2e202054 68657920 73686f75 6c642062 . They should b │ │ │ │ - 0x00fd4be0 65207665 72792065 61737920 746f2072 e very easy to r │ │ │ │ - 0x00fd4bf0 6561642c 20776869 6c652068 6176696e ead, while havin │ │ │ │ - 0x00fd4c00 67207468 65206265 6e656669 74206f66 g the benefit of │ │ │ │ - 0x00fd4c10 0a696e63 6c756469 6e672061 6c6c2074 .including all t │ │ │ │ - 0x00fd4c20 68652061 63747561 6c207479 70652073 he actual type s │ │ │ │ - 0x00fd4c30 69676e61 74757265 732e0a0a 46696c65 ignatures...File │ │ │ │ - 0x00fd4c40 73797374 656d2044 61746120 616e6420 system Data and │ │ │ │ - 0x00fd4c50 4175746f 6d617469 6320496e 7374616c Automatic Instal │ │ │ │ - 0x00fd4c60 6c617469 6f6e0a3d 3d3d3d3d 3d3d3d3d lation.========= │ │ │ │ - 0x00fd4c70 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================ │ │ │ │ - 0x00fd4c80 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================ │ │ │ │ - 0x00fd4c90 3d0a0a53 6f6d6520 736e6170 6c657473 =..Some snaplets │ │ │ │ - 0x00fd4ca0 2077696c 6c206861 76652064 61746120 will have data │ │ │ │ - 0x00fd4cb0 73746f72 65642069 6e207468 65206669 stored in the fi │ │ │ │ - 0x00fd4cc0 6c657379 7374656d 20746861 74207368 lesystem that sh │ │ │ │ - 0x00fd4cd0 6f756c64 20626520 696e7374 616c6c65 ould be installe │ │ │ │ - 0x00fd4ce0 640a696e 746f2074 68652064 69726563 d.into the direc │ │ │ │ - 0x00fd4cf0 746f7279 206f6620 616e7920 70726f6a tory of any proj │ │ │ │ - 0x00fd4d00 65637420 74686174 20757365 73206974 ect that uses it │ │ │ │ - 0x00fd4d10 2e202048 65726527 7320616e 20657861 . Here's an exa │ │ │ │ - 0x00fd4d20 6d706c65 206f6620 77686174 20610a73 mple of what a.s │ │ │ │ - 0x00fd4d30 6e61706c 65742066 696c6573 79737465 naplet filesyste │ │ │ │ - 0x00fd4d40 6d206c61 796f7574 206d6967 6874206c m layout might l │ │ │ │ - 0x00fd4d50 6f6f6b20 6c696b65 3a0a0a20 20202066 ook like:.. f │ │ │ │ - 0x00fd4d60 6f6f736e 61706c65 742f0a20 20202020 oosnaplet/. │ │ │ │ - 0x00fd4d70 207c2d2d 202a6465 76656c2e 6366672a |-- *devel.cfg* │ │ │ │ - 0x00fd4d80 0a202020 2020207c 2d2d2064 622e6366 . |-- db.cf │ │ │ │ - 0x00fd4d90 670a2020 20202020 7c2d2d20 7075626c g. |-- publ │ │ │ │ - 0x00fd4da0 69632f0a 20202020 20202020 20207c2d ic/. |- │ │ │ │ - 0x00fd4db0 2d207374 796c6573 68656574 732f0a20 - stylesheets/. │ │ │ │ - 0x00fd4dc0 20202020 20202020 207c2d2d 20696d61 |-- ima │ │ │ │ - 0x00fd4dd0 6765732f 0a202020 20202020 2020207c ges/. | │ │ │ │ - 0x00fd4de0 2d2d206a 732f0a20 20202020 207c2d2d -- js/. |-- │ │ │ │ - 0x00fd4df0 202a736e 61706c65 74732f2a 0a202020 *snaplets/*. │ │ │ │ - 0x00fd4e00 20202020 2020207c 2d2d202a 68656973 |-- *heis │ │ │ │ - 0x00fd4e10 742f2a0a 20202020 20202020 20202020 t/*. │ │ │ │ - 0x00fd4e20 20207c2d 2d207465 6d706c61 7465732f |-- templates/ │ │ │ │ - 0x00fd4e30 0a202020 20202020 2020207c 2d2d2073 . |-- s │ │ │ │ - 0x00fd4e40 7562736e 61706c65 74312f0a 20202020 ubsnaplet1/. │ │ │ │ - 0x00fd4e50 20202020 20207c2d 2d207375 62736e61 |-- subsna │ │ │ │ - 0x00fd4e60 706c6574 322f0a0a 4f6e6c79 20746865 plet2/..Only the │ │ │ │ - 0x00fd4e70 20737461 72726564 20697465 6d732061 starred items a │ │ │ │ - 0x00fd4e80 72652061 63747561 6c6c7920 656e666f re actually enfo │ │ │ │ - 0x00fd4e90 72636564 20627920 63757272 656e7420 rced by current │ │ │ │ - 0x00fd4ea0 636f6465 2c206275 74207765 2077616e code, but we wan │ │ │ │ - 0x00fd4eb0 7420746f 0a657374 61626c69 73682074 t to.establish t │ │ │ │ - 0x00fd4ec0 6865206f 74686572 73206173 20612063 he others as a c │ │ │ │ - 0x00fd4ed0 6f6e7665 6e74696f 6e2e2020 54686520 onvention. The │ │ │ │ - 0x00fd4ee0 66696c65 20646576 656c2e63 66672069 file devel.cfg i │ │ │ │ - 0x00fd4ef0 73206175 746f6d61 74696361 6c6c790a s automatically. │ │ │ │ - 0x00fd4f00 72656164 20627920 74686520 736e6170 read by the snap │ │ │ │ - 0x00fd4f10 6c657420 696e6672 61737472 75637475 let infrastructu │ │ │ │ - 0x00fd4f20 72652e20 20497420 69732061 7661696c re. It is avail │ │ │ │ - 0x00fd4f30 61626c65 20746f20 796f7520 76696120 able to you via │ │ │ │ - 0x00fd4f40 7468650a 60676574 536e6170 6c657455 the.`getSnapletU │ │ │ │ - 0x00fd4f50 73657243 6f6e6669 67602066 756e6374 serConfig` funct │ │ │ │ - 0x00fd4f60 696f6e2e 2020436f 6e666967 2066696c ion. Config fil │ │ │ │ - 0x00fd4f70 65732075 73652074 68652066 6f726d61 es use the forma │ │ │ │ - 0x00fd4f80 74206465 66696e65 64206279 20427279 t defined by Bry │ │ │ │ - 0x00fd4f90 616e0a4f 2753756c 6c697661 6e277320 an.O'Sullivan's │ │ │ │ - 0x00fd4fa0 65786365 6c6c656e 74205b63 6f6e6669 excellent [confi │ │ │ │ - 0x00fd4fb0 67757261 746f720a 7061636b 6167655d gurator.package] │ │ │ │ - 0x00fd4fc0 28687474 703a2f2f 6861636b 6167652e (http://hackage. │ │ │ │ - 0x00fd4fd0 6861736b 656c6c2e 6f72672f 7061636b haskell.org/pack │ │ │ │ - 0x00fd4fe0 6167652f 636f6e66 69677572 61746f72 age/configurator │ │ │ │ - 0x00fd4ff0 292e2020 496e2074 68697320 6578616d ). In this exam │ │ │ │ - 0x00fd5000 706c652c 0a746865 20757365 72206861 ple,.the user ha │ │ │ │ - 0x00fd5010 73206368 6f73656e 20746f20 70757420 s chosen to put │ │ │ │ - 0x00fd5020 64622063 6f6e6669 67206974 656d7320 db config items │ │ │ │ - 0x00fd5030 696e2061 20736570 61726174 65206669 in a separate fi │ │ │ │ - 0x00fd5040 6c652061 6e642075 73650a63 6f6e6669 le and use.confi │ │ │ │ - 0x00fd5050 67757261 746f7227 7320696d 706f7274 gurator's import │ │ │ │ - 0x00fd5060 2066756e 6374696f 6e616c69 74792074 functionality t │ │ │ │ - 0x00fd5070 6f20696e 636c7564 65206974 20696e20 o include it in │ │ │ │ - 0x00fd5080 64657665 6c2e6366 672e2020 49660a66 devel.cfg. If.f │ │ │ │ - 0x00fd5090 6f6f736e 61706c65 74207573 65732060 oosnaplet uses ` │ │ │ │ - 0x00fd50a0 6e657374 536e6170 6c657460 206f7220 nestSnaplet` or │ │ │ │ - 0x00fd50b0 60656d62 6564536e 61706c65 74602074 `embedSnaplet` t │ │ │ │ - 0x00fd50c0 6f20696e 636c7564 6520616e 79206f74 o include any ot │ │ │ │ - 0x00fd50d0 68657220 736e6170 6c657473 2c0a7468 her snaplets,.th │ │ │ │ - 0x00fd50e0 656e2066 696c6573 79737465 6d206461 en filesystem da │ │ │ │ - 0x00fd50f0 74612064 6566696e 65642062 79207468 ta defined by th │ │ │ │ - 0x00fd5100 6f736520 736e6170 6c657473 2077696c ose snaplets wil │ │ │ │ - 0x00fd5110 6c206265 20696e63 6c756465 6420696e l be included in │ │ │ │ - 0x00fd5120 0a737562 64697265 63746f72 69657320 .subdirectories │ │ │ │ - 0x00fd5130 756e6465 72207468 65206073 6e61706c under the `snapl │ │ │ │ - 0x00fd5140 6574732f 60206469 72656374 6f72792e ets/` directory. │ │ │ │ - 0x00fd5150 0a0a536f 20686f77 20646f20 796f7520 ..So how do you │ │ │ │ - 0x00fd5160 74656c6c 20746865 20736e61 706c6574 tell the snaplet │ │ │ │ - 0x00fd5170 20696e66 72617374 72756374 75726520 infrastructure │ │ │ │ - 0x00fd5180 74686174 20796f75 7220736e 61706c65 that your snaple │ │ │ │ - 0x00fd5190 74206861 73206669 6c657379 7374656d t has filesystem │ │ │ │ - 0x00fd51a0 0a646174 61207468 61742073 686f756c .data that shoul │ │ │ │ - 0x00fd51b0 64206265 20696e73 74616c6c 65643f20 d be installed? │ │ │ │ - 0x00fd51c0 204c6f6f 6b206174 20746865 20646566 Look at the def │ │ │ │ - 0x00fd51d0 696e6974 696f6e20 6f662061 7070496e inition of appIn │ │ │ │ - 0x00fd51e0 69742061 626f7665 2e202054 68650a74 it above. The.t │ │ │ │ - 0x00fd51f0 68697264 20617267 756d656e 7420746f hird argument to │ │ │ │ - 0x00fd5200 20746865 206d616b 65536e61 706c6574 the makeSnaplet │ │ │ │ - 0x00fd5210 2066756e 6374696f 6e206973 20776865 function is whe │ │ │ │ - 0x00fd5220 72652077 65207370 65636966 79207468 re we specify th │ │ │ │ - 0x00fd5230 65206669 6c657379 7374656d 0a646972 e filesystem.dir │ │ │ │ - 0x00fd5240 6563746f 72792074 68617420 73686f75 ectory that shou │ │ │ │ - 0x00fd5250 6c642062 6520696e 7374616c 6c65642e ld be installed. │ │ │ │ - 0x00fd5260 20205468 61742061 7267756d 656e7420 That argument │ │ │ │ - 0x00fd5270 68617320 74686520 74797065 20604d61 has the type `Ma │ │ │ │ - 0x00fd5280 79626520 28494f0a 46696c65 50617468 ybe (IO.FilePath │ │ │ │ - 0x00fd5290 29602e20 20496e20 74686973 20636173 )`. In this cas │ │ │ │ - 0x00fd52a0 65207765 20757365 6420604e 6f746869 e we used `Nothi │ │ │ │ - 0x00fd52b0 6e676020 62656361 75736520 6f757220 ng` because our │ │ │ │ - 0x00fd52c0 73696d70 6c652065 78616d70 6c652064 simple example d │ │ │ │ - 0x00fd52d0 6f65736e 27740a68 61766520 616e7920 oesn't.have any │ │ │ │ - 0x00fd52e0 66696c65 73797374 656d2064 6174612e filesystem data. │ │ │ │ - 0x00fd52f0 20204173 20616e20 6578616d 706c652c As an example, │ │ │ │ - 0x00fd5300 206c6574 27732073 61792079 6f752061 let's say you a │ │ │ │ - 0x00fd5310 72652063 72656174 696e6720 6120736e re creating a sn │ │ │ │ - 0x00fd5320 61706c65 740a6361 6c6c6564 206b696c aplet.called kil │ │ │ │ - 0x00fd5330 6c657261 70702074 68617420 77696c6c lerapp that will │ │ │ │ - 0x00fd5340 20626520 64697374 72696275 74656420 be distributed │ │ │ │ - 0x00fd5350 61732061 20686163 6b616765 2070726f as a hackage pro │ │ │ │ - 0x00fd5360 6a656374 2063616c 6c65640a 736e6170 ject called.snap │ │ │ │ - 0x00fd5370 6c65742d 6b696c6c 65726170 702e2020 let-killerapp. │ │ │ │ - 0x00fd5380 596f7572 2070726f 6a656374 20646972 Your project dir │ │ │ │ - 0x00fd5390 6563746f 72792073 74727563 74757265 ectory structure │ │ │ │ - 0x00fd53a0 2077696c 6c206c6f 6f6b2073 6f6d6574 will look somet │ │ │ │ - 0x00fd53b0 68696e67 206c696b 650a7468 69733a0a hing like.this:. │ │ │ │ - 0x00fd53c0 0a202020 20736e61 706c6574 2d6b696c . snaplet-kil │ │ │ │ - 0x00fd53d0 6c657261 70702f0a 20202020 20207c2d lerapp/. |- │ │ │ │ - 0x00fd53e0 2d207265 736f7572 6365732f 0a202020 - resources/. │ │ │ │ - 0x00fd53f0 2020207c 2d2d2073 6e61706c 65742d6b |-- snaplet-k │ │ │ │ - 0x00fd5400 696c6c65 72617070 2e636162 616c0a20 illerapp.cabal. │ │ │ │ - 0x00fd5410 20202020 207c2d2d 20737263 2f0a0a41 |-- src/..A │ │ │ │ - 0x00fd5420 6c6c206f 66207468 65206669 6c657320 ll of the files │ │ │ │ - 0x00fd5430 616e6420 64697265 63746f72 69657320 and directories │ │ │ │ - 0x00fd5440 6c697374 65642061 626f7665 20756e64 listed above und │ │ │ │ - 0x00fd5450 65722066 6f6f736e 61706c65 742f2077 er foosnaplet/ w │ │ │ │ - 0x00fd5460 696c6c20 62652069 6e0a7265 736f7572 ill be in.resour │ │ │ │ - 0x00fd5470 6365732f 2e202053 6f6d6577 68657265 ces/. Somewhere │ │ │ │ - 0x00fd5480 20696e20 74686520 636f6465 20796f75 in the code you │ │ │ │ - 0x00fd5490 2077696c 6c206465 66696e65 20616e20 will define an │ │ │ │ - 0x00fd54a0 696e6974 69616c69 7a657220 666f7220 initializer for │ │ │ │ - 0x00fd54b0 7468650a 736e6170 6c657420 74686174 the.snaplet that │ │ │ │ - 0x00fd54c0 2077696c 6c206c6f 6f6b206c 696b6520 will look like │ │ │ │ - 0x00fd54d0 74686973 3a0a0a20 2020206b 696c6c65 this:.. kille │ │ │ │ - 0x00fd54e0 72496e69 74203d20 6d616b65 536e6170 rInit = makeSnap │ │ │ │ - 0x00fd54f0 6c657420 226b696c 6c657261 70702220 let "killerapp" │ │ │ │ - 0x00fd5500 22343222 20284a75 73742064 61746144 "42" (Just dataD │ │ │ │ - 0x00fd5510 69722920 2420646f 0a0a5468 65207072 ir) $ do..The pr │ │ │ │ - 0x00fd5520 696d6172 79206675 6e637469 6f6e206f imary function o │ │ │ │ - 0x00fd5530 66204361 62616c20 69732074 6f20696e f Cabal is to in │ │ │ │ - 0x00fd5540 7374616c 6c20636f 64652e20 20427574 stall code. But │ │ │ │ - 0x00fd5550 20697420 68617320 74686520 6162696c it has the abil │ │ │ │ - 0x00fd5560 69747920 746f0a69 6e737461 6c6c2064 ity to.install d │ │ │ │ - 0x00fd5570 61746120 66696c65 7320616e 64207072 ata files and pr │ │ │ │ - 0x00fd5580 6f766964 65732061 2066756e 6374696f ovides a functio │ │ │ │ - 0x00fd5590 6e206361 6c6c6564 20606765 74446174 n called `getDat │ │ │ │ - 0x00fd55a0 61446972 6020666f 72207265 74726965 aDir` for retrie │ │ │ │ - 0x00fd55b0 76696e67 0a746865 206c6f63 6174696f ving.the locatio │ │ │ │ - 0x00fd55c0 6e206f66 20746865 73652066 696c6573 n of these files │ │ │ │ - 0x00fd55d0 2e202053 696e6365 20697420 72657475 . Since it retu │ │ │ │ - 0x00fd55e0 726e7320 61206469 66666572 656e7420 rns a different │ │ │ │ - 0x00fd55f0 72657375 6c742064 6570656e 64696e67 result depending │ │ │ │ - 0x00fd5600 206f6e0a 77686174 206d6163 68696e65 on.what machine │ │ │ │ - 0x00fd5610 20796f75 27726520 7573696e 672c2074 you're using, t │ │ │ │ - 0x00fd5620 68652074 68697264 20617267 756d656e he third argumen │ │ │ │ - 0x00fd5630 7420746f 20606d61 6b65536e 61706c65 t to `makeSnaple │ │ │ │ - 0x00fd5640 74602068 61732074 6f206265 20604d61 t` has to be `Ma │ │ │ │ - 0x00fd5650 7962650a 28494f20 46696c65 50617468 ybe.(IO FilePath │ │ │ │ - 0x00fd5660 29602069 6e737465 6164206f 66207468 )` instead of th │ │ │ │ - 0x00fd5670 65206d6f 7265206e 61747572 616c2070 e more natural p │ │ │ │ - 0x00fd5680 75726520 76657273 696f6e2e 2020546f ure version. To │ │ │ │ - 0x00fd5690 206d616b 65207468 696e6773 206d6f72 make things mor │ │ │ │ - 0x00fd56a0 650a6f72 67616e69 7a65642c 20776520 e.organized, we │ │ │ │ - 0x00fd56b0 75736520 74686520 636f6e76 656e7469 use the conventi │ │ │ │ - 0x00fd56c0 6f6e206f 66207075 7474696e 6720616c on of putting al │ │ │ │ - 0x00fd56d0 6c20796f 75722073 6e61706c 65742773 l your snaplet's │ │ │ │ - 0x00fd56e0 20646174 61206669 6c657320 696e2061 data files in a │ │ │ │ - 0x00fd56f0 0a737562 64697265 63746f72 79206361 .subdirectory ca │ │ │ │ - 0x00fd5700 6c6c6564 20726573 6f757263 65732e20 lled resources. │ │ │ │ - 0x00fd5710 20536f20 7765206e 65656420 746f2063 So we need to c │ │ │ │ - 0x00fd5720 72656174 65206120 736d616c 6c206675 reate a small fu │ │ │ │ - 0x00fd5730 6e637469 6f6e2074 6861740a 61707065 nction that.appe │ │ │ │ - 0x00fd5740 6e647320 602f7265 736f7572 63657360 nds `/resources` │ │ │ │ - 0x00fd5750 20746f20 74686520 72657375 6c74206f to the result o │ │ │ │ - 0x00fd5760 66206067 65744461 74614469 72602e0a f `getDataDir`.. │ │ │ │ - 0x00fd5770 0a202020 20696d70 6f727420 50617468 . import Path │ │ │ │ - 0x00fd5780 735f736e 61706c65 745f6b69 6c6c6572 s_snaplet_killer │ │ │ │ - 0x00fd5790 6170700a 20202020 64617461 44697220 app. dataDir │ │ │ │ - 0x00fd57a0 3d206c69 66744d20 282b2b22 2f726573 = liftM (++"/res │ │ │ │ - 0x00fd57b0 6f757263 65732229 20676574 44617461 ources") getData │ │ │ │ - 0x00fd57c0 4469720a 0a496620 6f757220 70726f6a Dir..If our proj │ │ │ │ - 0x00fd57d0 65637420 6973206e 616d6564 20736e61 ect is named sna │ │ │ │ - 0x00fd57e0 706c6574 2d6b696c 6c657261 70702c20 plet-killerapp, │ │ │ │ - 0x00fd57f0 74686520 60676574 44617461 44697260 the `getDataDir` │ │ │ │ - 0x00fd5800 2066756e 6374696f 6e206973 0a646566 function is.def │ │ │ │ - 0x00fd5810 696e6564 20696e20 74686520 6d6f6475 ined in the modu │ │ │ │ - 0x00fd5820 6c652050 61746873 5f736e61 706c6574 le Paths_snaplet │ │ │ │ - 0x00fd5830 5f6b696c 6c657261 70702c20 77686963 _killerapp, whic │ │ │ │ - 0x00fd5840 68207765 20686176 6520746f 20696d70 h we have to imp │ │ │ │ - 0x00fd5850 6f72742e 2020546f 0a6d616b 65206576 ort. To.make ev │ │ │ │ - 0x00fd5860 65727974 68696e67 20776f72 6b2c2079 erything work, y │ │ │ │ - 0x00fd5870 6f752068 61766520 746f2074 656c6c20 ou have to tell │ │ │ │ - 0x00fd5880 43616261 6c206162 6f757420 796f7572 Cabal about your │ │ │ │ - 0x00fd5890 20646174 61206669 6c657320 62790a69 data files by.i │ │ │ │ - 0x00fd58a0 6e636c75 64696e67 20612073 65637469 ncluding a secti │ │ │ │ - 0x00fd58b0 6f6e206c 696b6520 74686520 666f6c6c on like the foll │ │ │ │ - 0x00fd58c0 6f77696e 6720696e 20736e61 706c6574 owing in snaplet │ │ │ │ - 0x00fd58d0 2d6b696c 6c657261 70702e63 6162616c -killerapp.cabal │ │ │ │ - 0x00fd58e0 3a0a0a20 20202064 6174612d 66696c65 :.. data-file │ │ │ │ - 0x00fd58f0 733a0a20 20202020 20726573 6f757263 s:. resourc │ │ │ │ - 0x00fd5900 65732f64 6576656c 2e636667 2c0a2020 es/devel.cfg,. │ │ │ │ - 0x00fd5910 20202020 7265736f 75726365 732f7075 resources/pu │ │ │ │ - 0x00fd5920 626c6963 2f737479 6c657368 65657473 blic/stylesheets │ │ │ │ - 0x00fd5930 2f737479 6c652e63 73732c0a 20202020 /style.css,. │ │ │ │ - 0x00fd5940 20207265 736f7572 6365732f 736e6170 resources/snap │ │ │ │ - 0x00fd5950 6c657473 2f686569 73742f74 656d706c lets/heist/templ │ │ │ │ - 0x00fd5960 61746573 2f706167 652e7470 6c0a0a4e ates/page.tpl..N │ │ │ │ - 0x00fd5970 6f772077 68656e65 76657220 796f7572 ow whenever your │ │ │ │ - 0x00fd5980 20736e61 706c6574 20697320 75736564 snaplet is used │ │ │ │ - 0x00fd5990 2c206974 73206669 6c657379 7374656d , its filesystem │ │ │ │ - 0x00fd59a0 20646174 61207769 6c6c2062 65206175 data will be au │ │ │ │ - 0x00fd59b0 746f6d61 67696361 6c6c790a 636f7069 tomagically.copi │ │ │ │ - 0x00fd59c0 65642069 6e746f20 74686520 6c6f6361 ed into the loca │ │ │ │ - 0x00fd59d0 6c207072 6f6a6563 74207468 61742069 l project that i │ │ │ │ - 0x00fd59e0 73207573 696e6720 69742c20 7768656e s using it, when │ │ │ │ - 0x00fd59f0 65766572 20746865 20617070 6c696361 ever the applica │ │ │ │ - 0x00fd5a00 74696f6e 2069730a 72756e20 616e6420 tion is.run and │ │ │ │ - 0x00fd5a10 69742073 65657320 74686174 20746865 it sees that the │ │ │ │ - 0x00fd5a20 20736e61 706c6574 27732064 69726563 snaplet's direc │ │ │ │ - 0x00fd5a30 746f7279 20646f65 73206e6f 7420616c tory does not al │ │ │ │ - 0x00fd5a40 72656164 79206578 6973742e 20204966 ready exist. If │ │ │ │ - 0x00fd5a50 20746865 0a757365 72207570 67726164 the.user upgrad │ │ │ │ - 0x00fd5a60 65732074 6f206120 6e657720 76657273 es to a new vers │ │ │ │ - 0x00fd5a70 696f6e20 6f662074 68652073 6e61706c ion of the snapl │ │ │ │ - 0x00fd5a80 65742061 6e642074 6865206e 65772076 et and the new v │ │ │ │ - 0x00fd5a90 65727369 6f6e206d 61646520 6368616e ersion made chan │ │ │ │ - 0x00fd5aa0 6765730a 746f2074 68652066 696c6573 ges.to the files │ │ │ │ - 0x00fd5ab0 79737465 6d207265 736f7572 6365732c ystem resources, │ │ │ │ - 0x00fd5ac0 2074686f 73652072 65736f75 72636573 those resources │ │ │ │ - 0x00fd5ad0 2077696c 6c204e4f 54206265 20617574 will NOT be aut │ │ │ │ - 0x00fd5ae0 6f6d6174 6963616c 6c792063 6f706965 omatically copie │ │ │ │ - 0x00fd5af0 640a696e 20627920 64656661 756c742e d.in by default. │ │ │ │ - 0x00fd5b00 20205265 736f7572 63652069 6e737461 Resource insta │ │ │ │ - 0x00fd5b10 6c6c6174 696f6e20 2a6f6e6c 792a2068 llation *only* h │ │ │ │ - 0x00fd5b20 61707065 6e732077 68656e20 74686520 appens when the │ │ │ │ - 0x00fd5b30 60736e61 706c6574 732f666f 6f600a64 `snaplets/foo`.d │ │ │ │ - 0x00fd5b40 69726563 746f7279 20646f65 73206e6f irectory does no │ │ │ │ - 0x00fd5b50 74206578 6973742e 20204966 20796f75 t exist. If you │ │ │ │ - 0x00fd5b60 2077616e 7420746f 20676574 20746865 want to get the │ │ │ │ - 0x00fd5b70 206c6174 65737420 76657273 696f6e20 latest version │ │ │ │ - 0x00fd5b80 6f662074 68650a66 696c6573 79737465 of the.filesyste │ │ │ │ - 0x00fd5b90 6d207265 736f7572 6365732c 2072656d m resources, rem │ │ │ │ - 0x00fd5ba0 6f766520 74686520 60736e61 706c6574 ove the `snaplet │ │ │ │ - 0x00fd5bb0 732f666f 6f602064 69726563 746f7279 s/foo` directory │ │ │ │ - 0x00fd5bc0 2c20616e 64207265 73746172 7420796f , and restart yo │ │ │ │ - 0x00fd5bd0 75720a61 70702e0a 002e2f73 72632f54 ur.app..../src/T │ │ │ │ - 0x00fd5be0 75746f72 69616c2e 6c687300 4e616d65 utorial.lhs.Name │ │ │ │ - 0x00fd5bf0 3a202020 20202020 20202020 20202020 : │ │ │ │ - 0x00fd5c00 2070726f 6a6e616d 650a5665 7273696f projname.Versio │ │ │ │ - 0x00fd5c10 6e3a2020 20202020 20202020 20202030 n: 0 │ │ │ │ - 0x00fd5c20 2e310a53 796e6f70 7369733a 20202020 .1.Synopsis: │ │ │ │ - 0x00fd5c30 20202020 20202020 50726f6a 65637420 Project │ │ │ │ - 0x00fd5c40 53796e6f 70736973 20486572 650a4465 Synopsis Here.De │ │ │ │ - 0x00fd5c50 73637269 7074696f 6e3a2020 20202020 scription: │ │ │ │ - 0x00fd5c60 20202050 726f6a65 63742044 65736372 Project Descr │ │ │ │ - 0x00fd5c70 69707469 6f6e2048 6572650a 4c696365 iption Here.Lice │ │ │ │ - 0x00fd5c80 6e73653a 20202020 20202020 20202020 nse: │ │ │ │ - 0x00fd5c90 20416c6c 52696768 74735265 73657276 AllRightsReserv │ │ │ │ - 0x00fd5ca0 65640a41 7574686f 723a2020 20202020 ed.Author: │ │ │ │ - 0x00fd5cb0 20202020 20202020 41757468 6f720a4d Author.M │ │ │ │ - 0x00fd5cc0 61696e74 61696e65 723a2020 20202020 aintainer: │ │ │ │ - 0x00fd5cd0 20202020 6d61696e 7461696e 65724065 maintainer@e │ │ │ │ - 0x00fd5ce0 78616d70 6c652e63 6f6d0a53 74616269 xample.com.Stabi │ │ │ │ - 0x00fd5cf0 6c697479 3a202020 20202020 20202020 lity: │ │ │ │ - 0x00fd5d00 45787065 72696d65 6e74616c 0a436174 Experimental.Cat │ │ │ │ - 0x00fd5d10 65676f72 793a2020 20202020 20202020 egory: │ │ │ │ - 0x00fd5d20 20205765 620a4275 696c642d 74797065 Web.Build-type │ │ │ │ - 0x00fd5d30 3a202020 20202020 20202053 696d706c : Simpl │ │ │ │ - 0x00fd5d40 650a4361 62616c2d 76657273 696f6e3a e.Cabal-version: │ │ │ │ - 0x00fd5d50 20202020 2020203e 3d312e32 0a0a466c >=1.2..Fl │ │ │ │ - 0x00fd5d60 61672064 6576656c 6f706d65 6e740a20 ag development. │ │ │ │ - 0x00fd5d70 20446573 63726970 74696f6e 3a205768 Description: Wh │ │ │ │ - 0x00fd5d80 65746865 7220746f 20627569 6c642074 ether to build t │ │ │ │ - 0x00fd5d90 68652073 65727665 7220696e 20646576 he server in dev │ │ │ │ - 0x00fd5da0 656c6f70 6d656e74 2028696e 74657270 elopment (interp │ │ │ │ - 0x00fd5db0 72657465 6429206d 6f64650a 20204465 reted) mode. De │ │ │ │ - 0x00fd5dc0 6661756c 743a2046 616c7365 0a0a466c fault: False..Fl │ │ │ │ - 0x00fd5dd0 6167206f 6c642d62 6173650a 20206465 ag old-base. de │ │ │ │ - 0x00fd5de0 6661756c 743a2046 616c7365 0a20206d fault: False. m │ │ │ │ - 0x00fd5df0 616e7561 6c3a2046 616c7365 0a0a4578 anual: False..Ex │ │ │ │ - 0x00fd5e00 65637574 61626c65 2070726f 6a6e616d ecutable projnam │ │ │ │ - 0x00fd5e10 650a2020 68732d73 6f757263 652d6469 e. hs-source-di │ │ │ │ - 0x00fd5e20 72733a20 7372630a 20206d61 696e2d69 rs: src. main-i │ │ │ │ - 0x00fd5e30 733a204d 61696e2e 68730a0a 20204275 s: Main.hs.. Bu │ │ │ │ - 0x00fd5e40 696c642d 64657065 6e64733a 0a202020 ild-depends:. │ │ │ │ - 0x00fd5e50 20626173 65202020 20202020 20202020 base │ │ │ │ - 0x00fd5e60 20202020 20202020 2020203e 3d20342e >= 4. │ │ │ │ - 0x00fd5e70 34202020 20202626 203c2035 2c0a2020 4 && < 5,. │ │ │ │ - 0x00fd5e80 20206279 74657374 72696e67 20202020 bytestring │ │ │ │ - 0x00fd5e90 20202020 20202020 20202020 3e3d2030 >= 0 │ │ │ │ - 0x00fd5ea0 2e392e31 20202026 26203c20 302e3131 .9.1 && < 0.11 │ │ │ │ - 0x00fd5eb0 2c0a2020 20206865 69737420 20202020 ,. heist │ │ │ │ - 0x00fd5ec0 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd5ed0 3e3d2031 2e302020 20202026 26203c20 >= 1.0 && < │ │ │ │ - 0x00fd5ee0 312e322c 0a202020 206c656e 73202020 1.2,. lens │ │ │ │ - 0x00fd5ef0 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd5f00 2020203e 3d20332e 372e3620 20202626 >= 3.7.6 && │ │ │ │ - 0x00fd5f10 203c2034 2e31382c 0a202020 206d6170 < 4.18,. map │ │ │ │ - 0x00fd5f20 2d73796e 74617820 20202020 20202020 -syntax │ │ │ │ - 0x00fd5f30 20202020 2020203e 3d20302e 32202020 >= 0.2 │ │ │ │ - 0x00fd5f40 20202626 203c2030 2e342c0a 20202020 && < 0.4,. │ │ │ │ - 0x00fd5f50 6d6f6e61 642d636f 6e74726f 6c202020 monad-control │ │ │ │ - 0x00fd5f60 20202020 20202020 20203e3d 20312e30 >= 1.0 │ │ │ │ - 0x00fd5f70 20202020 20262620 3c20312e 312c0a20 && < 1.1,. │ │ │ │ - 0x00fd5f80 2020206d 746c2020 20202020 20202020 mtl │ │ │ │ - 0x00fd5f90 20202020 20202020 20202020 203e3d20 >= │ │ │ │ - 0x00fd5fa0 32202020 20202020 2626203c 20322e33 2 && < 2.3 │ │ │ │ - 0x00fd5fb0 2c0a2020 2020736e 61702020 20202020 ,. snap │ │ │ │ - 0x00fd5fc0 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd5fd0 3e3d2031 2e302020 20202026 26203c20 >= 1.0 && < │ │ │ │ - 0x00fd5fe0 312e322c 0a202020 20736e61 702d636f 1.2,. snap-co │ │ │ │ - 0x00fd5ff0 72652020 20202020 20202020 20202020 re │ │ │ │ - 0x00fd6000 2020203e 3d20312e 30202020 20202626 >= 1.0 && │ │ │ │ - 0x00fd6010 203c2031 2e312c0a 20202020 736e6170 < 1.1,. snap │ │ │ │ - 0x00fd6020 2d736572 76657220 20202020 20202020 -server │ │ │ │ - 0x00fd6030 20202020 20203e3d 20312e30 20202020 >= 1.0 │ │ │ │ - 0x00fd6040 20262620 3c20312e 322c0a20 20202073 && < 1.2,. s │ │ │ │ - 0x00fd6050 6e61702d 6c6f6164 65722d73 74617469 nap-loader-stati │ │ │ │ - 0x00fd6060 63202020 20202020 203e3d20 312e3020 c >= 1.0 │ │ │ │ - 0x00fd6070 20202020 2626203c 20312e31 2c0a2020 && < 1.1,. │ │ │ │ - 0x00fd6080 20207465 78742020 20202020 20202020 text │ │ │ │ - 0x00fd6090 20202020 20202020 20202020 3e3d2030 >= 0 │ │ │ │ - 0x00fd60a0 2e313120 20202026 26203c20 312e332c .11 && < 1.3, │ │ │ │ - 0x00fd60b0 0a202020 2074696d 65202020 20202020 . time │ │ │ │ - 0x00fd60c0 20202020 20202020 20202020 2020203e > │ │ │ │ - 0x00fd60d0 3d20312e 31202020 20202626 203c2031 = 1.1 && < 1 │ │ │ │ - 0x00fd60e0 2e392c0a 20202020 786d6c68 746d6c20 .9,. xmlhtml │ │ │ │ - 0x00fd60f0 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd6100 20203e3d 20302e31 20202020 20262620 >= 0.1 && │ │ │ │ - 0x00fd6110 3c20302e 330a0a20 20696620 666c6167 < 0.3.. if flag │ │ │ │ - 0x00fd6120 28646576 656c6f70 6d656e74 290a2020 (development). │ │ │ │ - 0x00fd6130 20206275 696c642d 64657065 6e64733a build-depends: │ │ │ │ - 0x00fd6140 0a202020 20202073 6e61702d 6c6f6164 . snap-load │ │ │ │ - 0x00fd6150 65722d64 796e616d 6963203e 3d20312e er-dynamic >= 1. │ │ │ │ - 0x00fd6160 30202626 203c2031 2e310a20 20202063 0 && < 1.1. c │ │ │ │ - 0x00fd6170 70702d6f 7074696f 6e733a20 2d444445 pp-options: -DDE │ │ │ │ - 0x00fd6180 56454c4f 504d454e 540a2020 20202d2d VELOPMENT. -- │ │ │ │ - 0x00fd6190 20496e20 64657665 6c6f706d 656e7420 In development │ │ │ │ - 0x00fd61a0 6d6f6465 2c207370 65656420 69732061 mode, speed is a │ │ │ │ - 0x00fd61b0 6c726561 64792067 6f696e67 20746f20 lready going to │ │ │ │ - 0x00fd61c0 73756666 65722c20 736f2073 6b69700a suffer, so skip. │ │ │ │ - 0x00fd61d0 20202020 2d2d2074 68652066 616e6379 -- the fancy │ │ │ │ - 0x00fd61e0 206f7074 696d697a 6174696f 6e20666c optimization fl │ │ │ │ - 0x00fd61f0 6167732e 20204164 64697469 6f6e616c ags. Additional │ │ │ │ - 0x00fd6200 6c792c20 64697361 626c6520 616c6c0a ly, disable all. │ │ │ │ - 0x00fd6210 20202020 2d2d2077 61726e69 6e67732e -- warnings. │ │ │ │ - 0x00fd6220 20205468 65206869 6e74206c 69627261 The hint libra │ │ │ │ - 0x00fd6230 72792064 6f65736e 27742067 69766520 ry doesn't give │ │ │ │ - 0x00fd6240 616e206f 7074696f 6e20746f 20657865 an option to exe │ │ │ │ - 0x00fd6250 63757465 0a202020 202d2d20 636f6d70 cute. -- comp │ │ │ │ - 0x00fd6260 696c6564 20636f64 65207768 656e2074 iled code when t │ │ │ │ - 0x00fd6270 68657265 20776572 6520616c 736f2077 here were also w │ │ │ │ - 0x00fd6280 61726e69 6e67732c 20736f20 64697361 arnings, so disa │ │ │ │ - 0x00fd6290 626c696e 670a2020 20202d2d 20776172 bling. -- war │ │ │ │ - 0x00fd62a0 6e696e67 7320616c 6c6f7773 20717569 nings allows qui │ │ │ │ - 0x00fd62b0 636b6572 20776f72 6b666c6f 772e0a20 cker workflow.. │ │ │ │ - 0x00fd62c0 20202067 68632d6f 7074696f 6e733a20 ghc-options: │ │ │ │ - 0x00fd62d0 2d746872 65616465 64202d77 0a202065 -threaded -w. e │ │ │ │ - 0x00fd62e0 6c73650a 20202020 69662069 6d706c28 lse. if impl( │ │ │ │ - 0x00fd62f0 67686320 3e3d2036 2e31322e 30290a20 ghc >= 6.12.0). │ │ │ │ - 0x00fd6300 20202020 20676863 2d6f7074 696f6e73 ghc-options │ │ │ │ - 0x00fd6310 3a202d74 68726561 64656420 2d57616c : -threaded -Wal │ │ │ │ - 0x00fd6320 6c202d66 7761726e 2d746162 73202d66 l -fwarn-tabs -f │ │ │ │ - 0x00fd6330 756e626f 782d7374 72696374 2d666965 unbox-strict-fie │ │ │ │ - 0x00fd6340 6c647320 2d4f320a 20202020 20202020 lds -O2. │ │ │ │ - 0x00fd6350 20202020 20202020 2020202d 666e6f2d -fno- │ │ │ │ - 0x00fd6360 7761726e 2d6f7270 68616e73 202d666e warn-orphans -fn │ │ │ │ - 0x00fd6370 6f2d7761 726e2d75 6e757365 642d646f o-warn-unused-do │ │ │ │ - 0x00fd6380 2d62696e 640a2020 2020656c 73650a20 -bind. else. │ │ │ │ - 0x00fd6390 20202020 20676863 2d6f7074 696f6e73 ghc-options │ │ │ │ - 0x00fd63a0 3a202d74 68726561 64656420 2d57616c : -threaded -Wal │ │ │ │ - 0x00fd63b0 6c202d66 7761726e 2d746162 73202d66 l -fwarn-tabs -f │ │ │ │ - 0x00fd63c0 756e626f 782d7374 72696374 2d666965 unbox-strict-fie │ │ │ │ - 0x00fd63d0 6c647320 2d4f320a 20202020 20202020 lds -O2. │ │ │ │ - 0x00fd63e0 20202020 20202020 2020202d 666e6f2d -fno- │ │ │ │ - 0x00fd63f0 7761726e 2d6f7270 68616e73 0a003c68 warn-orphans..Register a new │ │ │ │ - 0x00fd6410 20757365 723c2f68 313e0a0a 3c62696e user../new_user.Add U │ │ │ │ - 0x00fd6460 7365723c 2f62696e 643e0a3c 6170706c ser..../snapl │ │ │ │ - 0x00fd6490 6574732f 68656973 742f7465 6d706c61 ets/heist/templa │ │ │ │ - 0x00fd64a0 7465732f 5f6e6577 5f757365 722e7470 tes/_new_user.tp │ │ │ │ - 0x00fd64b0 6c003c61 70706c79 2074656d 706c6174 l... .

. This is │ │ │ │ - 0x00fd64f0 61207369 6d706c65 2064656d 6f207061 a simple demo pa │ │ │ │ - 0x00fd6500 67652073 65727665 64207573 696e670a ge served using. │ │ │ │ - 0x00fd6510 20202020 20203c61 20687265 663d2268 He │ │ │ │ - 0x00fd6550 6973743c 2f613e0a 20202020 2020616e ist. an │ │ │ │ - 0x00fd6560 64207468 65203c61 20687265 663d2268 d the Snap web framework │ │ │ │ - 0x00fd65a0 2e0a2020 20203c2f 703e0a0a 20202020 ..

.. │ │ │ │ - 0x00fd65b0 3c703e43 6f6e6772 61747321 2020596f

Congrats! Yo │ │ │ │ - 0x00fd65c0 75277265 206c6f67 67656420 696e2061 u're logged in a │ │ │ │ - 0x00fd65d0 7320273c 6c6f6767 6564496e 55736572 s ''

..

│ │ │ │ - 0x00fd65f0 3c612068 7265663d 222f6c6f 676f7574 Logout

│ │ │ │ - 0x00fd6610 0a20203c 2f69664c 6f676765 64496e3e . │ │ │ │ - 0x00fd6620 0a0a2020 3c69664c 6f676765 644f7574 .. . │ │ │ │ - 0x00fd6650 0a20203c 2f69664c 6f676765 644f7574 . ..
.../s │ │ │ │ - 0x00fd6670 6e61706c 6574732f 68656973 742f7465 naplets/heist/te │ │ │ │ - 0x00fd6680 6d706c61 7465732f 696e6465 782e7470 mplates/index.tp │ │ │ │ - 0x00fd6690 6c003c61 70706c79 2074656d 706c6174 l.. .. │ │ │ │ - 0x00fd66d0 002e2f73 6e61706c 6574732f 68656973 ../snaplets/heis │ │ │ │ - 0x00fd66e0 742f7465 6d706c61 7465732f 6c6f6769 t/templates/logi │ │ │ │ - 0x00fd66f0 6e2e7470 6c003c61 70706c79 2074656d n.tpl.. │ │ │ │ - 0x00fd6710 3c617070 6c792074 656d706c 6174653d .< │ │ │ │ - 0x00fd6730 2f617070 6c793e0a 002e2f73 6e61706c /apply>.../snapl │ │ │ │ - 0x00fd6740 6574732f 68656973 742f7465 6d706c61 ets/heist/templa │ │ │ │ - 0x00fd6750 7465732f 6e65775f 75736572 2e74706c tes/new_user.tpl │ │ │ │ - 0x00fd6760 003c666f 726d206d 6574686f 643d2270 .. < │ │ │ │ - 0x00fd6790 7461626c 65206964 3d22696e 666f223e table id="info"> │ │ │ │ - 0x00fd67a0 0a202020 203c7472 3e0a2020 20202020 . . │ │ │ │ - 0x00fd67b0 3c74643e 4c6f6769 6e3a3c2f 74643e3c Login:< │ │ │ │ - 0x00fd67c0 74643e3c 696e7075 74207479 70653d22 td>< │ │ │ │ - 0x00fd67f0 2f74643e 0a202020 203c2f74 723e0a20 /td>. . │ │ │ │ - 0x00fd6800 2020203c 74723e0a 20202020 20203c74 . Password: │ │ │ │ - 0x00fd6820 3c74643e 3c696e70 75742074 7970653d . │ │ │ │ - 0x00fd6860 203c2f74 723e0a20 2020203c 74723e0a . . │ │ │ │ - 0x00fd6870 20202020 20203c74 643e3c2f 74643e0a . │ │ │ │ - 0x00fd6880 20202020 20203c74 643e3c69 6e707574 . │ │ │ │ - 0x00fd68c0 203c2f74 723e0a20 203c2f74 61626c65 . ..../sna │ │ │ │ - 0x00fd68e0 706c6574 732f6865 6973742f 74656d70 plets/heist/temp │ │ │ │ - 0x00fd68f0 6c617465 732f7573 6572666f 726d2e74 lates/userform.t │ │ │ │ - 0x00fd6900 706c003c 68746d6c 3e0a2020 3c686561 pl.. . Sn │ │ │ │ - 0x00fd6920 61702077 65622073 65727665 723c2f74 ap web server</t │ │ │ │ - 0x00fd6930 69746c65 3e0a2020 20203c6c 696e6b20 itle>. <link │ │ │ │ - 0x00fd6940 72656c3d 22737479 6c657368 65657422 rel="stylesheet" │ │ │ │ - 0x00fd6950 20747970 653d2274 6578742f 63737322 type="text/css" │ │ │ │ - 0x00fd6960 20687265 663d222f 73637265 656e2e63 href="/screen.c │ │ │ │ - 0x00fd6970 7373222f 3e0a2020 3c2f6865 61643e0a ss"/>. </head>. │ │ │ │ - 0x00fd6980 20203c62 6f64793e 0a202020 203c6469 <body>. <di │ │ │ │ - 0x00fd6990 76206964 3d22636f 6e74656e 74223e0a v id="content">. │ │ │ │ - 0x00fd69a0 0a202020 2020203c 6170706c 792d636f . <apply-co │ │ │ │ - 0x00fd69b0 6e74656e 742f3e0a 0a202020 203c2f64 ntent/>.. </d │ │ │ │ - 0x00fd69c0 69763e0a 20203c2f 626f6479 3e0a3c2f iv>. </body>.</ │ │ │ │ - 0x00fd69d0 68746d6c 3e0a002e 2f736e61 706c6574 html>.../snaplet │ │ │ │ - 0x00fd69e0 732f6865 6973742f 74656d70 6c617465 s/heist/template │ │ │ │ - 0x00fd69f0 732f6261 73652e74 706c003c 68313e53 s/base.tpl.<h1>S │ │ │ │ - 0x00fd6a00 6e617020 4578616d 706c6520 41707020 nap Example App │ │ │ │ - 0x00fd6a10 4c6f6769 6e3c2f68 313e0a0a 3c703e3c Login</h1>..<p>< │ │ │ │ - 0x00fd6a20 6c6f6769 6e457272 6f722f3e 3c2f703e loginError/></p> │ │ │ │ - 0x00fd6a30 0a0a3c62 696e6420 7461673d 22706f73 ..<bind tag="pos │ │ │ │ - 0x00fd6a40 74416374 696f6e22 3e2f6c6f 67696e3c tAction">/login< │ │ │ │ - 0x00fd6a50 2f62696e 643e0a3c 62696e64 20746167 /bind>.<bind tag │ │ │ │ - 0x00fd6a60 3d227375 626d6974 54657874 223e4c6f ="submitText">Lo │ │ │ │ - 0x00fd6a70 67696e3c 2f62696e 643e0a3c 6170706c gin</bind>.<appl │ │ │ │ - 0x00fd6a80 79207465 6d706c61 74653d22 75736572 y template="user │ │ │ │ - 0x00fd6a90 666f726d 222f3e0a 0a3c703e 446f6e27 form"/>..<p>Don' │ │ │ │ - 0x00fd6aa0 74206861 76652061 206c6f67 696e2079 t have a login y │ │ │ │ - 0x00fd6ab0 65743f20 3c612068 7265663d 222f6e65 et? <a href="/ne │ │ │ │ - 0x00fd6ac0 775f7573 6572223e 43726561 74652061 w_user">Create a │ │ │ │ - 0x00fd6ad0 206e6577 20757365 723c2f61 3e3c2f70 new user</a></p │ │ │ │ - 0x00fd6ae0 3e0a002e 2f736e61 706c6574 732f6865 >.../snaplets/he │ │ │ │ - 0x00fd6af0 6973742f 74656d70 6c617465 732f5f6c ist/templates/_l │ │ │ │ - 0x00fd6b00 6f67696e 2e74706c 0068746d 6c207b0a ogin.tpl.html {. │ │ │ │ - 0x00fd6b10 20202070 61646469 6e673a20 303b0a20 padding: 0;. │ │ │ │ - 0x00fd6b20 20206d61 7267696e 3a20303b 0a202020 margin: 0;. │ │ │ │ - 0x00fd6b30 6261636b 67726f75 6e642d63 6f6c6f72 background-color │ │ │ │ - 0x00fd6b40 3a202366 66666666 663b0a20 2020666f : #ffffff;. fo │ │ │ │ - 0x00fd6b50 6e742d66 616d696c 793a2056 65726461 nt-family: Verda │ │ │ │ - 0x00fd6b60 6e612c20 48656c76 65746963 612c2073 na, Helvetica, s │ │ │ │ - 0x00fd6b70 616e732d 73657269 663b0a7d 0a626f64 ans-serif;.}.bod │ │ │ │ - 0x00fd6b80 79207b0a 20202070 61646469 6e673a20 y {. padding: │ │ │ │ - 0x00fd6b90 303b0a20 20206d61 7267696e 3a20303b 0;. margin: 0; │ │ │ │ - 0x00fd6ba0 0a7d0a61 207b0a20 20207465 78742d64 .}.a {. text-d │ │ │ │ - 0x00fd6bb0 65636f72 6174696f 6e3a2075 6e646572 ecoration: under │ │ │ │ - 0x00fd6bc0 6c696e65 3b0a7d0a 61203a68 6f766572 line;.}.a :hover │ │ │ │ - 0x00fd6bd0 207b0a20 20206375 72736f72 3a20706f {. cursor: po │ │ │ │ - 0x00fd6be0 696e7465 723b0a20 20207465 78742d64 inter;. text-d │ │ │ │ - 0x00fd6bf0 65636f72 6174696f 6e3a2075 6e646572 ecoration: under │ │ │ │ - 0x00fd6c00 6c696e65 3b0a7d0a 696d6720 7b0a2020 line;.}.img {. │ │ │ │ - 0x00fd6c10 20626f72 6465723a 206e6f6e 653b0a7d border: none;.} │ │ │ │ - 0x00fd6c20 0a23636f 6e74656e 74207b0a 20202070 .#content {. p │ │ │ │ - 0x00fd6c30 61646469 6e672d6c 6566743a 2031656d adding-left: 1em │ │ │ │ - 0x00fd6c40 3b0a7d0a 23696e66 6f207b0a 20202066 ;.}.#info {. f │ │ │ │ - 0x00fd6c50 6f6e742d 73697a65 3a203630 253b0a7d ont-size: 60%;.} │ │ │ │ - 0x00fd6c60 0a002e2f 73746174 69632f73 63726565 .../static/scree │ │ │ │ - 0x00fd6c70 6e2e6373 73007b2d 23204c41 4e475541 n.css.{-# LANGUA │ │ │ │ - 0x00fd6c80 4745204f 7665726c 6f616465 64537472 GE OverloadedStr │ │ │ │ - 0x00fd6c90 696e6773 20232d7d 0a0a2d2d 2d2d2d2d ings #-}..------ │ │ │ │ - 0x00fd6ca0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6cb0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6cc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6cd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6ce0 2d2d2d2d 2d2d2d2d 0a2d2d20 7c205468 --------.-- | Th │ │ │ │ - 0x00fd6cf0 6973206d 6f64756c 65206973 20776865 is module is whe │ │ │ │ - 0x00fd6d00 72652061 6c6c2074 68652072 6f757465 re all the route │ │ │ │ - 0x00fd6d10 7320616e 64206861 6e646c65 72732061 s and handlers a │ │ │ │ - 0x00fd6d20 72652064 6566696e 65642066 6f722079 re defined for y │ │ │ │ - 0x00fd6d30 6f75720a 2d2d2073 6974652e 20546865 our.-- site. The │ │ │ │ - 0x00fd6d40 20276170 70272066 756e6374 696f6e20 'app' function │ │ │ │ - 0x00fd6d50 69732074 68652069 6e697469 616c697a is the initializ │ │ │ │ - 0x00fd6d60 65722074 68617420 636f6d62 696e6573 er that combines │ │ │ │ - 0x00fd6d70 20657665 72797468 696e670a 2d2d2074 everything.-- t │ │ │ │ - 0x00fd6d80 6f676574 68657220 616e6420 69732065 ogether and is e │ │ │ │ - 0x00fd6d90 78706f72 74656420 62792074 68697320 xported by this │ │ │ │ - 0x00fd6da0 6d6f6475 6c652e0a 6d6f6475 6c652053 module..module S │ │ │ │ - 0x00fd6db0 6974650a 20202820 6170700a 20202920 ite. ( app. ) │ │ │ │ - 0x00fd6dc0 77686572 650a0a2d 2d2d2d2d 2d2d2d2d where..--------- │ │ │ │ - 0x00fd6dd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6de0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6df0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6e00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd6e10 2d2d2d2d 2d0a696d 706f7274 20202020 -----.import │ │ │ │ - 0x00fd6e20 20202020 20202043 6f6e7472 6f6c2e41 Control.A │ │ │ │ - 0x00fd6e30 70706c69 63617469 76650a69 6d706f72 pplicative.impor │ │ │ │ - 0x00fd6e40 74202020 20202020 20202020 44617461 t Data │ │ │ │ - 0x00fd6e50 2e427974 65537472 696e6720 28427974 .ByteString (Byt │ │ │ │ - 0x00fd6e60 65537472 696e6729 0a696d70 6f727420 eString).import │ │ │ │ - 0x00fd6e70 20202020 20202020 20204461 74612e4d Data.M │ │ │ │ - 0x00fd6e80 61702e53 796e7461 78202828 23232929 ap.Syntax ((##)) │ │ │ │ - 0x00fd6e90 0a696d70 6f727420 7175616c 69666965 .import qualifie │ │ │ │ - 0x00fd6ea0 64204461 74612e54 65787420 61732054 d Data.Text as T │ │ │ │ - 0x00fd6eb0 0a696d70 6f727420 20202020 20202020 .import │ │ │ │ - 0x00fd6ec0 2020536e 61702e43 6f72650a 696d706f Snap.Core.impo │ │ │ │ - 0x00fd6ed0 72742020 20202020 20202020 20536e61 rt Sna │ │ │ │ - 0x00fd6ee0 702e536e 61706c65 740a696d 706f7274 p.Snaplet.import │ │ │ │ - 0x00fd6ef0 20202020 20202020 20202053 6e61702e Snap. │ │ │ │ - 0x00fd6f00 536e6170 6c65742e 41757468 0a696d70 Snaplet.Auth.imp │ │ │ │ - 0x00fd6f10 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ - 0x00fd6f20 61702e53 6e61706c 65742e41 7574682e ap.Snaplet.Auth. │ │ │ │ - 0x00fd6f30 4261636b 656e6473 2e4a736f 6e46696c Backends.JsonFil │ │ │ │ - 0x00fd6f40 650a696d 706f7274 20202020 20202020 e.import │ │ │ │ - 0x00fd6f50 20202053 6e61702e 536e6170 6c65742e Snap.Snaplet. │ │ │ │ - 0x00fd6f60 48656973 740a696d 706f7274 20202020 Heist.import │ │ │ │ - 0x00fd6f70 20202020 20202053 6e61702e 536e6170 Snap.Snap │ │ │ │ - 0x00fd6f80 6c65742e 53657373 696f6e2e 4261636b let.Session.Back │ │ │ │ - 0x00fd6f90 656e6473 2e436f6f 6b696553 65737369 ends.CookieSessi │ │ │ │ - 0x00fd6fa0 6f6e0a69 6d706f72 74202020 20202020 on.import │ │ │ │ - 0x00fd6fb0 20202020 536e6170 2e557469 6c2e4669 Snap.Util.Fi │ │ │ │ - 0x00fd6fc0 6c655365 7276650a 696d706f 72742071 leServe.import q │ │ │ │ - 0x00fd6fd0 75616c69 66696564 20486569 73742e49 ualified Heist.I │ │ │ │ - 0x00fd6fe0 6e746572 70726574 65642061 7320490a nterpreted as I. │ │ │ │ - 0x00fd6ff0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7000 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7010 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7020 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7030 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d0a69 --------------.i │ │ │ │ - 0x00fd7040 6d706f72 74202020 20202020 20202020 mport │ │ │ │ - 0x00fd7050 4170706c 69636174 696f6e0a 0a0a2d2d Application...-- │ │ │ │ - 0x00fd7060 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7070 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7080 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7090 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd70a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a2d2d20 ------------.-- │ │ │ │ - 0x00fd70b0 7c205265 6e646572 206c6f67 696e2066 | Render login f │ │ │ │ - 0x00fd70c0 6f726d0a 68616e64 6c654c6f 67696e20 orm.handleLogin │ │ │ │ - 0x00fd70d0 3a3a204d 61796265 20542e54 65787420 :: Maybe T.Text │ │ │ │ - 0x00fd70e0 2d3e2048 616e646c 65722041 70702028 -> Handler App ( │ │ │ │ - 0x00fd70f0 41757468 4d616e61 67657220 41707029 AuthManager App) │ │ │ │ - 0x00fd7100 2028290a 68616e64 6c654c6f 67696e20 ().handleLogin │ │ │ │ - 0x00fd7110 61757468 4572726f 72203d20 68656973 authError = heis │ │ │ │ - 0x00fd7120 744c6f63 616c2028 492e6269 6e645370 tLocal (I.bindSp │ │ │ │ - 0x00fd7130 6c696365 73206572 72732920 24207265 lices errs) $ re │ │ │ │ - 0x00fd7140 6e646572 20226c6f 67696e22 0a202077 nder "login". w │ │ │ │ - 0x00fd7150 68657265 0a202020 20657272 73203d20 here. errs = │ │ │ │ - 0x00fd7160 6d617962 65206d65 6d707479 2073706c maybe mempty spl │ │ │ │ - 0x00fd7170 69636520 61757468 4572726f 720a2020 ice authError. │ │ │ │ - 0x00fd7180 20207370 6c696365 20657272 203d2022 splice err = " │ │ │ │ - 0x00fd7190 6c6f6769 6e457272 6f722220 23232049 loginError" ## I │ │ │ │ - 0x00fd71a0 2e746578 7453706c 69636520 6572720a .textSplice err. │ │ │ │ - 0x00fd71b0 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ - 0x00fd71c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd71d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd71e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd71f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7200 0a2d2d20 7c204861 6e646c65 206c6f67 .-- | Handle log │ │ │ │ - 0x00fd7210 696e2073 75626d69 740a6861 6e646c65 in submit.handle │ │ │ │ - 0x00fd7220 4c6f6769 6e537562 6d697420 3a3a2048 LoginSubmit :: H │ │ │ │ - 0x00fd7230 616e646c 65722041 70702028 41757468 andler App (Auth │ │ │ │ - 0x00fd7240 4d616e61 67657220 41707029 2028290a Manager App) (). │ │ │ │ - 0x00fd7250 68616e64 6c654c6f 67696e53 75626d69 handleLoginSubmi │ │ │ │ - 0x00fd7260 74203d0a 20202020 6c6f6769 6e557365 t =. loginUse │ │ │ │ - 0x00fd7270 7220226c 6f67696e 22202270 61737377 r "login" "passw │ │ │ │ - 0x00fd7280 6f726422 204e6f74 68696e67 0a202020 ord" Nothing. │ │ │ │ - 0x00fd7290 20202020 20202020 20202028 5c5f202d (\_ - │ │ │ │ - 0x00fd72a0 3e206861 6e646c65 4c6f6769 6e206572 > handleLogin er │ │ │ │ - 0x00fd72b0 72292028 72656469 72656374 20222f22 r) (redirect "/" │ │ │ │ - 0x00fd72c0 290a2020 77686572 650a2020 20206572 ). where. er │ │ │ │ - 0x00fd72d0 72203d20 4a757374 2022556e 6b6e6f77 r = Just "Unknow │ │ │ │ - 0x00fd72e0 6e207573 6572206f 72207061 7373776f n user or passwo │ │ │ │ - 0x00fd72f0 7264220a 0a0a2d2d 2d2d2d2d 2d2d2d2d rd"...---------- │ │ │ │ + 0x00fd12c0 74657200 57686174 20417265 20536e61 ter.What Are Sna │ │ │ │ + 0x00fd12d0 706c6574 733f0a3d 3d3d3d3d 3d3d3d3d plets?.========= │ │ │ │ + 0x00fd12e0 3d3d3d3d 3d3d3d3d 3d0a0a41 20736e61 =========..A sna │ │ │ │ + 0x00fd12f0 706c6574 20697320 6120636f 6d706f73 plet is a compos │ │ │ │ + 0x00fd1300 61626c65 20776562 20617070 6c696361 able web applica │ │ │ │ + 0x00fd1310 74696f6e 2e202053 6e61706c 65747320 tion. Snaplets │ │ │ │ + 0x00fd1320 616c6c6f 7720796f 7520746f 20627569 allow you to bui │ │ │ │ + 0x00fd1330 6c640a73 656c662d 636f6e74 61696e65 ld.self-containe │ │ │ │ + 0x00fd1340 64207069 65636573 206f6620 66756e63 d pieces of func │ │ │ │ + 0x00fd1350 74696f6e 616c6974 7920616e 6420676c tionality and gl │ │ │ │ + 0x00fd1360 75652074 68656d20 746f6765 74686572 ue them together │ │ │ │ + 0x00fd1370 20746f20 6d616b65 206c6172 6765720a to make larger. │ │ │ │ + 0x00fd1380 6170706c 69636174 696f6e73 2e202048 applications. H │ │ │ │ + 0x00fd1390 65726520 61726520 736f6d65 206f6620 ere are some of │ │ │ │ + 0x00fd13a0 74686520 7468696e 67732070 726f7669 the things provi │ │ │ │ + 0x00fd13b0 64656420 62792074 68652073 6e61706c ded by the snapl │ │ │ │ + 0x00fd13c0 65742041 50493a0a 0a20202d 20496e66 et API:.. - Inf │ │ │ │ + 0x00fd13d0 72617374 72756374 75726520 666f7220 rastructure for │ │ │ │ + 0x00fd13e0 6170706c 69636174 696f6e20 73746174 application stat │ │ │ │ + 0x00fd13f0 652f656e 7669726f 6e6d656e 740a0a20 e/environment.. │ │ │ │ + 0x00fd1400 202d2053 6e61706c 65742069 6e697469 - Snaplet initi │ │ │ │ + 0x00fd1410 616c697a 6174696f 6e2c2072 656c6f61 alization, reloa │ │ │ │ + 0x00fd1420 642c2061 6e642063 6c65616e 75700a0a d, and cleanup.. │ │ │ │ + 0x00fd1430 20202d20 4d616e61 67656d65 6e74206f - Management o │ │ │ │ + 0x00fd1440 66206669 6c657379 7374656d 20646174 f filesystem dat │ │ │ │ + 0x00fd1450 6120616e 64206175 746f6d61 74696320 a and automatic │ │ │ │ + 0x00fd1460 736e6170 6c657420 696e7374 616c6c61 snaplet installa │ │ │ │ + 0x00fd1470 74696f6e 0a0a2020 2d20556e 69666965 tion.. - Unifie │ │ │ │ + 0x00fd1480 6420636f 6e666967 2066696c 6520696e d config file in │ │ │ │ + 0x00fd1490 66726173 74727563 74757265 0a0a4f6e frastructure..On │ │ │ │ + 0x00fd14a0 65206578 616d706c 65206d69 67687420 e example might │ │ │ │ + 0x00fd14b0 62652061 2077696b 6920736e 61706c65 be a wiki snaple │ │ │ │ + 0x00fd14c0 742e2020 49742077 6f756c64 20626520 t. It would be │ │ │ │ + 0x00fd14d0 64697374 72696275 74656420 61732061 distributed as a │ │ │ │ + 0x00fd14e0 20686173 6b656c6c 0a706163 6b616765 haskell.package │ │ │ │ + 0x00fd14f0 20746861 7420776f 756c6420 62652069 that would be i │ │ │ │ + 0x00fd1500 6e737461 6c6c6564 20776974 68206361 nstalled with ca │ │ │ │ + 0x00fd1510 62616c20 616e6420 776f756c 64207072 bal and would pr │ │ │ │ + 0x00fd1520 6f626162 6c792069 6e636c75 64652063 obably include c │ │ │ │ + 0x00fd1530 6f64652c 0a636f6e 66696720 66696c65 ode,.config file │ │ │ │ + 0x00fd1540 732c2048 544d4c20 74656d70 6c617465 s, HTML template │ │ │ │ + 0x00fd1550 732c2073 74796c65 73686565 74732c20 s, stylesheets, │ │ │ │ + 0x00fd1560 4a617661 53637269 70742c20 696d6167 JavaScript, imag │ │ │ │ + 0x00fd1570 65732c20 6574632e 20205468 650a736e es, etc. The.sn │ │ │ │ + 0x00fd1580 61706c65 74277320 636f6465 20776f75 aplet's code wou │ │ │ │ + 0x00fd1590 6c642070 726f7669 64652074 6865206e ld provide the n │ │ │ │ + 0x00fd15a0 65636573 73617279 20415049 20746f20 ecessary API to │ │ │ │ + 0x00fd15b0 6c657420 796f7572 20617070 6c696361 let your applica │ │ │ │ + 0x00fd15c0 74696f6e 0a696e74 65726163 74207365 tion.interact se │ │ │ │ + 0x00fd15d0 616d6c65 73736c79 20776974 68207468 amlessly with th │ │ │ │ + 0x00fd15e0 65207769 6b692066 756e6374 696f6e61 e wiki functiona │ │ │ │ + 0x00fd15f0 6c697479 2e202057 68656e20 796f7520 lity. When you │ │ │ │ + 0x00fd1600 72756e20 796f7572 0a617070 6c696361 run your.applica │ │ │ │ + 0x00fd1610 74696f6e 20666f72 20746865 20666972 tion for the fir │ │ │ │ + 0x00fd1620 73742074 696d652c 20616c6c 206f6620 st time, all of │ │ │ │ + 0x00fd1630 74686520 77696b69 20736e61 706c6574 the wiki snaplet │ │ │ │ + 0x00fd1640 27732066 696c6573 79737465 6d207265 's filesystem re │ │ │ │ + 0x00fd1650 736f7572 6365730a 77696c6c 20617574 sources.will aut │ │ │ │ + 0x00fd1660 6f6d6174 6963616c 6c792062 6520636f omatically be co │ │ │ │ + 0x00fd1670 70696564 20696e74 6f207468 65206170 pied into the ap │ │ │ │ + 0x00fd1680 70726f70 72696174 6520706c 61636573 propriate places │ │ │ │ + 0x00fd1690 2e202054 68656e20 796f7520 77696c6c . Then you will │ │ │ │ + 0x00fd16a0 0a696d6d 65646961 74656c79 20626520 .immediately be │ │ │ │ + 0x00fd16b0 61626c65 20746f20 63757374 6f6d697a able to customiz │ │ │ │ + 0x00fd16c0 65207468 65207769 6b692074 6f206669 e the wiki to fi │ │ │ │ + 0x00fd16d0 7420796f 7572206e 65656473 20627920 t your needs by │ │ │ │ + 0x00fd16e0 65646974 696e6720 636f6e66 69670a66 editing config.f │ │ │ │ + 0x00fd16f0 696c6573 2c207072 6f766964 696e6720 iles, providing │ │ │ │ + 0x00fd1700 796f7572 206f776e 20737479 6c657368 your own stylesh │ │ │ │ + 0x00fd1710 65657473 2c206574 632e2020 57652077 eets, etc. We w │ │ │ │ + 0x00fd1720 696c6c20 64697363 75737320 74686973 ill discuss this │ │ │ │ + 0x00fd1730 20696e20 6d6f7265 0a646574 61696c20 in more.detail │ │ │ │ + 0x00fd1740 6c617465 722e0a0a 4120736e 61706c65 later...A snaple │ │ │ │ + 0x00fd1750 74206361 6e207265 70726573 656e7420 t can represent │ │ │ │ + 0x00fd1760 616e7974 68696e67 2066726f 6d206261 anything from ba │ │ │ │ + 0x00fd1770 636b656e 64204861 736b656c 6c20696e ckend Haskell in │ │ │ │ + 0x00fd1780 66726173 74727563 74757265 20776974 frastructure wit │ │ │ │ + 0x00fd1790 68206e6f 0a757365 72206661 63696e67 h no.user facing │ │ │ │ + 0x00fd17a0 2066756e 6374696f 6e616c69 74792074 functionality t │ │ │ │ + 0x00fd17b0 6f206120 736d616c 6c207769 64676574 o a small widget │ │ │ │ + 0x00fd17c0 206c696b 65206120 63686174 20626f78 like a chat box │ │ │ │ + 0x00fd17d0 20746861 7420676f 65732069 6e207468 that goes in th │ │ │ │ + 0x00fd17e0 650a636f 726e6572 206f6620 61207765 e.corner of a we │ │ │ │ + 0x00fd17f0 62207061 67652074 6f20616e 20656e74 b page to an ent │ │ │ │ + 0x00fd1800 69726520 7374616e 64616c6f 6e652077 ire standalone w │ │ │ │ + 0x00fd1810 65627369 7465206c 696b6520 6120626c ebsite like a bl │ │ │ │ + 0x00fd1820 6f67206f 7220666f 72756d2e 0a546865 og or forum..The │ │ │ │ + 0x00fd1830 20706f73 73696269 6c697469 65732061 possibilities a │ │ │ │ + 0x00fd1840 72652065 6e646c65 73732e20 20412073 re endless. A s │ │ │ │ + 0x00fd1850 6e61706c 65742069 73206120 77656220 naplet is a web │ │ │ │ + 0x00fd1860 6170706c 69636174 696f6e2c 20616e64 application, and │ │ │ │ + 0x00fd1870 20776562 0a617070 6c696361 74696f6e web.application │ │ │ │ + 0x00fd1880 73206172 6520736e 61706c65 74732e20 s are snaplets. │ │ │ │ + 0x00fd1890 20546869 73206d65 616e7320 74686174 This means that │ │ │ │ + 0x00fd18a0 20757369 6e672073 6e61706c 65747320 using snaplets │ │ │ │ + 0x00fd18b0 616e6420 77726974 696e670a 736e6170 and writing.snap │ │ │ │ + 0x00fd18c0 6c657473 20617265 20616c6d 6f737420 lets are almost │ │ │ │ + 0x00fd18d0 74686520 73616d65 20746869 6e672c20 the same thing, │ │ │ │ + 0x00fd18e0 616e6420 69742773 20747269 7669616c and it's trivial │ │ │ │ + 0x00fd18f0 20746f20 64726f70 20612077 686f6c65 to drop a whole │ │ │ │ + 0x00fd1900 20776562 73697465 0a696e74 6f20616e website.into an │ │ │ │ + 0x00fd1910 6f746865 72206f6e 652e0a0a 57652772 other one...We'r │ │ │ │ + 0x00fd1920 65207265 616c6c79 20657863 69746564 e really excited │ │ │ │ + 0x00fd1930 2061626f 75742074 68652070 6f737369 about the possi │ │ │ │ + 0x00fd1940 62696c69 74696573 20617661 696c6162 bilities availab │ │ │ │ + 0x00fd1950 6c652077 69746820 736e6170 6c657473 le with snaplets │ │ │ │ + 0x00fd1960 2e202049 6e0a6661 63742c20 536e6170 . In.fact, Snap │ │ │ │ + 0x00fd1970 20616c72 65616479 20736869 70732077 already ships w │ │ │ │ + 0x00fd1980 69746820 736e6170 6c657473 20666f72 ith snaplets for │ │ │ │ + 0x00fd1990 20736573 73696f6e 732c2061 75746865 sessions, authe │ │ │ │ + 0x00fd19a0 6e746963 6174696f 6e2c2061 6e640a74 ntication, and.t │ │ │ │ + 0x00fd19b0 656d706c 6174696e 67202877 69746820 emplating (with │ │ │ │ + 0x00fd19c0 48656973 74292c20 20546869 73206769 Heist), This gi │ │ │ │ + 0x00fd19d0 76657320 796f7520 75736566 756c2066 ves you useful f │ │ │ │ + 0x00fd19e0 756e6374 696f6e61 6c697479 206f7574 unctionality out │ │ │ │ + 0x00fd19f0 206f6620 74686520 626f782c 0a616e64 of the box,.and │ │ │ │ + 0x00fd1a00 206a756d 70207374 61727473 20796f75 jump starts you │ │ │ │ + 0x00fd1a10 72206f77 6e20736e 61706c65 74206465 r own snaplet de │ │ │ │ + 0x00fd1a20 76656c6f 706d656e 74206279 2064656d velopment by dem │ │ │ │ + 0x00fd1a30 6f6e7374 72617469 6e672073 6f6d6520 onstrating some │ │ │ │ + 0x00fd1a40 75736566 756c0a64 65736967 6e207061 useful.design pa │ │ │ │ + 0x00fd1a50 74746572 6e732e20 20536f20 77697468 tterns. So with │ │ │ │ + 0x00fd1a60 6f757420 66757274 68657220 61646f2c out further ado, │ │ │ │ + 0x00fd1a70 206c6574 27732067 65742073 74617274 let's get start │ │ │ │ + 0x00fd1a80 65642e0a 0a536e61 706c6574 204f7665 ed...Snaplet Ove │ │ │ │ + 0x00fd1a90 72766965 770a3d3d 3d3d3d3d 3d3d3d3d rview.========== │ │ │ │ + 0x00fd1aa0 3d3d3d3d 3d3d0a0a 54686520 68656172 ======..The hear │ │ │ │ + 0x00fd1ab0 74206f66 20746865 20736e61 706c6574 t of the snaplet │ │ │ │ + 0x00fd1ac0 7320696e 66726173 74727563 74757265 s infrastructure │ │ │ │ + 0x00fd1ad0 20697320 73746174 65206d61 6e616765 is state manage │ │ │ │ + 0x00fd1ae0 6d656e74 2e20204d 6f737420 6e6f6e74 ment. Most nont │ │ │ │ + 0x00fd1af0 72697669 616c0a70 69656365 73206f66 rivial.pieces of │ │ │ │ + 0x00fd1b00 20612077 65622061 7070206e 65656420 a web app need │ │ │ │ + 0x00fd1b10 736f6d65 206b696e 64206f66 20737461 some kind of sta │ │ │ │ + 0x00fd1b20 7465206f 7220656e 7669726f 6e6d656e te or environmen │ │ │ │ + 0x00fd1b30 74206461 74612e20 20436f6d 706f6e65 t data. Compone │ │ │ │ + 0x00fd1b40 6e74730a 74686174 20646f20 6e6f7420 nts.that do not │ │ │ │ + 0x00fd1b50 6e656564 20616e79 206b696e 64206f66 need any kind of │ │ │ │ + 0x00fd1b60 20737461 7465206f 7220656e 7669726f state or enviro │ │ │ │ + 0x00fd1b70 6e6d656e 74206172 65207072 6f626162 nment are probab │ │ │ │ + 0x00fd1b80 6c79206d 6f72650a 61707072 6f707269 ly more.appropri │ │ │ │ + 0x00fd1b90 61746520 61732061 20737461 6e64616c ate as a standal │ │ │ │ + 0x00fd1ba0 6f6e6520 6c696272 61727920 7468616e one library than │ │ │ │ + 0x00fd1bb0 20617320 6120736e 61706c65 742e0a0a as a snaplet... │ │ │ │ + 0x00fd1bc0 4265666f 72652077 6520636f 6e74696e Before we contin │ │ │ │ + 0x00fd1bd0 75652c20 7765206d 75737420 636c6172 ue, we must clar │ │ │ │ + 0x00fd1be0 69667920 616e2069 6d706f72 74616e74 ify an important │ │ │ │ + 0x00fd1bf0 20706f69 6e742e20 20546865 20536e61 point. The Sna │ │ │ │ + 0x00fd1c00 70207765 62207365 72766572 0a70726f p web server.pro │ │ │ │ + 0x00fd1c10 63657373 65732065 61636820 72657175 cesses each requ │ │ │ │ + 0x00fd1c20 65737420 696e2069 7473206f 776e2067 est in its own g │ │ │ │ + 0x00fd1c30 7265656e 20746872 6561642e 20205468 reen thread. Th │ │ │ │ + 0x00fd1c40 6973206d 65616e73 20746861 74206561 is means that ea │ │ │ │ + 0x00fd1c50 63682072 65717565 73740a77 696c6c20 ch request.will │ │ │ │ + 0x00fd1c60 72656365 69766520 61207365 70617261 receive a separa │ │ │ │ + 0x00fd1c70 74652063 6f707920 6f662074 68652073 te copy of the s │ │ │ │ + 0x00fd1c80 74617465 20646566 696e6564 20627920 tate defined by │ │ │ │ + 0x00fd1c90 796f7572 20617070 6c696361 74696f6e your application │ │ │ │ + 0x00fd1ca0 20616e64 0a736e61 706c6574 732c2061 and.snaplets, a │ │ │ │ + 0x00fd1cb0 6e64206d 6f646966 69636174 696f6e73 nd modifications │ │ │ │ + 0x00fd1cc0 20746f20 74686174 20737461 7465206f to that state o │ │ │ │ + 0x00fd1cd0 6e6c7920 61666665 63742074 6865206c nly affect the l │ │ │ │ + 0x00fd1ce0 6f63616c 20746872 65616420 74686174 ocal thread that │ │ │ │ + 0x00fd1cf0 0a67656e 65726174 65732061 2073696e .generates a sin │ │ │ │ + 0x00fd1d00 676c6520 72657370 6f6e7365 2e202046 gle response. F │ │ │ │ + 0x00fd1d10 726f6d20 6e6f7720 6f6e2c20 7768656e rom now on, when │ │ │ │ + 0x00fd1d20 20776520 74616c6b 2061626f 75742073 we talk about s │ │ │ │ + 0x00fd1d30 74617465 20746869 73206973 0a776861 tate this is.wha │ │ │ │ + 0x00fd1d40 74207765 20617265 2074616c 6b696e67 t we are talking │ │ │ │ + 0x00fd1d50 2061626f 75742e20 20496620 796f7520 about. If you │ │ │ │ + 0x00fd1d60 6e656564 20676c6f 62616c20 6170706c need global appl │ │ │ │ + 0x00fd1d70 69636174 696f6e20 73746174 652c2079 ication state, y │ │ │ │ + 0x00fd1d80 6f752068 61766520 746f0a75 73652061 ou have to.use a │ │ │ │ + 0x00fd1d90 20746872 6561642d 73616665 20636f6e thread-safe con │ │ │ │ + 0x00fd1da0 73747275 63742073 75636820 61732061 struct such as a │ │ │ │ + 0x00fd1db0 6e204d56 6172206f 7220494f 5265662e n MVar or IORef. │ │ │ │ + 0x00fd1dc0 0a0a5468 69732070 6f737420 69732077 ..This post is w │ │ │ │ + 0x00fd1dd0 72697474 656e2069 6e206c69 74657261 ritten in litera │ │ │ │ + 0x00fd1de0 74652048 61736b65 6c6c2e20 20497420 te Haskell. It │ │ │ │ + 0x00fd1df0 75736573 20612073 6d616c6c 20657874 uses a small ext │ │ │ │ + 0x00fd1e00 65726e61 6c206d6f 64756c65 0a63616c ernal module.cal │ │ │ │ + 0x00fd1e10 6c656420 50617274 32207468 61742069 led Part2 that i │ │ │ │ + 0x00fd1e20 73205b61 7661696c 61626c65 0a686572 s [available.her │ │ │ │ + 0x00fd1e30 655d2868 74747073 3a2f2f67 69746875 e](https://githu │ │ │ │ + 0x00fd1e40 622e636f 6d2f736e 61706672 616d6577 b.com/snapframew │ │ │ │ + 0x00fd1e50 6f726b2f 736e6170 2d74656d 706c6174 ork/snap-templat │ │ │ │ + 0x00fd1e60 65732f62 6c6f622f 6d617374 65722f70 es/blob/master/p │ │ │ │ + 0x00fd1e70 726f6a65 63745f74 656d706c 6174652f roject_template/ │ │ │ │ + 0x00fd1e80 7475746f 7269616c 2f737263 2f506172 tutorial/src/Par │ │ │ │ + 0x00fd1e90 74322e6c 6873292e 0a596f75 2063616e t2.lhs)..You can │ │ │ │ + 0x00fd1ea0 20616c73 6f20696e 7374616c 6c207468 also install th │ │ │ │ + 0x00fd1eb0 65206675 6c6c2063 6f646520 696e2074 e full code in t │ │ │ │ + 0x00fd1ec0 68652063 75727265 6e742064 69726563 he current direc │ │ │ │ + 0x00fd1ed0 746f7279 20776974 68207468 6520636f tory with the co │ │ │ │ + 0x00fd1ee0 6d6d616e 640a6073 6e617020 696e6974 mmand.`snap init │ │ │ │ + 0x00fd1ef0 20747574 6f726961 6c602e20 20466972 tutorial`. Fir │ │ │ │ + 0x00fd1f00 73742077 65206e65 65642074 6f206765 st we need to ge │ │ │ │ + 0x00fd1f10 7420696d 706f7274 73206f75 74206f66 t imports out of │ │ │ │ + 0x00fd1f20 20746865 20776179 2e0a0a3e 207b2d23 the way...> {-# │ │ │ │ + 0x00fd1f30 204c414e 47554147 45205465 6d706c61 LANGUAGE Templa │ │ │ │ + 0x00fd1f40 74654861 736b656c 6c20232d 7d0a3e20 teHaskell #-}.> │ │ │ │ + 0x00fd1f50 7b2d2320 4c414e47 55414745 204f7665 {-# LANGUAGE Ove │ │ │ │ + 0x00fd1f60 726c6f61 64656453 7472696e 67732023 rloadedStrings # │ │ │ │ + 0x00fd1f70 2d7d0a3e 0a3e206d 6f64756c 65204d61 -}.>.> module Ma │ │ │ │ + 0x00fd1f80 696e2077 68657265 0a3e0a3e 20696d70 in where.>.> imp │ │ │ │ + 0x00fd1f90 6f727420 20202020 20202020 2020436f ort Co │ │ │ │ + 0x00fd1fa0 6e74726f 6c2e4170 706c6963 61746976 ntrol.Applicativ │ │ │ │ + 0x00fd1fb0 65202828 3c7c3e29 290a3e20 696d706f e ((<|>)).> impo │ │ │ │ + 0x00fd1fc0 72742020 20202020 20202020 20436f6e rt Con │ │ │ │ + 0x00fd1fd0 74726f6c 2e4c656e 732e5448 0a3e2069 trol.Lens.TH.> i │ │ │ │ + 0x00fd1fe0 6d706f72 74202020 20202020 20202020 mport │ │ │ │ + 0x00fd1ff0 436f6e74 726f6c2e 4d6f6e61 642e494f Control.Monad.IO │ │ │ │ + 0x00fd2000 2e436c61 73732028 6c696674 494f290a .Class (liftIO). │ │ │ │ + 0x00fd2010 3e20696d 706f7274 20202020 20202020 > import │ │ │ │ + 0x00fd2020 20202043 6f6e7472 6f6c2e4d 6f6e6164 Control.Monad │ │ │ │ + 0x00fd2030 2e537461 74652e43 6c617373 20286765 .State.Class (ge │ │ │ │ + 0x00fd2040 7473290a 3e20696d 706f7274 20202020 ts).> import │ │ │ │ + 0x00fd2050 20202020 20202044 6174612e 494f5265 Data.IORe │ │ │ │ + 0x00fd2060 660a3e20 696d706f 72742071 75616c69 f.> import quali │ │ │ │ + 0x00fd2070 66696564 20446174 612e4279 74655374 fied Data.ByteSt │ │ │ │ + 0x00fd2080 72696e67 2e436861 72382061 7320420a ring.Char8 as B. │ │ │ │ + 0x00fd2090 3e20696d 706f7274 20202020 20202020 > import │ │ │ │ + 0x00fd20a0 20202044 6174612e 4d617962 650a3e20 Data.Maybe.> │ │ │ │ + 0x00fd20b0 696d706f 72742020 20202020 20202020 import │ │ │ │ + 0x00fd20c0 20536e61 700a3e20 696d706f 72742020 Snap.> import │ │ │ │ + 0x00fd20d0 20202020 20202020 20536e61 702e536e Snap.Sn │ │ │ │ + 0x00fd20e0 61706c65 742e4865 6973740a 3e20696d aplet.Heist.> im │ │ │ │ + 0x00fd20f0 706f7274 20202020 20202020 20202050 port P │ │ │ │ + 0x00fd2100 61727432 0a0a5765 20737461 7274206f art2..We start o │ │ │ │ + 0x00fd2110 75722061 70706c69 63617469 6f6e2062 ur application b │ │ │ │ + 0x00fd2120 79206465 66696e69 6e672061 20646174 y defining a dat │ │ │ │ + 0x00fd2130 61207374 72756374 75726520 746f2068 a structure to h │ │ │ │ + 0x00fd2140 6f6c6420 74686520 73746174 652e2020 old the state. │ │ │ │ + 0x00fd2150 54686973 0a646174 61207374 72756374 This.data struct │ │ │ │ + 0x00fd2160 75726520 696e636c 75646573 20746865 ure includes the │ │ │ │ + 0x00fd2170 20737461 7465206f 6620616c 6c20736e state of all sn │ │ │ │ + 0x00fd2180 61706c65 74732028 77726170 70656420 aplets (wrapped │ │ │ │ + 0x00fd2190 696e2061 20536e61 706c6574 29207573 in a Snaplet) us │ │ │ │ + 0x00fd21a0 65640a62 79206f75 72206170 706c6963 ed.by our applic │ │ │ │ + 0x00fd21b0 6174696f 6e206173 2077656c 6c206173 ation as well as │ │ │ │ + 0x00fd21c0 20616e79 206f7468 65722073 74617465 any other state │ │ │ │ + 0x00fd21d0 20776520 6d696768 74207761 6e742e0a we might want.. │ │ │ │ + 0x00fd21e0 0a3e2064 61746120 41707020 3d204170 .> data App = Ap │ │ │ │ + 0x00fd21f0 700a3e20 20202020 7b205f68 65697374 p.> { _heist │ │ │ │ + 0x00fd2200 20202020 2020203a 3a20536e 61706c65 :: Snaple │ │ │ │ + 0x00fd2210 74202848 65697374 20417070 290a3e20 t (Heist App).> │ │ │ │ + 0x00fd2220 20202020 2c205f66 6f6f2020 20202020 , _foo │ │ │ │ + 0x00fd2230 2020203a 3a20536e 61706c65 7420466f :: Snaplet Fo │ │ │ │ + 0x00fd2240 6f0a3e20 20202020 2c205f62 61722020 o.> , _bar │ │ │ │ + 0x00fd2250 20202020 2020203a 3a20536e 61706c65 :: Snaple │ │ │ │ + 0x00fd2260 74204261 720a3e20 20202020 2c205f63 t Bar.> , _c │ │ │ │ + 0x00fd2270 6f6d7061 6e794e61 6d65203a 3a20494f ompanyName :: IO │ │ │ │ + 0x00fd2280 52656620 422e4279 74655374 72696e67 Ref B.ByteString │ │ │ │ + 0x00fd2290 0a3e2020 2020207d 0a3e0a3e 206d616b .> }.>.> mak │ │ │ │ + 0x00fd22a0 654c656e 73657320 27274170 700a0a54 eLenses ''App..T │ │ │ │ + 0x00fd22b0 68652066 69656c64 206e616d 65732062 he field names b │ │ │ │ + 0x00fd22c0 6567696e 20776974 6820616e 20756e64 egin with an und │ │ │ │ + 0x00fd22d0 65727363 6f726520 62656361 75736520 erscore because │ │ │ │ + 0x00fd22e0 6f662073 6f6d6520 6d6f7265 20636f6d of some more com │ │ │ │ + 0x00fd22f0 706c6963 61746564 0a746869 6e677320 plicated.things │ │ │ │ + 0x00fd2300 676f696e 67206f6e 20756e64 65722074 going on under t │ │ │ │ + 0x00fd2310 68652068 6f6f642e 2020486f 77657665 he hood. Howeve │ │ │ │ + 0x00fd2320 722c2061 6c6c2079 6f75206e 65656420 r, all you need │ │ │ │ + 0x00fd2330 746f206b 6e6f7720 72696768 74206e6f to know right no │ │ │ │ + 0x00fd2340 77206973 0a746861 7420796f 75207368 w is.that you sh │ │ │ │ + 0x00fd2350 6f756c64 20707265 66697820 7468696e ould prefix thin │ │ │ │ + 0x00fd2360 67732077 69746820 616e2075 6e646572 gs with an under │ │ │ │ + 0x00fd2370 73636f72 6520616e 64207468 656e2063 score and then c │ │ │ │ + 0x00fd2380 616c6c20 606d616b 654c656e 73657360 all `makeLenses` │ │ │ │ + 0x00fd2390 2e0a5468 6973206c 65747320 796f7520 ..This lets you │ │ │ │ + 0x00fd23a0 75736520 74686520 6e616d65 73207769 use the names wi │ │ │ │ + 0x00fd23b0 74686f75 7420616e 20756e64 65727363 thout an undersc │ │ │ │ + 0x00fd23c0 6f726520 696e2074 68652072 65737420 ore in the rest │ │ │ │ + 0x00fd23d0 6f662079 6f75720a 6170706c 69636174 of your.applicat │ │ │ │ + 0x00fd23e0 696f6e2e 0a0a5468 65206e65 78742074 ion...The next t │ │ │ │ + 0x00fd23f0 68696e67 20776520 6e656564 20746f20 hing we need to │ │ │ │ + 0x00fd2400 646f2069 73206465 66696e65 20616e20 do is define an │ │ │ │ + 0x00fd2410 696e6974 69616c69 7a65722e 0a0a3e20 initializer...> │ │ │ │ + 0x00fd2420 61707049 6e697420 3a3a2053 6e61706c appInit :: Snapl │ │ │ │ + 0x00fd2430 6574496e 69742041 70702041 70700a3e etInit App App.> │ │ │ │ + 0x00fd2440 20617070 496e6974 203d206d 616b6553 appInit = makeS │ │ │ │ + 0x00fd2450 6e61706c 65742022 6d796170 70222022 naplet "myapp" " │ │ │ │ + 0x00fd2460 4d792065 78616d70 6c652061 70706c69 My example appli │ │ │ │ + 0x00fd2470 63617469 6f6e2220 4e6f7468 696e6720 cation" Nothing │ │ │ │ + 0x00fd2480 2420646f 0a3e2020 20202068 73203c2d $ do.> hs <- │ │ │ │ + 0x00fd2490 206e6573 74536e61 706c6574 20226865 nestSnaplet "he │ │ │ │ + 0x00fd24a0 69737422 20686569 73742024 20686569 ist" heist $ hei │ │ │ │ + 0x00fd24b0 7374496e 69742022 74656d70 6c617465 stInit "template │ │ │ │ + 0x00fd24c0 73220a3e 20202020 20667320 3c2d206e s".> fs <- n │ │ │ │ + 0x00fd24d0 65737453 6e61706c 65742022 666f6f22 estSnaplet "foo" │ │ │ │ + 0x00fd24e0 20666f6f 20242066 6f6f496e 69740a3e foo $ fooInit.> │ │ │ │ + 0x00fd24f0 20202020 20627320 3c2d206e 65737453 bs <- nestS │ │ │ │ + 0x00fd2500 6e61706c 65742022 22206261 72202420 naplet "" bar $ │ │ │ │ + 0x00fd2510 6e616d65 536e6170 6c657420 226e6577 nameSnaplet "new │ │ │ │ + 0x00fd2520 6e616d65 22202420 62617249 6e697420 name" $ barInit │ │ │ │ + 0x00fd2530 666f6f0a 3e202020 20206164 64526f75 foo.> addRou │ │ │ │ + 0x00fd2540 74657320 5b202822 68656c6c 6f222c20 tes [ ("hello", │ │ │ │ + 0x00fd2550 77726974 65546578 74202268 656c6c6f writeText "hello │ │ │ │ + 0x00fd2560 20776f72 6c642229 0a3e2020 20202020 world").> │ │ │ │ + 0x00fd2570 20202020 20202020 202c2028 22666f6f , ("foo │ │ │ │ + 0x00fd2580 6e616d65 222c2077 69746820 666f6f20 name", with foo │ │ │ │ + 0x00fd2590 6e616d65 50616765 290a3e20 20202020 namePage).> │ │ │ │ + 0x00fd25a0 20202020 20202020 20202c20 28226261 , ("ba │ │ │ │ + 0x00fd25b0 726e616d 65222c20 77697468 20626172 rname", with bar │ │ │ │ + 0x00fd25c0 206e616d 65506167 65290a3e 20202020 namePage).> │ │ │ │ + 0x00fd25d0 20202020 20202020 2020202c 20282263 , ("c │ │ │ │ + 0x00fd25e0 6f6d7061 6e79222c 20636f6d 70616e79 ompany", company │ │ │ │ + 0x00fd25f0 48616e64 6c657229 0a3e2020 20202020 Handler).> │ │ │ │ + 0x00fd2600 20202020 20202020 205d0a3e 20202020 ].> │ │ │ │ + 0x00fd2610 20777261 70536974 6520283c 7c3e2068 wrapSite (<|> h │ │ │ │ + 0x00fd2620 65697374 53657276 65290a3e 20202020 eistServe).> │ │ │ │ + 0x00fd2630 20726566 203c2d20 6c696674 494f2024 ref <- liftIO $ │ │ │ │ + 0x00fd2640 206e6577 494f5265 66202266 6f6f436f newIORef "fooCo │ │ │ │ + 0x00fd2650 7270220a 3e202020 20207265 7475726e rp".> return │ │ │ │ + 0x00fd2660 20242041 70702068 73206673 20627320 $ App hs fs bs │ │ │ │ + 0x00fd2670 7265660a 0a466f72 206e6f77 20646f6e ref..For now don │ │ │ │ + 0x00fd2680 27742077 6f727279 2061626f 75742061 't worry about a │ │ │ │ + 0x00fd2690 6c6c2074 68652064 65746169 6c73206f ll the details o │ │ │ │ + 0x00fd26a0 66207468 69732063 6f64652e 20205765 f this code. We │ │ │ │ + 0x00fd26b0 276c6c20 776f726b 20746872 6f756768 'll work through │ │ │ │ + 0x00fd26c0 20746865 0a696e64 69766964 75616c20 the.individual │ │ │ │ + 0x00fd26d0 70696563 6573206f 6e652061 74206120 pieces one at a │ │ │ │ + 0x00fd26e0 74696d65 2e202054 68652062 61736963 time. The basic │ │ │ │ + 0x00fd26f0 20696465 61206865 72652069 73207468 idea here is th │ │ │ │ + 0x00fd2700 61742074 6f20696e 69746961 6c697a65 at to initialize │ │ │ │ + 0x00fd2710 20616e0a 6170706c 69636174 696f6e2c an.application, │ │ │ │ + 0x00fd2720 20776520 66697273 7420696e 69746961 we first initia │ │ │ │ + 0x00fd2730 6c697a65 20656163 68206f66 20746865 lize each of the │ │ │ │ + 0x00fd2740 20736e61 706c6574 732c2061 64642073 snaplets, add s │ │ │ │ + 0x00fd2750 6f6d6520 726f7574 65732c20 72756e20 ome routes, run │ │ │ │ + 0x00fd2760 610a6675 6e637469 6f6e2077 72617070 a.function wrapp │ │ │ │ + 0x00fd2770 696e6720 616c6c20 74686520 726f7574 ing all the rout │ │ │ │ + 0x00fd2780 65732c20 616e6420 72657475 726e2074 es, and return t │ │ │ │ + 0x00fd2790 68652072 6573756c 74696e67 20737461 he resulting sta │ │ │ │ + 0x00fd27a0 74652064 6174610a 73747275 63747572 te data.structur │ │ │ │ + 0x00fd27b0 652e2020 54686973 20657861 6d706c65 e. This example │ │ │ │ + 0x00fd27c0 2064656d 6f6e7374 72617465 73207468 demonstrates th │ │ │ │ + 0x00fd27d0 65207573 65206f66 20612066 6577206f e use of a few o │ │ │ │ + 0x00fd27e0 66207468 65206d6f 73742063 6f6d6d6f f the most commo │ │ │ │ + 0x00fd27f0 6e0a736e 61706c65 74206675 6e637469 n.snaplet functi │ │ │ │ + 0x00fd2800 6f6e732e 0a0a6e65 7374536e 61706c65 ons...nestSnaple │ │ │ │ + 0x00fd2810 740a2d2d 2d2d2d2d 2d2d2d2d 2d0a0a41 t.-----------..A │ │ │ │ + 0x00fd2820 6c6c2063 616c6c73 20746f20 6368696c ll calls to chil │ │ │ │ + 0x00fd2830 6420736e 61706c65 7420696e 69746961 d snaplet initia │ │ │ │ + 0x00fd2840 6c697a65 72206675 6e637469 6f6e7320 lizer functions │ │ │ │ + 0x00fd2850 6d757374 20626520 77726170 70656420 must be wrapped │ │ │ │ + 0x00fd2860 696e2061 2063616c 6c20746f 0a6e6573 in a call to.nes │ │ │ │ + 0x00fd2870 74536e61 706c6574 2e202054 68652066 tSnaplet. The f │ │ │ │ + 0x00fd2880 69727374 20706172 616d6574 65722069 irst parameter i │ │ │ │ + 0x00fd2890 73206120 55524c20 70617468 20736567 s a URL path seg │ │ │ │ + 0x00fd28a0 6d656e74 20746861 74206973 20757365 ment that is use │ │ │ │ + 0x00fd28b0 6420746f 20707265 6669780a 616c6c20 d to prefix.all │ │ │ │ + 0x00fd28c0 726f7574 65732064 6566696e 65642062 routes defined b │ │ │ │ + 0x00fd28d0 79207468 6520736e 61706c65 742e2020 y the snaplet. │ │ │ │ + 0x00fd28e0 54686973 206c6574 7320796f 7520656e This lets you en │ │ │ │ + 0x00fd28f0 73757265 20746861 74207468 65726520 sure that there │ │ │ │ + 0x00fd2900 77696c6c 20626520 6e6f0a70 726f626c will be no.probl │ │ │ │ + 0x00fd2910 656d7320 77697468 20647570 6c696361 ems with duplica │ │ │ │ + 0x00fd2920 74652072 6f757465 73206465 66696e65 te routes define │ │ │ │ + 0x00fd2930 6420696e 20646966 66657265 6e742073 d in different s │ │ │ │ + 0x00fd2940 6e61706c 6574732e 20204966 20746865 naplets. If the │ │ │ │ + 0x00fd2950 20666f6f 0a736e61 706c6574 20646566 foo.snaplet def │ │ │ │ + 0x00fd2960 696e6573 20612072 6f757465 20602f66 ines a route `/f │ │ │ │ + 0x00fd2970 6f6f7061 6765602c 20746865 6e20696e oopage`, then in │ │ │ │ + 0x00fd2980 20746865 2061626f 76652065 78616d70 the above examp │ │ │ │ + 0x00fd2990 6c652c20 74686174 20706167 65207769 le, that page wi │ │ │ │ + 0x00fd29a0 6c6c0a62 65206176 61696c61 626c6520 ll.be available │ │ │ │ + 0x00fd29b0 61742060 2f666f6f 2f666f6f 70616765 at `/foo/foopage │ │ │ │ + 0x00fd29c0 602e2020 536f6d65 74696d65 73207468 `. Sometimes th │ │ │ │ + 0x00fd29d0 6f756768 2c20796f 75206d69 67687420 ough, you might │ │ │ │ + 0x00fd29e0 77616e74 20612073 6e61706c 65742773 want a snaplet's │ │ │ │ + 0x00fd29f0 0a726f75 74657320 746f2062 65206176 .routes to be av │ │ │ │ + 0x00fd2a00 61696c61 626c6520 61742074 68652074 ailable at the t │ │ │ │ + 0x00fd2a10 6f70206c 6576656c 2e202054 6f20646f op level. To do │ │ │ │ + 0x00fd2a20 20746861 742c206a 75737420 70617373 that, just pass │ │ │ │ + 0x00fd2a30 20616e20 656d7074 79207374 72696e67 an empty string │ │ │ │ + 0x00fd2a40 0a746f20 6e657374 536e6170 6c657420 .to nestSnaplet │ │ │ │ + 0x00fd2a50 61732073 686f776e 2061626f 76652077 as shown above w │ │ │ │ + 0x00fd2a60 69746820 74686520 62617220 736e6170 ith the bar snap │ │ │ │ + 0x00fd2a70 6c65742e 0a0a496e 206f7572 20657861 let...In our exa │ │ │ │ + 0x00fd2a80 6d706c65 2061626f 76652c20 74686520 mple above, the │ │ │ │ + 0x00fd2a90 62617220 736e6170 6c657420 646f6573 bar snaplet does │ │ │ │ + 0x00fd2aa0 20736f6d 65746869 6e672074 68617420 something that │ │ │ │ + 0x00fd2ab0 6e656564 7320746f 206b6e6f 77206162 needs to know ab │ │ │ │ + 0x00fd2ac0 6f75740a 74686520 666f6f20 736e6170 out.the foo snap │ │ │ │ + 0x00fd2ad0 6c65742e 20204d61 79626520 666f6f20 let. Maybe foo │ │ │ │ + 0x00fd2ae0 69732061 20646174 61626173 6520736e is a database sn │ │ │ │ + 0x00fd2af0 61706c65 7420616e 64206261 72207761 aplet and bar wa │ │ │ │ + 0x00fd2b00 6e747320 746f2073 746f7265 206f720a nts to store or. │ │ │ │ + 0x00fd2b10 72656164 20736f6d 65746869 6e672e20 read something. │ │ │ │ + 0x00fd2b20 20496e20 6f726465 7220746f 206d616b In order to mak │ │ │ │ + 0x00fd2b30 65207468 61742068 61707065 6e2c2069 e that happen, i │ │ │ │ + 0x00fd2b40 74206e65 65647320 746f2068 61766520 t needs to have │ │ │ │ + 0x00fd2b50 61202268 616e646c 65222074 6f0a7468 a "handle" to.th │ │ │ │ + 0x00fd2b60 6520736e 61706c65 742e2020 4f757220 e snaplet. Our │ │ │ │ + 0x00fd2b70 68616e64 6c657320 61726520 77686174 handles are what │ │ │ │ + 0x00fd2b80 65766572 20666965 6c64206e 616d6573 ever field names │ │ │ │ + 0x00fd2b90 20776520 75736564 20696e20 74686520 we used in the │ │ │ │ + 0x00fd2ba0 41707020 64617461 0a737472 75637475 App data.structu │ │ │ │ + 0x00fd2bb0 7265206d 696e7573 20746865 20696e69 re minus the ini │ │ │ │ + 0x00fd2bc0 7469616c 20756e64 65727363 6f726520 tial underscore │ │ │ │ + 0x00fd2bd0 63686172 61637465 722e2020 54686579 character. They │ │ │ │ + 0x00fd2be0 20617265 20617574 6f6d6174 6963616c are automatical │ │ │ │ + 0x00fd2bf0 6c790a67 656e6572 61746564 20627920 ly.generated by │ │ │ │ + 0x00fd2c00 74686520 606d616b 654c656e 73657360 the `makeLenses` │ │ │ │ + 0x00fd2c10 2066756e 6374696f 6e2e2020 466f7220 function. For │ │ │ │ + 0x00fd2c20 6e6f7720 69742773 20737566 66696369 now it's suffici │ │ │ │ + 0x00fd2c30 656e7420 746f2074 68696e6b 206f660a ent to think of. │ │ │ │ + 0x00fd2c40 7468656d 20617320 61206765 74746572 them as a getter │ │ │ │ + 0x00fd2c50 20616e64 20612073 65747465 7220636f and a setter co │ │ │ │ + 0x00fd2c60 6d62696e 65642028 746f2075 73652061 mbined (to use a │ │ │ │ + 0x00fd2c70 6e204f4f 206d6574 6170686f 72292e0a n OO metaphor).. │ │ │ │ + 0x00fd2c80 0a546865 20736563 6f6e6420 70617261 .The second para │ │ │ │ + 0x00fd2c90 6d657465 7220746f 206e6573 74536e61 meter to nestSna │ │ │ │ + 0x00fd2ca0 706c6574 20697320 74686520 6c656e73 plet is the lens │ │ │ │ + 0x00fd2cb0 20746f20 74686520 736e6170 6c657420 to the snaplet │ │ │ │ + 0x00fd2cc0 796f7527 7265206e 65737469 6e672e0a you're nesting.. │ │ │ │ + 0x00fd2cd0 496e206f 72646572 20746f20 706c6163 In order to plac │ │ │ │ + 0x00fd2ce0 65206120 70696563 6520696e 746f2074 e a piece into t │ │ │ │ + 0x00fd2cf0 68652070 757a7a6c 652c2079 6f75206e he puzzle, you n │ │ │ │ + 0x00fd2d00 65656420 746f206b 6e6f7720 77686572 eed to know wher │ │ │ │ + 0x00fd2d10 65206974 20676f65 732e0a0a 6e616d65 e it goes...name │ │ │ │ + 0x00fd2d20 536e6170 6c65740a 2d2d2d2d 2d2d2d2d Snaplet.-------- │ │ │ │ + 0x00fd2d30 2d2d2d0a 0a546865 20617574 686f7220 ---..The author │ │ │ │ + 0x00fd2d40 6f662061 20736e61 706c6574 20646566 of a snaplet def │ │ │ │ + 0x00fd2d50 696e6573 20612064 65666175 6c74206e ines a default n │ │ │ │ + 0x00fd2d60 616d6520 666f7220 74686520 736e6170 ame for the snap │ │ │ │ + 0x00fd2d70 6c657420 696e2074 68652066 69727374 let in the first │ │ │ │ + 0x00fd2d80 0a617267 756d656e 7420746f 20746865 .argument to the │ │ │ │ + 0x00fd2d90 206d616b 65536e61 706c6574 2066756e makeSnaplet fun │ │ │ │ + 0x00fd2da0 6374696f 6e2e2020 54686973 206e616d ction. This nam │ │ │ │ + 0x00fd2db0 65206973 20757365 6420666f 72207468 e is used for th │ │ │ │ + 0x00fd2dc0 6520736e 61706c65 7427730a 64697265 e snaplet's.dire │ │ │ │ + 0x00fd2dd0 63746f72 7920696e 20746865 2066696c ctory in the fil │ │ │ │ + 0x00fd2de0 65737973 74656d2e 20204966 20796f75 esystem. If you │ │ │ │ + 0x00fd2df0 20646f6e 27742077 616e7420 746f2075 don't want to u │ │ │ │ + 0x00fd2e00 73652074 68652064 65666175 6c74206e se the default n │ │ │ │ + 0x00fd2e10 616d652c 20796f75 0a63616e 206f7665 ame, you.can ove │ │ │ │ + 0x00fd2e20 72726964 65206974 20776974 68207468 rride it with th │ │ │ │ + 0x00fd2e30 6520606e 616d6553 6e61706c 65746020 e `nameSnaplet` │ │ │ │ + 0x00fd2e40 66756e63 74696f6e 2e202041 6c736f2c function. Also, │ │ │ │ + 0x00fd2e50 20696620 796f7520 77616e74 20746f20 if you want to │ │ │ │ + 0x00fd2e60 68617665 2074776f 0a696e73 74616e63 have two.instanc │ │ │ │ + 0x00fd2e70 6573206f 66207468 65207361 6d652073 es of the same s │ │ │ │ + 0x00fd2e80 6e61706c 65742c20 7468656e 20796f75 naplet, then you │ │ │ │ + 0x00fd2e90 2077696c 6c206e65 65642074 6f207573 will need to us │ │ │ │ + 0x00fd2ea0 6520606e 616d6553 6e61706c 65746020 e `nameSnaplet` │ │ │ │ + 0x00fd2eb0 746f2067 6976650a 6174206c 65617374 to give.at least │ │ │ │ + 0x00fd2ec0 206f6e65 206f6620 7468656d 20612075 one of them a u │ │ │ │ + 0x00fd2ed0 6e697175 65206e61 6d652e0a 0a616464 nique name...add │ │ │ │ + 0x00fd2ee0 526f7574 65730a2d 2d2d2d2d 2d2d2d2d Routes.--------- │ │ │ │ + 0x00fd2ef0 0a0a5468 65206061 6464526f 75746573 ..The `addRoutes │ │ │ │ + 0x00fd2f00 60206675 6e637469 6f6e2069 7320686f ` function is ho │ │ │ │ + 0x00fd2f10 7720616e 20617070 6c696361 74696f6e w an application │ │ │ │ + 0x00fd2f20 20286f72 20736e61 706c6574 29206465 (or snaplet) de │ │ │ │ + 0x00fd2f30 66696e65 73206974 730a726f 75746573 fines its.routes │ │ │ │ + 0x00fd2f40 2e202055 6e646572 20746865 20686f6f . Under the hoo │ │ │ │ + 0x00fd2f50 64207468 6520736e 61706c65 7420696e d the snaplet in │ │ │ │ + 0x00fd2f60 66726173 74727563 74757265 206d6572 frastructure mer │ │ │ │ + 0x00fd2f70 67657320 616c6c20 74686520 726f7574 ges all the rout │ │ │ │ + 0x00fd2f80 65732066 726f6d0a 616c6c20 736e6170 es from.all snap │ │ │ │ + 0x00fd2f90 6c657473 2c207072 6570656e 64732070 lets, prepends p │ │ │ │ + 0x00fd2fa0 72656669 78657320 66726f6d 20606e65 refixes from `ne │ │ │ │ + 0x00fd2fb0 7374536e 61706c65 74602063 616c6c73 stSnaplet` calls │ │ │ │ + 0x00fd2fc0 2c20616e 64207061 73736573 20746865 , and passes the │ │ │ │ + 0x00fd2fd0 206c6973 740a746f 20536e61 7027730a list.to Snap's. │ │ │ │ + 0x00fd2fe0 5b726f75 74655d28 68747470 3a2f2f68 [route](http://h │ │ │ │ + 0x00fd2ff0 61636b61 67652e68 61736b65 6c6c2e6f ackage.haskell.o │ │ │ │ + 0x00fd3000 72672f70 61636b61 6765732f 61726368 rg/packages/arch │ │ │ │ + 0x00fd3010 6976652f 736e6170 2d636f72 652f302e ive/snap-core/0. │ │ │ │ + 0x00fd3020 352e312e 342f646f 632f6874 6d6c2f53 5.1.4/doc/html/S │ │ │ │ + 0x00fd3030 6e61702d 54797065 732e6874 6d6c2376 nap-Types.html#v │ │ │ │ + 0x00fd3040 3a726f75 7465290a 66756e63 74696f6e :route).function │ │ │ │ + 0x00fd3050 2e0a0a41 20726f75 74652069 73206120 ...A route is a │ │ │ │ + 0x00fd3060 7475706c 65206f66 20612055 524c2061 tuple of a URL a │ │ │ │ + 0x00fd3070 6e642061 2068616e 646c6572 2066756e nd a handler fun │ │ │ │ + 0x00fd3080 6374696f 6e207468 61742077 696c6c20 ction that will │ │ │ │ + 0x00fd3090 62652063 616c6c65 64207768 656e0a74 be called when.t │ │ │ │ + 0x00fd30a0 68652055 524c2069 73207265 71756573 he URL is reques │ │ │ │ + 0x00fd30b0 7465642e 20204861 6e646c65 72206973 ted. Handler is │ │ │ │ + 0x00fd30c0 20612077 72617070 65722061 726f756e a wrapper aroun │ │ │ │ + 0x00fd30d0 64207468 6520536e 6170206d 6f6e6164 d the Snap monad │ │ │ │ + 0x00fd30e0 20746861 74206861 6e646c65 730a7468 that handles.th │ │ │ │ + 0x00fd30f0 6520736e 61706c65 74277320 696e6672 e snaplet's infr │ │ │ │ + 0x00fd3100 61737472 75637475 72652e20 20447572 astructure. Dur │ │ │ │ + 0x00fd3110 696e6720 696e6974 69616c69 7a617469 ing initializati │ │ │ │ + 0x00fd3120 6f6e2c20 736e6170 6c657473 20757365 on, snaplets use │ │ │ │ + 0x00fd3130 20746865 0a60496e 69746961 6c697a65 the.`Initialize │ │ │ │ + 0x00fd3140 7260206d 6f6e6164 2e202044 7572696e r` monad. Durin │ │ │ │ + 0x00fd3150 67207275 6e74696d 652c2074 68657920 g runtime, they │ │ │ │ + 0x00fd3160 75736520 74686520 6048616e 646c6572 use the `Handler │ │ │ │ + 0x00fd3170 60206d6f 6e61642e 20205765 276c6c0a ` monad. We'll. │ │ │ │ + 0x00fd3180 64697363 75737320 6048616e 646c6572 discuss `Handler │ │ │ │ + 0x00fd3190 6020696e 206d6f72 65206465 7461696c ` in more detail │ │ │ │ + 0x00fd31a0 206c6174 65722e20 20496620 796f7527 later. If you' │ │ │ │ + 0x00fd31b0 72652066 616d696c 69617220 77697468 re familiar with │ │ │ │ + 0x00fd31c0 20536e61 70277320 6f6c640a 65787465 Snap's old.exte │ │ │ │ + 0x00fd31d0 6e73696f 6e207379 7374656d 2c20796f nsion system, yo │ │ │ │ + 0x00fd31e0 75206361 6e207468 696e6b20 6f662069 u can think of i │ │ │ │ + 0x00fd31f0 74206173 20726f75 67686c79 20657175 t as roughly equ │ │ │ │ + 0x00fd3200 6976616c 656e7420 746f2074 68652041 ivalent to the A │ │ │ │ + 0x00fd3210 70706c69 63617469 6f6e0a6d 6f6e6164 pplication.monad │ │ │ │ + 0x00fd3220 2e202049 74206861 73206120 604d6f6e . It has a `Mon │ │ │ │ + 0x00fd3230 61645374 61746560 20696e73 74616e63 adState` instanc │ │ │ │ + 0x00fd3240 65207468 6174206c 65747320 796f7520 e that lets you │ │ │ │ + 0x00fd3250 61636365 73732061 6e64206d 6f646966 access and modif │ │ │ │ + 0x00fd3260 79207468 650a6375 7272656e 7420736e y the.current sn │ │ │ │ + 0x00fd3270 61706c65 74277320 73746174 652c2061 aplet's state, a │ │ │ │ + 0x00fd3280 6e642061 20604d6f 6e616453 6e617060 nd a `MonadSnap` │ │ │ │ + 0x00fd3290 20696e73 74616e63 65207072 6f766964 instance provid │ │ │ │ + 0x00fd32a0 696e6720 7468650a 72657175 6573742d ing the.request- │ │ │ │ + 0x00fd32b0 70726f63 65737369 6e672066 756e6374 processing funct │ │ │ │ + 0x00fd32c0 696f6e73 20646566 696e6564 20696e20 ions defined in │ │ │ │ + 0x00fd32d0 536e6170 2e547970 65732e0a 0a777261 Snap.Types...wra │ │ │ │ + 0x00fd32e0 70536974 650a2d2d 2d2d2d2d 2d2d2d2d pSite.---------- │ │ │ │ + 0x00fd32f0 2d2d0a0a 60777261 70536974 65602061 --..`wrapSite` a │ │ │ │ + 0x00fd3300 6c6c6f77 7320796f 7520746f 20617070 llows you to app │ │ │ │ + 0x00fd3310 6c792061 6e206172 62697472 61727920 ly an arbitrary │ │ │ │ + 0x00fd3320 6048616e 646c6572 60207472 616e7366 `Handler` transf │ │ │ │ + 0x00fd3330 6f726d61 74696f6e 20746f0a 74686520 ormation to.the │ │ │ │ + 0x00fd3340 746f702d 6c657665 6c206861 6e646c65 top-level handle │ │ │ │ + 0x00fd3350 722e2020 54686973 20697320 75736566 r. This is usef │ │ │ │ + 0x00fd3360 756c2069 6620796f 75207761 6e742074 ul if you want t │ │ │ │ + 0x00fd3370 6f20646f 20736f6d 65206765 6e657269 o do some generi │ │ │ │ + 0x00fd3380 630a7072 6f636573 73696e67 20617420 c.processing at │ │ │ │ + 0x00fd3390 74686520 62656769 6e6e696e 67206f72 the beginning or │ │ │ │ + 0x00fd33a0 20656e64 206f6620 65766572 79207265 end of every re │ │ │ │ + 0x00fd33b0 71756573 742e2020 466f7220 696e7374 quest. For inst │ │ │ │ + 0x00fd33c0 616e6365 2c206120 73657373 696f6e0a ance, a session. │ │ │ │ + 0x00fd33d0 736e6170 6c657420 6d696768 74207573 snaplet might us │ │ │ │ + 0x00fd33e0 65206974 20746f20 746f7563 68206120 e it to touch a │ │ │ │ + 0x00fd33f0 73657373 696f6e20 61637469 76697479 session activity │ │ │ │ + 0x00fd3400 20746f6b 656e2062 65666f72 6520726f token before ro │ │ │ │ + 0x00fd3410 7574696e 67206861 7070656e 732e0a49 uting happens..I │ │ │ │ + 0x00fd3420 7420636f 756c6420 616c736f 20626520 t could also be │ │ │ │ + 0x00fd3430 75736564 20746f20 696d706c 656d656e used to implemen │ │ │ │ + 0x00fd3440 74206375 73746f6d 206c6f67 67696e67 t custom logging │ │ │ │ + 0x00fd3450 2e202054 68652065 78616d70 6c652061 . The example a │ │ │ │ + 0x00fd3460 626f7665 20757365 73206974 0a746f20 bove uses it.to │ │ │ │ + 0x00fd3470 64656669 6e652068 65697374 53657276 define heistServ │ │ │ │ + 0x00fd3480 65202870 726f7669 64656420 62792074 e (provided by t │ │ │ │ + 0x00fd3490 68652048 65697374 20736e61 706c6574 he Heist snaplet │ │ │ │ + 0x00fd34a0 29206173 20746865 20646566 61756c74 ) as the default │ │ │ │ + 0x00fd34b0 2068616e 646c6572 20746f0a 62652074 handler to.be t │ │ │ │ + 0x00fd34c0 72696564 20696620 6e6f206f 74686572 ried if no other │ │ │ │ + 0x00fd34d0 2068616e 646c6572 206d6174 63686564 handler matched │ │ │ │ + 0x00fd34e0 2e202054 68697320 6d617920 7365656d . This may seem │ │ │ │ + 0x00fd34f0 206c696b 6520616e 20656173 79207761 like an easy wa │ │ │ │ + 0x00fd3500 7920746f 20646566 696e650a 726f7574 y to define.rout │ │ │ │ + 0x00fd3510 65732c20 62757420 69662079 6f752073 es, but if you s │ │ │ │ + 0x00fd3520 7472696e 67207468 656d2061 6c6c2074 tring them all t │ │ │ │ + 0x00fd3530 6f676574 68657220 696e2074 68697320 ogether in this │ │ │ │ + 0x00fd3540 77617920 65616368 2068616e 646c6572 way each handler │ │ │ │ + 0x00fd3550 2077696c 6c206265 0a657661 6c756174 will be.evaluat │ │ │ │ + 0x00fd3560 65642073 65717565 6e746961 6c6c7920 ed sequentially │ │ │ │ + 0x00fd3570 616e6420 796f7527 6c6c2067 6574204f and you'll get O │ │ │ │ + 0x00fd3580 286e2920 74696d65 20636f6d 706c6578 (n) time complex │ │ │ │ + 0x00fd3590 6974792c 20776865 72656173 20726f75 ity, whereas rou │ │ │ │ + 0x00fd35a0 7465730a 64656669 6e656420 77697468 tes.defined with │ │ │ │ + 0x00fd35b0 20606164 64526f75 74657360 20686176 `addRoutes` hav │ │ │ │ + 0x00fd35c0 65204f28 6c6f6720 6e292074 696d6520 e O(log n) time │ │ │ │ + 0x00fd35d0 636f6d70 6c657869 74792e20 20546865 complexity. The │ │ │ │ + 0x00fd35e0 7265666f 72652c20 696e2061 0a726561 refore, in a.rea │ │ │ │ + 0x00fd35f0 6c2d776f 726c6420 6170706c 69636174 l-world applicat │ │ │ │ + 0x00fd3600 696f6e20 796f7520 776f756c 64207072 ion you would pr │ │ │ │ + 0x00fd3610 6f626162 6c792077 616e7420 746f2068 obably want to h │ │ │ │ + 0x00fd3620 61766520 60282222 2c206865 69737453 ave `("", heistS │ │ │ │ + 0x00fd3630 65727665 29602069 6e0a7468 65206c69 erve)` in.the li │ │ │ │ + 0x00fd3640 73742070 61737365 6420746f 20606164 st passed to `ad │ │ │ │ + 0x00fd3650 64526f75 74657360 2e0a0a77 6974680a dRoutes`...with. │ │ │ │ + 0x00fd3660 2d2d2d2d 0a0a5468 65206c61 73742075 ----..The last u │ │ │ │ + 0x00fd3670 6e66616d 696c6961 72206675 6e637469 nfamiliar functi │ │ │ │ + 0x00fd3680 6f6e2069 6e207468 65206578 616d706c on in the exampl │ │ │ │ + 0x00fd3690 65206973 20607769 7468602e 20204865 e is `with`. He │ │ │ │ + 0x00fd36a0 72652069 74206163 636f6d70 616e6965 re it accompanie │ │ │ │ + 0x00fd36b0 7320610a 63616c6c 20746f20 74686520 s a.call to the │ │ │ │ + 0x00fd36c0 66756e63 74696f6e 20606e61 6d655061 function `namePa │ │ │ │ + 0x00fd36d0 6765602e 2020606e 616d6550 61676560 ge`. `namePage` │ │ │ │ + 0x00fd36e0 20697320 61207369 6d706c65 20657861 is a simple exa │ │ │ │ + 0x00fd36f0 6d706c65 2068616e 646c6572 20616e64 mple handler and │ │ │ │ + 0x00fd3700 0a6c6f6f 6b73206c 696b6520 74686973 .looks like this │ │ │ │ + 0x00fd3710 2e0a0a3e 206e616d 65506167 65203a3a ...> namePage :: │ │ │ │ + 0x00fd3720 2048616e 646c6572 20622076 2028290a Handler b v (). │ │ │ │ + 0x00fd3730 3e206e61 6d655061 6765203d 20646f0a > namePage = do. │ │ │ │ + 0x00fd3740 3e202020 20206d6e 616d6520 3c2d2067 > mname <- g │ │ │ │ + 0x00fd3750 6574536e 61706c65 744e616d 650a3e20 etSnapletName.> │ │ │ │ + 0x00fd3760 20202020 77726974 65546578 74202420 writeText $ │ │ │ │ + 0x00fd3770 66726f6d 4d617962 65202254 68697320 fromMaybe "This │ │ │ │ + 0x00fd3780 73686f75 6c646e27 74206861 7070656e shouldn't happen │ │ │ │ + 0x00fd3790 22206d6e 616d650a 0a546869 73206675 " mname..This fu │ │ │ │ + 0x00fd37a0 6e637469 6f6e2069 73206120 67656e65 nction is a gene │ │ │ │ + 0x00fd37b0 72696320 68616e64 6c657220 74686174 ric handler that │ │ │ │ + 0x00fd37c0 20676574 73207468 65206e61 6d65206f gets the name o │ │ │ │ + 0x00fd37d0 66207468 65206375 7272656e 7420736e f the current sn │ │ │ │ + 0x00fd37e0 61706c65 740a616e 64207772 69746573 aplet.and writes │ │ │ │ + 0x00fd37f0 20697420 696e746f 20746865 20726573 it into the res │ │ │ │ + 0x00fd3800 706f6e73 65207769 74682074 68652060 ponse with the ` │ │ │ │ + 0x00fd3810 77726974 65546578 74602066 756e6374 writeText` funct │ │ │ │ + 0x00fd3820 696f6e20 64656669 6e656420 62792074 ion defined by t │ │ │ │ + 0x00fd3830 68650a73 6e61702d 636f7265 2070726f he.snap-core pro │ │ │ │ + 0x00fd3840 6a656374 2e202054 68652074 79706520 ject. The type │ │ │ │ + 0x00fd3850 76617269 61626c65 73202762 2720616e variables 'b' an │ │ │ │ + 0x00fd3860 64202776 2720696e 64696361 74652074 d 'v' indicate t │ │ │ │ + 0x00fd3870 68617420 74686973 2066756e 6374696f hat this functio │ │ │ │ + 0x00fd3880 6e0a7769 6c6c2077 6f726b20 696e2061 n.will work in a │ │ │ │ + 0x00fd3890 6e792073 6e61706c 65742077 69746820 ny snaplet with │ │ │ │ + 0x00fd38a0 616e7920 62617365 20617070 6c696361 any base applica │ │ │ │ + 0x00fd38b0 74696f6e 2e202054 68652027 77697468 tion. The 'with │ │ │ │ + 0x00fd38c0 27206675 6e637469 6f6e2069 730a7573 ' function is.us │ │ │ │ + 0x00fd38d0 65642074 6f207275 6e20606e 616d6550 ed to run `nameP │ │ │ │ + 0x00fd38e0 61676560 20696e20 74686520 636f6e74 age` in the cont │ │ │ │ + 0x00fd38f0 65787420 6f662074 68652073 6e61706c ext of the snapl │ │ │ │ + 0x00fd3900 65747320 666f6f20 616e6420 62617220 ets foo and bar │ │ │ │ + 0x00fd3910 666f7220 7468650a 636f7272 6573706f for the.correspo │ │ │ │ + 0x00fd3920 6e64696e 6720726f 75746573 2e0a0a53 nding routes...S │ │ │ │ + 0x00fd3930 69746520 52656c6f 6164696e 670a2d2d ite Reloading.-- │ │ │ │ + 0x00fd3940 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a0a536e ------------..Sn │ │ │ │ + 0x00fd3950 61706c65 7420496e 69746961 6c697a65 aplet Initialize │ │ │ │ + 0x00fd3960 72732073 65727665 20647561 6c207075 rs serve dual pu │ │ │ │ + 0x00fd3970 72706f73 65206173 20626f74 6820696e rpose as both in │ │ │ │ + 0x00fd3980 69746961 6c697a65 72732061 6e642072 itializers and r │ │ │ │ + 0x00fd3990 656c6f61 64657273 2e0a5265 6c6f6164 eloaders..Reload │ │ │ │ + 0x00fd39a0 73206172 65207472 69676765 72656420 s are triggered │ │ │ │ + 0x00fd39b0 62792061 20737065 6369616c 2068616e by a special han │ │ │ │ + 0x00fd39c0 646c6572 20746861 74206973 20626f75 dler that is bou │ │ │ │ + 0x00fd39d0 6e642074 6f207468 650a602f 61646d69 nd to the.`/admi │ │ │ │ + 0x00fd39e0 6e2f7265 6c6f6164 6020726f 7574652e n/reload` route. │ │ │ │ + 0x00fd39f0 20205468 69732068 616e646c 65722072 This handler r │ │ │ │ + 0x00fd3a00 652d7275 6e732074 68652073 69746520 e-runs the site │ │ │ │ + 0x00fd3a10 696e6974 69616c69 7a657220 616e6420 initializer and │ │ │ │ + 0x00fd3a20 69662069 74206973 0a737563 63657373 if it is.success │ │ │ │ + 0x00fd3a30 66756c2c 206c6f61 64732074 6865206e ful, loads the n │ │ │ │ + 0x00fd3a40 65776c79 2067656e 65726174 65642069 ewly generated i │ │ │ │ + 0x00fd3a50 6e2d6d65 6d6f7279 20737461 74652e20 n-memory state. │ │ │ │ + 0x00fd3a60 20546f20 70726576 656e7420 64656e69 To prevent deni │ │ │ │ + 0x00fd3a70 616c206f 660a7365 72766963 65206174 al of.service at │ │ │ │ + 0x00fd3a80 7461636b 732c2074 68652072 656c6f61 tacks, the reloa │ │ │ │ + 0x00fd3a90 6420726f 75746520 6973206f 6e6c7920 d route is only │ │ │ │ + 0x00fd3aa0 61636365 73736962 6c652066 726f6d20 accessible from │ │ │ │ + 0x00fd3ab0 6c6f6361 6c686f73 742e0a0a 49662074 localhost...If t │ │ │ │ + 0x00fd3ac0 68657265 20617265 20616e79 20657272 here are any err │ │ │ │ + 0x00fd3ad0 6f727320 64757269 6e672072 656c6f61 ors during reloa │ │ │ │ + 0x00fd3ae0 642c2079 6f752077 6f756c64 206e6174 d, you would nat │ │ │ │ + 0x00fd3af0 7572616c 6c792077 616e7420 746f2073 urally want to s │ │ │ │ + 0x00fd3b00 65652074 68656d20 696e0a74 68652048 ee them in.the H │ │ │ │ + 0x00fd3b10 54545020 72657370 6f6e7365 20726574 TTP response ret │ │ │ │ + 0x00fd3b20 75726e65 64206279 20746865 20736572 urned by the ser │ │ │ │ + 0x00fd3b30 7665722e 2020486f 77657665 722c2077 ver. However, w │ │ │ │ + 0x00fd3b40 68656e20 74686573 65207361 6d650a69 hen these same.i │ │ │ │ + 0x00fd3b50 6e697469 616c697a 65727320 61726520 nitializers are │ │ │ │ + 0x00fd3b60 72756e20 7768656e 20796f75 20666972 run when you fir │ │ │ │ + 0x00fd3b70 73742073 74617274 20796f75 72206170 st start your ap │ │ │ │ + 0x00fd3b80 702c2079 6f752077 696c6c20 77616e74 p, you will want │ │ │ │ + 0x00fd3b90 20746f20 7365650a 73746174 7573206d to see.status m │ │ │ │ + 0x00fd3ba0 65737361 67657320 7072696e 74656420 essages printed │ │ │ │ + 0x00fd3bb0 746f2074 68652063 6f6e736f 6c652e20 to the console. │ │ │ │ + 0x00fd3bc0 20546f20 6d616b65 20746869 7320706f To make this po │ │ │ │ + 0x00fd3bd0 73736962 6c652077 65207072 6f766964 ssible we provid │ │ │ │ + 0x00fd3be0 65207468 650a6070 72696e74 496e666f e the.`printInfo │ │ │ │ + 0x00fd3bf0 60206675 6e637469 6f6e2e20 20596f75 ` function. You │ │ │ │ + 0x00fd3c00 2073686f 756c6420 75736520 69742074 should use it t │ │ │ │ + 0x00fd3c10 6f206f75 74707574 20616e79 20696e66 o output any inf │ │ │ │ + 0x00fd3c20 6f726d61 74696f6e 616c206d 65737361 ormational messa │ │ │ │ + 0x00fd3c30 6765730a 67656e65 72617465 64206279 ges.generated by │ │ │ │ + 0x00fd3c40 20796f75 7220696e 69746961 6c697a65 your initialize │ │ │ │ + 0x00fd3c50 72732e20 20496620 796f7520 7072696e rs. If you prin │ │ │ │ + 0x00fd3c60 74206469 72656374 6c792074 6f207374 t directly to st │ │ │ │ + 0x00fd3c70 616e6461 7264206f 75747075 74206f72 andard output or │ │ │ │ + 0x00fd3c80 0a737461 6e646172 64206572 726f722c .standard error, │ │ │ │ + 0x00fd3c90 20746865 6e207468 6f736520 6d657373 then those mess │ │ │ │ + 0x00fd3ca0 61676573 2077696c 6c206e6f 74206265 ages will not be │ │ │ │ + 0x00fd3cb0 20617661 696c6162 6c652069 6e20796f available in yo │ │ │ │ + 0x00fd3cc0 75722062 726f7773 65722077 68656e0a ur browser when. │ │ │ │ + 0x00fd3cd0 796f7520 72656c6f 61642074 68652073 you reload the s │ │ │ │ + 0x00fd3ce0 6974652e 0a0a576f 726b696e 67207769 ite...Working wi │ │ │ │ + 0x00fd3cf0 74682073 74617465 0a2d2d2d 2d2d2d2d th state.------- │ │ │ │ + 0x00fd3d00 2d2d2d2d 2d2d2d2d 2d2d2d0a 0a604861 -----------..`Ha │ │ │ │ + 0x00fd3d10 6e646c65 72206220 76602068 61732061 ndler b v` has a │ │ │ │ + 0x00fd3d20 20604d6f 6e616453 74617465 20766020 `MonadState v` │ │ │ │ + 0x00fd3d30 696e7374 616e6365 2e202054 68697320 instance. This │ │ │ │ + 0x00fd3d40 6d65616e 73207468 61742079 6f752063 means that you c │ │ │ │ + 0x00fd3d50 616e2061 63636573 730a616c 6c20796f an access.all yo │ │ │ │ + 0x00fd3d60 75722073 6e61706c 65742073 74617465 ur snaplet state │ │ │ │ + 0x00fd3d70 20746872 6f756768 20746865 20676574 through the get │ │ │ │ + 0x00fd3d80 2c207075 742c2067 6574732c 20616e64 , put, gets, and │ │ │ │ + 0x00fd3d90 206d6f64 69667920 66756e63 74696f6e modify function │ │ │ │ + 0x00fd3da0 73207468 61740a61 72652070 726f6261 s that.are proba │ │ │ │ + 0x00fd3db0 626c7920 66616d69 6c696172 2066726f bly familiar fro │ │ │ │ + 0x00fd3dc0 6d207468 65207374 61746520 6d6f6e61 m the state mona │ │ │ │ + 0x00fd3dd0 642e2020 496e206f 75722065 78616d70 d. In our examp │ │ │ │ + 0x00fd3de0 6c652061 70706c69 63617469 6f6e2077 le application w │ │ │ │ + 0x00fd3df0 650a6465 6d6f6e73 74726174 65207468 e.demonstrate th │ │ │ │ + 0x00fd3e00 69732077 69746820 60636f6d 70616e79 is with `company │ │ │ │ + 0x00fd3e10 48616e64 6c657260 2e0a0a3e 20636f6d Handler`...> com │ │ │ │ + 0x00fd3e20 70616e79 48616e64 6c657220 3a3a2048 panyHandler :: H │ │ │ │ + 0x00fd3e30 616e646c 65722041 70702041 70702028 andler App App ( │ │ │ │ + 0x00fd3e40 290a3e20 636f6d70 616e7948 616e646c ).> companyHandl │ │ │ │ + 0x00fd3e50 6572203d 206d6574 686f6420 47455420 er = method GET │ │ │ │ + 0x00fd3e60 67657474 6572203c 7c3e206d 6574686f getter <|> metho │ │ │ │ + 0x00fd3e70 6420504f 53542073 65747465 720a3e20 d POST setter.> │ │ │ │ + 0x00fd3e80 20207768 6572650a 3e202020 20206765 where.> ge │ │ │ │ + 0x00fd3e90 74746572 203d2064 6f0a3e20 20202020 tter = do.> │ │ │ │ + 0x00fd3ea0 20202020 6e616d65 52656620 3c2d2067 nameRef <- g │ │ │ │ + 0x00fd3eb0 65747320 5f636f6d 70616e79 4e616d65 ets _companyName │ │ │ │ + 0x00fd3ec0 0a3e2020 20202020 2020206e 616d6520 .> name │ │ │ │ + 0x00fd3ed0 3c2d206c 69667449 4f202420 72656164 <- liftIO $ read │ │ │ │ + 0x00fd3ee0 494f5265 66206e61 6d655265 660a3e20 IORef nameRef.> │ │ │ │ + 0x00fd3ef0 20202020 20202020 77726974 65425320 writeBS │ │ │ │ + 0x00fd3f00 6e616d65 0a3e2020 20202073 65747465 name.> sette │ │ │ │ + 0x00fd3f10 72203d20 646f0a3e 20202020 20202020 r = do.> │ │ │ │ + 0x00fd3f20 206d6e61 6d65203c 2d206765 74506172 mname <- getPar │ │ │ │ + 0x00fd3f30 616d2022 6e616d65 220a3e20 20202020 am "name".> │ │ │ │ + 0x00fd3f40 20202020 6e616d65 52656620 3c2d2067 nameRef <- g │ │ │ │ + 0x00fd3f50 65747320 5f636f6d 70616e79 4e616d65 ets _companyName │ │ │ │ + 0x00fd3f60 0a3e2020 20202020 2020206c 69667449 .> liftI │ │ │ │ + 0x00fd3f70 4f202420 6d617962 65202872 65747572 O $ maybe (retur │ │ │ │ + 0x00fd3f80 6e202829 29202877 72697465 494f5265 n ()) (writeIORe │ │ │ │ + 0x00fd3f90 66206e61 6d655265 6629206d 6e616d65 f nameRef) mname │ │ │ │ + 0x00fd3fa0 0a3e2020 20202020 20202067 65747465 .> gette │ │ │ │ + 0x00fd3fb0 720a0a49 6620796f 75207365 74206120 r..If you set a │ │ │ │ + 0x00fd3fc0 47455420 72657175 65737420 746f2060 GET request to ` │ │ │ │ + 0x00fd3fd0 2f636f6d 70616e79 602c2079 6f75276c /company`, you'l │ │ │ │ + 0x00fd3fe0 6c206765 74207468 65207374 72696e67 l get the string │ │ │ │ + 0x00fd3ff0 2022666f 6f436f72 70222062 61636b2e "fooCorp" back. │ │ │ │ + 0x00fd4000 0a496620 796f7520 73656e64 20612050 .If you send a P │ │ │ │ + 0x00fd4010 4f535420 72657175 6573742c 20697420 OST request, it │ │ │ │ + 0x00fd4020 77696c6c 20736574 20746865 20494f52 will set the IOR │ │ │ │ + 0x00fd4030 65662068 656c6420 696e2074 68652060 ef held in the ` │ │ │ │ + 0x00fd4040 5f636f6d 70616e79 4e616d65 600a6669 _companyName`.fi │ │ │ │ + 0x00fd4050 656c6420 696e2074 68652060 41707060 eld in the `App` │ │ │ │ + 0x00fd4060 20646174 61207374 72756374 75726520 data structure │ │ │ │ + 0x00fd4070 746f2074 68652076 616c7565 206f6620 to the value of │ │ │ │ + 0x00fd4080 74686520 606e616d 65602066 69656c64 the `name` field │ │ │ │ + 0x00fd4090 2e202054 68656e20 69740a63 616c6c73 . Then it.calls │ │ │ │ + 0x00fd40a0 20746865 20676574 74657220 746f2072 the getter to r │ │ │ │ + 0x00fd40b0 65747572 6e207468 61742076 616c7565 eturn that value │ │ │ │ + 0x00fd40c0 20626163 6b20746f 20796f75 20736f20 back to you so │ │ │ │ + 0x00fd40d0 796f7520 63616e20 73656520 69742077 you can see it w │ │ │ │ + 0x00fd40e0 61730a61 63747561 6c6c7920 6368616e as.actually chan │ │ │ │ + 0x00fd40f0 6765642e 20204167 61696e2c 2072656d ged. Again, rem │ │ │ │ + 0x00fd4100 656d6265 72207468 61742074 68697320 ember that this │ │ │ │ + 0x00fd4110 6368616e 6765206f 6e6c7920 70657273 change only pers │ │ │ │ + 0x00fd4120 69737473 20616372 6f73730a 72657175 ists across.requ │ │ │ │ + 0x00fd4130 65737473 20626563 61757365 20776520 ests because we │ │ │ │ + 0x00fd4140 75736564 20616e20 494f5265 662e2020 used an IORef. │ │ │ │ + 0x00fd4150 49662060 5f636f6d 70616e79 4e616d65 If `_companyName │ │ │ │ + 0x00fd4160 60207761 73206a75 73742061 20706c61 ` was just a pla │ │ │ │ + 0x00fd4170 696e2073 7472696e 670a616e 64207765 in string.and we │ │ │ │ + 0x00fd4180 20686164 20757365 64206d6f 64696679 had used modify │ │ │ │ + 0x00fd4190 2c207468 65206368 616e6765 64207265 , the changed re │ │ │ │ + 0x00fd41a0 73756c74 20776f75 6c64206f 6e6c7920 sult would only │ │ │ │ + 0x00fd41b0 62652076 69736962 6c652069 6e207468 be visible in th │ │ │ │ + 0x00fd41c0 65207265 73740a6f 66207468 65207072 e rest.of the pr │ │ │ │ + 0x00fd41d0 6f636573 73696e67 20666f72 20746861 ocessing for tha │ │ │ │ + 0x00fd41e0 74207265 71756573 742e0a0a 54686520 t request...The │ │ │ │ + 0x00fd41f0 48656973 7420536e 61706c65 740a3d3d Heist Snaplet.== │ │ │ │ + 0x00fd4200 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d0a ===============. │ │ │ │ + 0x00fd4210 0a546865 20617374 75746520 72656164 .The astute read │ │ │ │ + 0x00fd4220 6572206d 69676874 2061736b 20776879 er might ask why │ │ │ │ + 0x00fd4230 20746865 72652069 73206e6f 20607769 there is no `wi │ │ │ │ + 0x00fd4240 74682068 65697374 6020696e 2066726f th heist` in fro │ │ │ │ + 0x00fd4250 6e74206f 66207468 65206361 6c6c0a74 nt of the call.t │ │ │ │ + 0x00fd4260 6f206068 65697374 53657276 65602e20 o `heistServe`. │ │ │ │ + 0x00fd4270 20416e64 20696e64 6565642c 20746861 And indeed, tha │ │ │ │ + 0x00fd4280 7420776f 756c6420 6e6f726d 616c6c79 t would normally │ │ │ │ + 0x00fd4290 20626520 74686520 63617365 2e202042 be the case. B │ │ │ │ + 0x00fd42a0 75742077 65206465 63696465 640a7468 ut we decided.th │ │ │ │ + 0x00fd42b0 61742061 6e206170 706c6963 6174696f at an applicatio │ │ │ │ + 0x00fd42c0 6e207769 6c6c206e 65766572 206e6565 n will never nee │ │ │ │ + 0x00fd42d0 64206d6f 72652074 68616e20 6f6e6520 d more than one │ │ │ │ + 0x00fd42e0 696e7374 616e6365 206f6620 61204865 instance of a He │ │ │ │ + 0x00fd42f0 69737420 736e6170 6c65742e 0a536f20 ist snaplet..So │ │ │ │ + 0x00fd4300 77652070 726f7669 64656420 61207479 we provided a ty │ │ │ │ + 0x00fd4310 70652063 6c617373 2063616c 6c656420 pe class called │ │ │ │ + 0x00fd4320 60486173 48656973 74602074 68617420 `HasHeist` that │ │ │ │ + 0x00fd4330 616c6c6f 77732061 6e206170 706c6963 allows an applic │ │ │ │ + 0x00fd4340 6174696f 6e20746f 0a646566 696e6520 ation to.define │ │ │ │ + 0x00fd4350 74686520 676c6f62 616c2072 65666572 the global refer │ │ │ │ + 0x00fd4360 656e6365 20746f20 69747320 48656973 ence to its Heis │ │ │ │ + 0x00fd4370 7420736e 61706c65 74206279 20777269 t snaplet by wri │ │ │ │ + 0x00fd4380 74696e67 20612060 48617348 65697374 ting a `HasHeist │ │ │ │ + 0x00fd4390 600a696e 7374616e 63652e20 20496e20 `.instance. In │ │ │ │ + 0x00fd43a0 74686973 20657861 6d706c65 20776520 this example we │ │ │ │ + 0x00fd43b0 64656669 6e652074 68652069 6e737461 define the insta │ │ │ │ + 0x00fd43c0 6e636520 61732066 6f6c6c6f 77733a0a nce as follows:. │ │ │ │ + 0x00fd43d0 0a3e2069 6e737461 6e636520 48617348 .> instance HasH │ │ │ │ + 0x00fd43e0 65697374 20417070 20776865 72652068 eist App where h │ │ │ │ + 0x00fd43f0 65697374 4c656e73 203d2073 7562536e eistLens = subSn │ │ │ │ + 0x00fd4400 61706c65 74206865 6973740a 0a4e6f77 aplet heist..Now │ │ │ │ + 0x00fd4410 20616c6c 20776520 6e656564 20697320 all we need is │ │ │ │ + 0x00fd4420 61207369 6d706c65 206d6169 6e206675 a simple main fu │ │ │ │ + 0x00fd4430 6e637469 6f6e2074 6f207365 72766520 nction to serve │ │ │ │ + 0x00fd4440 6f757220 6170706c 69636174 696f6e2e our application. │ │ │ │ + 0x00fd4450 0a0a3e20 6d61696e 203a3a20 494f2028 ..> main :: IO ( │ │ │ │ + 0x00fd4460 290a3e20 6d61696e 203d2073 65727665 ).> main = serve │ │ │ │ + 0x00fd4470 536e6170 6c657420 64656661 756c7443 Snaplet defaultC │ │ │ │ + 0x00fd4480 6f6e6669 67206170 70496e69 740a0a54 onfig appInit..T │ │ │ │ + 0x00fd4490 68697320 636f6d70 6c657465 73206120 his completes a │ │ │ │ + 0x00fd44a0 66756c6c 20776f72 6b696e67 20617070 full working app │ │ │ │ + 0x00fd44b0 6c696361 74696f6e 2e202057 65206469 lication. We di │ │ │ │ + 0x00fd44c0 64206c65 61766520 6f757420 61206c69 d leave out a li │ │ │ │ + 0x00fd44d0 74746c65 2064756d 6d790a63 6f646520 ttle dummy.code │ │ │ │ + 0x00fd44e0 666f7220 74686520 466f6f20 616e6420 for the Foo and │ │ │ │ + 0x00fd44f0 42617220 736e6170 6c657473 2e202054 Bar snaplets. T │ │ │ │ + 0x00fd4500 68697320 636f6465 20697320 696e636c his code is incl │ │ │ │ + 0x00fd4510 75646564 20696e20 50617274 322e6873 uded in Part2.hs │ │ │ │ + 0x00fd4520 2e202046 6f720a6d 6f726520 696e666f . For.more info │ │ │ │ + 0x00fd4530 726d6174 696f6e20 6c6f6f6b 20696e20 rmation look in │ │ │ │ + 0x00fd4540 6f757220 5b415049 0a646f63 756d656e our [API.documen │ │ │ │ + 0x00fd4550 74617469 6f6e5d28 68747470 3a2f2f68 tation](http://h │ │ │ │ + 0x00fd4560 61636b61 67652e68 61736b65 6c6c2e6f ackage.haskell.o │ │ │ │ + 0x00fd4570 72672f70 61636b61 67652f73 6e617029 rg/package/snap) │ │ │ │ + 0x00fd4580 2c207370 65636966 6963616c 6c792074 , specifically t │ │ │ │ + 0x00fd4590 68650a53 6e61702e 536e6170 6c657420 he.Snap.Snaplet │ │ │ │ + 0x00fd45a0 6d6f6475 6c652e20 204e6f20 7265616c module. No real │ │ │ │ + 0x00fd45b0 6c792c20 74686174 20776173 6e277420 ly, that wasn't │ │ │ │ + 0x00fd45c0 61206a6f 6b652e20 20546865 20415049 a joke. The API │ │ │ │ + 0x00fd45d0 20646f63 73206172 65207772 69747465 docs are writte │ │ │ │ + 0x00fd45e0 6e0a6173 2070726f 73652e20 20546865 n.as prose. The │ │ │ │ + 0x00fd45f0 79207368 6f756c64 20626520 76657279 y should be very │ │ │ │ + 0x00fd4600 20656173 7920746f 20726561 642c2077 easy to read, w │ │ │ │ + 0x00fd4610 68696c65 20686176 696e6720 74686520 hile having the │ │ │ │ + 0x00fd4620 62656e65 66697420 6f660a69 6e636c75 benefit of.inclu │ │ │ │ + 0x00fd4630 64696e67 20616c6c 20746865 20616374 ding all the act │ │ │ │ + 0x00fd4640 75616c20 74797065 20736967 6e617475 ual type signatu │ │ │ │ + 0x00fd4650 7265732e 0a0a4669 6c657379 7374656d res...Filesystem │ │ │ │ + 0x00fd4660 20446174 6120616e 64204175 746f6d61 Data and Automa │ │ │ │ + 0x00fd4670 74696320 496e7374 616c6c61 74696f6e tic Installation │ │ │ │ + 0x00fd4680 0a3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d .=============== │ │ │ │ + 0x00fd4690 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================ │ │ │ │ + 0x00fd46a0 3d3d3d3d 3d3d3d3d 3d3d3d0a 0a536f6d ===========..Som │ │ │ │ + 0x00fd46b0 6520736e 61706c65 74732077 696c6c20 e snaplets will │ │ │ │ + 0x00fd46c0 68617665 20646174 61207374 6f726564 have data stored │ │ │ │ + 0x00fd46d0 20696e20 74686520 66696c65 73797374 in the filesyst │ │ │ │ + 0x00fd46e0 656d2074 68617420 73686f75 6c642062 em that should b │ │ │ │ + 0x00fd46f0 6520696e 7374616c 6c65640a 696e746f e installed.into │ │ │ │ + 0x00fd4700 20746865 20646972 6563746f 7279206f the directory o │ │ │ │ + 0x00fd4710 6620616e 79207072 6f6a6563 74207468 f any project th │ │ │ │ + 0x00fd4720 61742075 73657320 69742e20 20486572 at uses it. Her │ │ │ │ + 0x00fd4730 65277320 616e2065 78616d70 6c65206f e's an example o │ │ │ │ + 0x00fd4740 66207768 61742061 0a736e61 706c6574 f what a.snaplet │ │ │ │ + 0x00fd4750 2066696c 65737973 74656d20 6c61796f filesystem layo │ │ │ │ + 0x00fd4760 7574206d 69676874 206c6f6f 6b206c69 ut might look li │ │ │ │ + 0x00fd4770 6b653a0a 0a202020 20666f6f 736e6170 ke:.. foosnap │ │ │ │ + 0x00fd4780 6c65742f 0a202020 2020207c 2d2d202a let/. |-- * │ │ │ │ + 0x00fd4790 64657665 6c2e6366 672a0a20 20202020 devel.cfg*. │ │ │ │ + 0x00fd47a0 207c2d2d 2064622e 6366670a 20202020 |-- db.cfg. │ │ │ │ + 0x00fd47b0 20207c2d 2d207075 626c6963 2f0a2020 |-- public/. │ │ │ │ + 0x00fd47c0 20202020 20202020 7c2d2d20 7374796c |-- styl │ │ │ │ + 0x00fd47d0 65736865 6574732f 0a202020 20202020 esheets/. │ │ │ │ + 0x00fd47e0 2020207c 2d2d2069 6d616765 732f0a20 |-- images/. │ │ │ │ + 0x00fd47f0 20202020 20202020 207c2d2d 206a732f |-- js/ │ │ │ │ + 0x00fd4800 0a202020 2020207c 2d2d202a 736e6170 . |-- *snap │ │ │ │ + 0x00fd4810 6c657473 2f2a0a20 20202020 20202020 lets/*. │ │ │ │ + 0x00fd4820 207c2d2d 202a6865 6973742f 2a0a2020 |-- *heist/*. │ │ │ │ + 0x00fd4830 20202020 20202020 20202020 7c2d2d20 |-- │ │ │ │ + 0x00fd4840 74656d70 6c617465 732f0a20 20202020 templates/. │ │ │ │ + 0x00fd4850 20202020 207c2d2d 20737562 736e6170 |-- subsnap │ │ │ │ + 0x00fd4860 6c657431 2f0a2020 20202020 20202020 let1/. │ │ │ │ + 0x00fd4870 7c2d2d20 73756273 6e61706c 6574322f |-- subsnaplet2/ │ │ │ │ + 0x00fd4880 0a0a4f6e 6c792074 68652073 74617272 ..Only the starr │ │ │ │ + 0x00fd4890 65642069 74656d73 20617265 20616374 ed items are act │ │ │ │ + 0x00fd48a0 75616c6c 7920656e 666f7263 65642062 ually enforced b │ │ │ │ + 0x00fd48b0 79206375 7272656e 7420636f 64652c20 y current code, │ │ │ │ + 0x00fd48c0 62757420 77652077 616e7420 746f0a65 but we want to.e │ │ │ │ + 0x00fd48d0 73746162 6c697368 20746865 206f7468 stablish the oth │ │ │ │ + 0x00fd48e0 65727320 61732061 20636f6e 76656e74 ers as a convent │ │ │ │ + 0x00fd48f0 696f6e2e 20205468 65206669 6c652064 ion. The file d │ │ │ │ + 0x00fd4900 6576656c 2e636667 20697320 6175746f evel.cfg is auto │ │ │ │ + 0x00fd4910 6d617469 63616c6c 790a7265 61642062 matically.read b │ │ │ │ + 0x00fd4920 79207468 6520736e 61706c65 7420696e y the snaplet in │ │ │ │ + 0x00fd4930 66726173 74727563 74757265 2e202049 frastructure. I │ │ │ │ + 0x00fd4940 74206973 20617661 696c6162 6c652074 t is available t │ │ │ │ + 0x00fd4950 6f20796f 75207669 61207468 650a6067 o you via the.`g │ │ │ │ + 0x00fd4960 6574536e 61706c65 74557365 72436f6e etSnapletUserCon │ │ │ │ + 0x00fd4970 66696760 2066756e 6374696f 6e2e2020 fig` function. │ │ │ │ + 0x00fd4980 436f6e66 69672066 696c6573 20757365 Config files use │ │ │ │ + 0x00fd4990 20746865 20666f72 6d617420 64656669 the format defi │ │ │ │ + 0x00fd49a0 6e656420 62792042 7279616e 0a4f2753 ned by Bryan.O'S │ │ │ │ + 0x00fd49b0 756c6c69 76616e27 73206578 63656c6c ullivan's excell │ │ │ │ + 0x00fd49c0 656e7420 5b636f6e 66696775 7261746f ent [configurato │ │ │ │ + 0x00fd49d0 720a7061 636b6167 655d2868 7474703a r.package](http: │ │ │ │ + 0x00fd49e0 2f2f6861 636b6167 652e6861 736b656c //hackage.haskel │ │ │ │ + 0x00fd49f0 6c2e6f72 672f7061 636b6167 652f636f l.org/package/co │ │ │ │ + 0x00fd4a00 6e666967 75726174 6f72292e 2020496e nfigurator). In │ │ │ │ + 0x00fd4a10 20746869 73206578 616d706c 652c0a74 this example,.t │ │ │ │ + 0x00fd4a20 68652075 73657220 68617320 63686f73 he user has chos │ │ │ │ + 0x00fd4a30 656e2074 6f207075 74206462 20636f6e en to put db con │ │ │ │ + 0x00fd4a40 66696720 6974656d 7320696e 20612073 fig items in a s │ │ │ │ + 0x00fd4a50 65706172 61746520 66696c65 20616e64 eparate file and │ │ │ │ + 0x00fd4a60 20757365 0a636f6e 66696775 7261746f use.configurato │ │ │ │ + 0x00fd4a70 72277320 696d706f 72742066 756e6374 r's import funct │ │ │ │ + 0x00fd4a80 696f6e61 6c697479 20746f20 696e636c ionality to incl │ │ │ │ + 0x00fd4a90 75646520 69742069 6e206465 76656c2e ude it in devel. │ │ │ │ + 0x00fd4aa0 6366672e 20204966 0a666f6f 736e6170 cfg. If.foosnap │ │ │ │ + 0x00fd4ab0 6c657420 75736573 20606e65 7374536e let uses `nestSn │ │ │ │ + 0x00fd4ac0 61706c65 7460206f 72206065 6d626564 aplet` or `embed │ │ │ │ + 0x00fd4ad0 536e6170 6c657460 20746f20 696e636c Snaplet` to incl │ │ │ │ + 0x00fd4ae0 75646520 616e7920 6f746865 7220736e ude any other sn │ │ │ │ + 0x00fd4af0 61706c65 74732c0a 7468656e 2066696c aplets,.then fil │ │ │ │ + 0x00fd4b00 65737973 74656d20 64617461 20646566 esystem data def │ │ │ │ + 0x00fd4b10 696e6564 20627920 74686f73 6520736e ined by those sn │ │ │ │ + 0x00fd4b20 61706c65 74732077 696c6c20 62652069 aplets will be i │ │ │ │ + 0x00fd4b30 6e636c75 64656420 696e0a73 75626469 ncluded in.subdi │ │ │ │ + 0x00fd4b40 72656374 6f726965 7320756e 64657220 rectories under │ │ │ │ + 0x00fd4b50 74686520 60736e61 706c6574 732f6020 the `snaplets/` │ │ │ │ + 0x00fd4b60 64697265 63746f72 792e0a0a 536f2068 directory...So h │ │ │ │ + 0x00fd4b70 6f772064 6f20796f 75207465 6c6c2074 ow do you tell t │ │ │ │ + 0x00fd4b80 68652073 6e61706c 65742069 6e667261 he snaplet infra │ │ │ │ + 0x00fd4b90 73747275 63747572 65207468 61742079 structure that y │ │ │ │ + 0x00fd4ba0 6f757220 736e6170 6c657420 68617320 our snaplet has │ │ │ │ + 0x00fd4bb0 66696c65 73797374 656d0a64 61746120 filesystem.data │ │ │ │ + 0x00fd4bc0 74686174 2073686f 756c6420 62652069 that should be i │ │ │ │ + 0x00fd4bd0 6e737461 6c6c6564 3f20204c 6f6f6b20 nstalled? Look │ │ │ │ + 0x00fd4be0 61742074 68652064 6566696e 6974696f at the definitio │ │ │ │ + 0x00fd4bf0 6e206f66 20617070 496e6974 2061626f n of appInit abo │ │ │ │ + 0x00fd4c00 76652e20 20546865 0a746869 72642061 ve. The.third a │ │ │ │ + 0x00fd4c10 7267756d 656e7420 746f2074 6865206d rgument to the m │ │ │ │ + 0x00fd4c20 616b6553 6e61706c 65742066 756e6374 akeSnaplet funct │ │ │ │ + 0x00fd4c30 696f6e20 69732077 68657265 20776520 ion is where we │ │ │ │ + 0x00fd4c40 73706563 69667920 74686520 66696c65 specify the file │ │ │ │ + 0x00fd4c50 73797374 656d0a64 69726563 746f7279 system.directory │ │ │ │ + 0x00fd4c60 20746861 74207368 6f756c64 20626520 that should be │ │ │ │ + 0x00fd4c70 696e7374 616c6c65 642e2020 54686174 installed. That │ │ │ │ + 0x00fd4c80 20617267 756d656e 74206861 73207468 argument has th │ │ │ │ + 0x00fd4c90 65207479 70652060 4d617962 65202849 e type `Maybe (I │ │ │ │ + 0x00fd4ca0 4f0a4669 6c655061 74682960 2e202049 O.FilePath)`. I │ │ │ │ + 0x00fd4cb0 6e207468 69732063 61736520 77652075 n this case we u │ │ │ │ + 0x00fd4cc0 73656420 604e6f74 68696e67 60206265 sed `Nothing` be │ │ │ │ + 0x00fd4cd0 63617573 65206f75 72207369 6d706c65 cause our simple │ │ │ │ + 0x00fd4ce0 20657861 6d706c65 20646f65 736e2774 example doesn't │ │ │ │ + 0x00fd4cf0 0a686176 6520616e 79206669 6c657379 .have any filesy │ │ │ │ + 0x00fd4d00 7374656d 20646174 612e2020 41732061 stem data. As a │ │ │ │ + 0x00fd4d10 6e206578 616d706c 652c206c 65742773 n example, let's │ │ │ │ + 0x00fd4d20 20736179 20796f75 20617265 20637265 say you are cre │ │ │ │ + 0x00fd4d30 6174696e 67206120 736e6170 6c65740a ating a snaplet. │ │ │ │ + 0x00fd4d40 63616c6c 6564206b 696c6c65 72617070 called killerapp │ │ │ │ + 0x00fd4d50 20746861 74207769 6c6c2062 65206469 that will be di │ │ │ │ + 0x00fd4d60 73747269 62757465 64206173 20612068 stributed as a h │ │ │ │ + 0x00fd4d70 61636b61 67652070 726f6a65 63742063 ackage project c │ │ │ │ + 0x00fd4d80 616c6c65 640a736e 61706c65 742d6b69 alled.snaplet-ki │ │ │ │ + 0x00fd4d90 6c6c6572 6170702e 2020596f 75722070 llerapp. Your p │ │ │ │ + 0x00fd4da0 726f6a65 63742064 69726563 746f7279 roject directory │ │ │ │ + 0x00fd4db0 20737472 75637475 72652077 696c6c20 structure will │ │ │ │ + 0x00fd4dc0 6c6f6f6b 20736f6d 65746869 6e67206c look something l │ │ │ │ + 0x00fd4dd0 696b650a 74686973 3a0a0a20 20202073 ike.this:.. s │ │ │ │ + 0x00fd4de0 6e61706c 65742d6b 696c6c65 72617070 naplet-killerapp │ │ │ │ + 0x00fd4df0 2f0a2020 20202020 7c2d2d20 7265736f /. |-- reso │ │ │ │ + 0x00fd4e00 75726365 732f0a20 20202020 207c2d2d urces/. |-- │ │ │ │ + 0x00fd4e10 20736e61 706c6574 2d6b696c 6c657261 snaplet-killera │ │ │ │ + 0x00fd4e20 70702e63 6162616c 0a202020 2020207c pp.cabal. | │ │ │ │ + 0x00fd4e30 2d2d2073 72632f0a 0a416c6c 206f6620 -- src/..All of │ │ │ │ + 0x00fd4e40 74686520 66696c65 7320616e 64206469 the files and di │ │ │ │ + 0x00fd4e50 72656374 6f726965 73206c69 73746564 rectories listed │ │ │ │ + 0x00fd4e60 2061626f 76652075 6e646572 20666f6f above under foo │ │ │ │ + 0x00fd4e70 736e6170 6c65742f 2077696c 6c206265 snaplet/ will be │ │ │ │ + 0x00fd4e80 20696e0a 7265736f 75726365 732f2e20 in.resources/. │ │ │ │ + 0x00fd4e90 20536f6d 65776865 72652069 6e207468 Somewhere in th │ │ │ │ + 0x00fd4ea0 6520636f 64652079 6f752077 696c6c20 e code you will │ │ │ │ + 0x00fd4eb0 64656669 6e652061 6e20696e 69746961 define an initia │ │ │ │ + 0x00fd4ec0 6c697a65 7220666f 72207468 650a736e lizer for the.sn │ │ │ │ + 0x00fd4ed0 61706c65 74207468 61742077 696c6c20 aplet that will │ │ │ │ + 0x00fd4ee0 6c6f6f6b 206c696b 65207468 69733a0a look like this:. │ │ │ │ + 0x00fd4ef0 0a202020 206b696c 6c657249 6e697420 . killerInit │ │ │ │ + 0x00fd4f00 3d206d61 6b65536e 61706c65 7420226b = makeSnaplet "k │ │ │ │ + 0x00fd4f10 696c6c65 72617070 22202234 32222028 illerapp" "42" ( │ │ │ │ + 0x00fd4f20 4a757374 20646174 61446972 29202420 Just dataDir) $ │ │ │ │ + 0x00fd4f30 646f0a0a 54686520 7072696d 61727920 do..The primary │ │ │ │ + 0x00fd4f40 66756e63 74696f6e 206f6620 43616261 function of Caba │ │ │ │ + 0x00fd4f50 6c206973 20746f20 696e7374 616c6c20 l is to install │ │ │ │ + 0x00fd4f60 636f6465 2e202042 75742069 74206861 code. But it ha │ │ │ │ + 0x00fd4f70 73207468 65206162 696c6974 7920746f s the ability to │ │ │ │ + 0x00fd4f80 0a696e73 74616c6c 20646174 61206669 .install data fi │ │ │ │ + 0x00fd4f90 6c657320 616e6420 70726f76 69646573 les and provides │ │ │ │ + 0x00fd4fa0 20612066 756e6374 696f6e20 63616c6c a function call │ │ │ │ + 0x00fd4fb0 65642060 67657444 61746144 69726020 ed `getDataDir` │ │ │ │ + 0x00fd4fc0 666f7220 72657472 69657669 6e670a74 for retrieving.t │ │ │ │ + 0x00fd4fd0 6865206c 6f636174 696f6e20 6f662074 he location of t │ │ │ │ + 0x00fd4fe0 68657365 2066696c 65732e20 2053696e hese files. Sin │ │ │ │ + 0x00fd4ff0 63652069 74207265 7475726e 73206120 ce it returns a │ │ │ │ + 0x00fd5000 64696666 6572656e 74207265 73756c74 different result │ │ │ │ + 0x00fd5010 20646570 656e6469 6e67206f 6e0a7768 depending on.wh │ │ │ │ + 0x00fd5020 6174206d 61636869 6e652079 6f752772 at machine you'r │ │ │ │ + 0x00fd5030 65207573 696e672c 20746865 20746869 e using, the thi │ │ │ │ + 0x00fd5040 72642061 7267756d 656e7420 746f2060 rd argument to ` │ │ │ │ + 0x00fd5050 6d616b65 536e6170 6c657460 20686173 makeSnaplet` has │ │ │ │ + 0x00fd5060 20746f20 62652060 4d617962 650a2849 to be `Maybe.(I │ │ │ │ + 0x00fd5070 4f204669 6c655061 74682960 20696e73 O FilePath)` ins │ │ │ │ + 0x00fd5080 74656164 206f6620 74686520 6d6f7265 tead of the more │ │ │ │ + 0x00fd5090 206e6174 7572616c 20707572 65207665 natural pure ve │ │ │ │ + 0x00fd50a0 7273696f 6e2e2020 546f206d 616b6520 rsion. To make │ │ │ │ + 0x00fd50b0 7468696e 6773206d 6f72650a 6f726761 things more.orga │ │ │ │ + 0x00fd50c0 6e697a65 642c2077 65207573 65207468 nized, we use th │ │ │ │ + 0x00fd50d0 6520636f 6e76656e 74696f6e 206f6620 e convention of │ │ │ │ + 0x00fd50e0 70757474 696e6720 616c6c20 796f7572 putting all your │ │ │ │ + 0x00fd50f0 20736e61 706c6574 27732064 61746120 snaplet's data │ │ │ │ + 0x00fd5100 66696c65 7320696e 20610a73 75626469 files in a.subdi │ │ │ │ + 0x00fd5110 72656374 6f727920 63616c6c 65642072 rectory called r │ │ │ │ + 0x00fd5120 65736f75 72636573 2e202053 6f207765 esources. So we │ │ │ │ + 0x00fd5130 206e6565 6420746f 20637265 61746520 need to create │ │ │ │ + 0x00fd5140 6120736d 616c6c20 66756e63 74696f6e a small function │ │ │ │ + 0x00fd5150 20746861 740a6170 70656e64 7320602f that.appends `/ │ │ │ │ + 0x00fd5160 7265736f 75726365 73602074 6f207468 resources` to th │ │ │ │ + 0x00fd5170 65207265 73756c74 206f6620 60676574 e result of `get │ │ │ │ + 0x00fd5180 44617461 44697260 2e0a0a20 20202069 DataDir`... i │ │ │ │ + 0x00fd5190 6d706f72 74205061 7468735f 736e6170 mport Paths_snap │ │ │ │ + 0x00fd51a0 6c65745f 6b696c6c 65726170 700a2020 let_killerapp. │ │ │ │ + 0x00fd51b0 20206461 74614469 72203d20 6c696674 dataDir = lift │ │ │ │ + 0x00fd51c0 4d20282b 2b222f72 65736f75 72636573 M (++"/resources │ │ │ │ + 0x00fd51d0 22292067 65744461 74614469 720a0a49 ") getDataDir..I │ │ │ │ + 0x00fd51e0 66206f75 72207072 6f6a6563 74206973 f our project is │ │ │ │ + 0x00fd51f0 206e616d 65642073 6e61706c 65742d6b named snaplet-k │ │ │ │ + 0x00fd5200 696c6c65 72617070 2c207468 65206067 illerapp, the `g │ │ │ │ + 0x00fd5210 65744461 74614469 72602066 756e6374 etDataDir` funct │ │ │ │ + 0x00fd5220 696f6e20 69730a64 6566696e 65642069 ion is.defined i │ │ │ │ + 0x00fd5230 6e207468 65206d6f 64756c65 20506174 n the module Pat │ │ │ │ + 0x00fd5240 68735f73 6e61706c 65745f6b 696c6c65 hs_snaplet_kille │ │ │ │ + 0x00fd5250 72617070 2c207768 69636820 77652068 rapp, which we h │ │ │ │ + 0x00fd5260 61766520 746f2069 6d706f72 742e2020 ave to import. │ │ │ │ + 0x00fd5270 546f0a6d 616b6520 65766572 79746869 To.make everythi │ │ │ │ + 0x00fd5280 6e672077 6f726b2c 20796f75 20686176 ng work, you hav │ │ │ │ + 0x00fd5290 6520746f 2074656c 6c204361 62616c20 e to tell Cabal │ │ │ │ + 0x00fd52a0 61626f75 7420796f 75722064 61746120 about your data │ │ │ │ + 0x00fd52b0 66696c65 73206279 0a696e63 6c756469 files by.includi │ │ │ │ + 0x00fd52c0 6e672061 20736563 74696f6e 206c696b ng a section lik │ │ │ │ + 0x00fd52d0 65207468 6520666f 6c6c6f77 696e6720 e the following │ │ │ │ + 0x00fd52e0 696e2073 6e61706c 65742d6b 696c6c65 in snaplet-kille │ │ │ │ + 0x00fd52f0 72617070 2e636162 616c3a0a 0a202020 rapp.cabal:.. │ │ │ │ + 0x00fd5300 20646174 612d6669 6c65733a 0a202020 data-files:. │ │ │ │ + 0x00fd5310 20202072 65736f75 72636573 2f646576 resources/dev │ │ │ │ + 0x00fd5320 656c2e63 66672c0a 20202020 20207265 el.cfg,. re │ │ │ │ + 0x00fd5330 736f7572 6365732f 7075626c 69632f73 sources/public/s │ │ │ │ + 0x00fd5340 74796c65 73686565 74732f73 74796c65 tylesheets/style │ │ │ │ + 0x00fd5350 2e637373 2c0a2020 20202020 7265736f .css,. reso │ │ │ │ + 0x00fd5360 75726365 732f736e 61706c65 74732f68 urces/snaplets/h │ │ │ │ + 0x00fd5370 65697374 2f74656d 706c6174 65732f70 eist/templates/p │ │ │ │ + 0x00fd5380 6167652e 74706c0a 0a4e6f77 20776865 age.tpl..Now whe │ │ │ │ + 0x00fd5390 6e657665 7220796f 75722073 6e61706c never your snapl │ │ │ │ + 0x00fd53a0 65742069 73207573 65642c20 69747320 et is used, its │ │ │ │ + 0x00fd53b0 66696c65 73797374 656d2064 61746120 filesystem data │ │ │ │ + 0x00fd53c0 77696c6c 20626520 6175746f 6d616769 will be automagi │ │ │ │ + 0x00fd53d0 63616c6c 790a636f 70696564 20696e74 cally.copied int │ │ │ │ + 0x00fd53e0 6f207468 65206c6f 63616c20 70726f6a o the local proj │ │ │ │ + 0x00fd53f0 65637420 74686174 20697320 7573696e ect that is usin │ │ │ │ + 0x00fd5400 67206974 2c207768 656e6576 65722074 g it, whenever t │ │ │ │ + 0x00fd5410 68652061 70706c69 63617469 6f6e2069 he application i │ │ │ │ + 0x00fd5420 730a7275 6e20616e 64206974 20736565 s.run and it see │ │ │ │ + 0x00fd5430 73207468 61742074 68652073 6e61706c s that the snapl │ │ │ │ + 0x00fd5440 65742773 20646972 6563746f 72792064 et's directory d │ │ │ │ + 0x00fd5450 6f657320 6e6f7420 616c7265 61647920 oes not already │ │ │ │ + 0x00fd5460 65786973 742e2020 49662074 68650a75 exist. If the.u │ │ │ │ + 0x00fd5470 73657220 75706772 61646573 20746f20 ser upgrades to │ │ │ │ + 0x00fd5480 61206e65 77207665 7273696f 6e206f66 a new version of │ │ │ │ + 0x00fd5490 20746865 20736e61 706c6574 20616e64 the snaplet and │ │ │ │ + 0x00fd54a0 20746865 206e6577 20766572 73696f6e the new version │ │ │ │ + 0x00fd54b0 206d6164 65206368 616e6765 730a746f made changes.to │ │ │ │ + 0x00fd54c0 20746865 2066696c 65737973 74656d20 the filesystem │ │ │ │ + 0x00fd54d0 7265736f 75726365 732c2074 686f7365 resources, those │ │ │ │ + 0x00fd54e0 20726573 6f757263 65732077 696c6c20 resources will │ │ │ │ + 0x00fd54f0 4e4f5420 62652061 75746f6d 61746963 NOT be automatic │ │ │ │ + 0x00fd5500 616c6c79 20636f70 6965640a 696e2062 ally copied.in b │ │ │ │ + 0x00fd5510 79206465 6661756c 742e2020 5265736f y default. Reso │ │ │ │ + 0x00fd5520 75726365 20696e73 74616c6c 6174696f urce installatio │ │ │ │ + 0x00fd5530 6e202a6f 6e6c792a 20686170 70656e73 n *only* happens │ │ │ │ + 0x00fd5540 20776865 6e207468 65206073 6e61706c when the `snapl │ │ │ │ + 0x00fd5550 6574732f 666f6f60 0a646972 6563746f ets/foo`.directo │ │ │ │ + 0x00fd5560 72792064 6f657320 6e6f7420 65786973 ry does not exis │ │ │ │ + 0x00fd5570 742e2020 49662079 6f752077 616e7420 t. If you want │ │ │ │ + 0x00fd5580 746f2067 65742074 6865206c 61746573 to get the lates │ │ │ │ + 0x00fd5590 74207665 7273696f 6e206f66 20746865 t version of the │ │ │ │ + 0x00fd55a0 0a66696c 65737973 74656d20 7265736f .filesystem reso │ │ │ │ + 0x00fd55b0 75726365 732c2072 656d6f76 65207468 urces, remove th │ │ │ │ + 0x00fd55c0 65206073 6e61706c 6574732f 666f6f60 e `snaplets/foo` │ │ │ │ + 0x00fd55d0 20646972 6563746f 72792c20 616e6420 directory, and │ │ │ │ + 0x00fd55e0 72657374 61727420 796f7572 0a617070 restart your.app │ │ │ │ + 0x00fd55f0 2e0a002e 2f737263 2f547574 6f726961 ..../src/Tutoria │ │ │ │ + 0x00fd5600 6c2e6c68 73003e20 7b2d2320 4c414e47 l.lhs.> {-# LANG │ │ │ │ + 0x00fd5610 55414745 204f7665 726c6f61 64656453 UAGE OverloadedS │ │ │ │ + 0x00fd5620 7472696e 67732023 2d7d0a3e 206d6f64 trings #-}.> mod │ │ │ │ + 0x00fd5630 756c6520 50617274 32207768 6572650a ule Part2 where. │ │ │ │ + 0x00fd5640 0a3e2069 6d706f72 74202020 20202020 .> import │ │ │ │ + 0x00fd5650 20202020 536e6170 2e536e61 706c6574 Snap.Snaplet │ │ │ │ + 0x00fd5660 0a0a3e20 64617461 20466f6f 203d2046 ..> data Foo = F │ │ │ │ + 0x00fd5670 6f6f0a3e 0a3e2064 61746120 42617220 oo.>.> data Bar │ │ │ │ + 0x00fd5680 3d204261 720a3e0a 3e20666f 6f496e69 = Bar.>.> fooIni │ │ │ │ + 0x00fd5690 74203a3a 20536e61 706c6574 496e6974 t :: SnapletInit │ │ │ │ + 0x00fd56a0 20622046 6f6f0a3e 20666f6f 496e6974 b Foo.> fooInit │ │ │ │ + 0x00fd56b0 203d206d 616b6553 6e61706c 65742022 = makeSnaplet " │ │ │ │ + 0x00fd56c0 666f6f22 2022466f 6f20736e 61706c65 foo" "Foo snaple │ │ │ │ + 0x00fd56d0 7422204e 6f746869 6e672024 20646f0a t" Nothing $ do. │ │ │ │ + 0x00fd56e0 3e202020 20207265 7475726e 20466f6f > return Foo │ │ │ │ + 0x00fd56f0 0a3e0a3e 20626172 496e6974 203a3a20 .>.> barInit :: │ │ │ │ + 0x00fd5700 536e6170 6c65744c 656e7320 6220466f SnapletLens b Fo │ │ │ │ + 0x00fd5710 6f202d3e 20536e61 706c6574 496e6974 o -> SnapletInit │ │ │ │ + 0x00fd5720 20622042 61720a3e 20626172 496e6974 b Bar.> barInit │ │ │ │ + 0x00fd5730 205f6820 3d206d61 6b65536e 61706c65 _h = makeSnaple │ │ │ │ + 0x00fd5740 74202262 61722220 22426172 20736e61 t "bar" "Bar sna │ │ │ │ + 0x00fd5750 706c6574 22204e6f 7468696e 67202420 plet" Nothing $ │ │ │ │ + 0x00fd5760 646f0a3e 20202020 20726574 75726e20 do.> return │ │ │ │ + 0x00fd5770 4261720a 002e2f73 72632f50 61727432 Bar.../src/Part2 │ │ │ │ + 0x00fd5780 2e6c6873 004e616d 653a2020 20202020 .lhs.Name: │ │ │ │ + 0x00fd5790 20202020 20202020 20207072 6f6a6e61 projna │ │ │ │ + 0x00fd57a0 6d650a56 65727369 6f6e3a20 20202020 me.Version: │ │ │ │ + 0x00fd57b0 20202020 20202020 302e310a 53796e6f 0.1.Syno │ │ │ │ + 0x00fd57c0 70736973 3a202020 20202020 20202020 psis: │ │ │ │ + 0x00fd57d0 2050726f 6a656374 2053796e 6f707369 Project Synopsi │ │ │ │ + 0x00fd57e0 73204865 72650a44 65736372 69707469 s Here.Descripti │ │ │ │ + 0x00fd57f0 6f6e3a20 20202020 20202020 50726f6a on: Proj │ │ │ │ + 0x00fd5800 65637420 44657363 72697074 696f6e20 ect Description │ │ │ │ + 0x00fd5810 48657265 0a4c6963 656e7365 3a202020 Here.License: │ │ │ │ + 0x00fd5820 20202020 20202020 2020416c 6c526967 AllRig │ │ │ │ + 0x00fd5830 68747352 65736572 7665640a 41757468 htsReserved.Auth │ │ │ │ + 0x00fd5840 6f723a20 20202020 20202020 20202020 or: │ │ │ │ + 0x00fd5850 20417574 686f720a 4d61696e 7461696e Author.Maintain │ │ │ │ + 0x00fd5860 65723a20 20202020 20202020 206d6169 er: mai │ │ │ │ + 0x00fd5870 6e746169 6e657240 6578616d 706c652e ntainer@example. │ │ │ │ + 0x00fd5880 636f6d0a 53746162 696c6974 793a2020 com.Stability: │ │ │ │ + 0x00fd5890 20202020 20202020 20457870 6572696d Experim │ │ │ │ + 0x00fd58a0 656e7461 6c0a4361 7465676f 72793a20 ental.Category: │ │ │ │ + 0x00fd58b0 20202020 20202020 20202057 65620a42 Web.B │ │ │ │ + 0x00fd58c0 75696c64 2d747970 653a2020 20202020 uild-type: │ │ │ │ + 0x00fd58d0 20202020 53696d70 6c650a43 6162616c Simple.Cabal │ │ │ │ + 0x00fd58e0 2d766572 73696f6e 3a202020 20202020 -version: │ │ │ │ + 0x00fd58f0 3e3d312e 320a0a46 6c616720 6f6c642d >=1.2..Flag old- │ │ │ │ + 0x00fd5900 62617365 0a202064 65666175 6c743a20 base. default: │ │ │ │ + 0x00fd5910 46616c73 650a2020 6d616e75 616c3a20 False. manual: │ │ │ │ + 0x00fd5920 46616c73 650a0a45 78656375 7461626c False..Executabl │ │ │ │ + 0x00fd5930 65207072 6f6a6e61 6d650a20 2068732d e projname. hs- │ │ │ │ + 0x00fd5940 736f7572 63652d64 6972733a 20737263 source-dirs: src │ │ │ │ + 0x00fd5950 0a20206d 61696e2d 69733a20 5475746f . main-is: Tuto │ │ │ │ + 0x00fd5960 7269616c 2e6c6873 0a0a2020 4275696c rial.lhs.. Buil │ │ │ │ + 0x00fd5970 642d6465 70656e64 733a0a20 20202062 d-depends:. b │ │ │ │ + 0x00fd5980 61736520 20202020 20202020 20202020 ase │ │ │ │ + 0x00fd5990 20202020 20202020 203e3d20 342e3420 >= 4.4 │ │ │ │ + 0x00fd59a0 20202020 2626203c 20352c0a 20202020 && < 5,. │ │ │ │ + 0x00fd59b0 62797465 73747269 6e672020 20202020 bytestring │ │ │ │ + 0x00fd59c0 20202020 20202020 20203e3d 20302e39 >= 0.9 │ │ │ │ + 0x00fd59d0 2e312020 20262620 3c20302e 31312c0a .1 && < 0.11,. │ │ │ │ + 0x00fd59e0 20202020 6c656e73 20202020 20202020 lens │ │ │ │ + 0x00fd59f0 20202020 20202020 20202020 20203e3d >= │ │ │ │ + 0x00fd5a00 20332e37 2e362020 20262620 3c20342e 3.7.6 && < 4. │ │ │ │ + 0x00fd5a10 31382c0a 20202020 6d6f6e61 642d636f 18,. monad-co │ │ │ │ + 0x00fd5a20 6e74726f 6c202020 20202020 20202020 ntrol │ │ │ │ + 0x00fd5a30 20203e3d 20312e30 20202020 20262620 >= 1.0 && │ │ │ │ + 0x00fd5a40 3c20312e 312c0a20 2020206d 746c2020 < 1.1,. mtl │ │ │ │ + 0x00fd5a50 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd5a60 20202020 203e3d20 32202020 20202020 >= 2 │ │ │ │ + 0x00fd5a70 2626203c 20322e33 2c0a2020 2020736e && < 2.3,. sn │ │ │ │ + 0x00fd5a80 61702020 20202020 20202020 20202020 ap │ │ │ │ + 0x00fd5a90 20202020 20202020 3e3d2031 2e302020 >= 1.0 │ │ │ │ + 0x00fd5aa0 20202026 26203c20 312e322c 0a202020 && < 1.2,. │ │ │ │ + 0x00fd5ab0 20736e61 702d636f 72652020 20202020 snap-core │ │ │ │ + 0x00fd5ac0 20202020 20202020 2020203e 3d20312e >= 1. │ │ │ │ + 0x00fd5ad0 30202020 20202626 203c2031 2e312c0a 0 && < 1.1,. │ │ │ │ + 0x00fd5ae0 20202020 736e6170 2d736572 76657220 snap-server │ │ │ │ + 0x00fd5af0 20202020 20202020 20202020 20203e3d >= │ │ │ │ + 0x00fd5b00 20312e30 20202020 20262620 3c20312e 1.0 && < 1. │ │ │ │ + 0x00fd5b10 320a0a20 20696620 696d706c 28676863 2.. if impl(ghc │ │ │ │ + 0x00fd5b20 203e3d20 362e3132 2e30290a 20202020 >= 6.12.0). │ │ │ │ + 0x00fd5b30 6768632d 6f707469 6f6e733a 202d7468 ghc-options: -th │ │ │ │ + 0x00fd5b40 72656164 6564202d 57616c6c 202d6677 readed -Wall -fw │ │ │ │ + 0x00fd5b50 61726e2d 74616273 202d6675 6e626f78 arn-tabs -funbox │ │ │ │ + 0x00fd5b60 2d737472 6963742d 6669656c 6473202d -strict-fields - │ │ │ │ + 0x00fd5b70 4f320a20 20202020 20202020 20202020 O2. │ │ │ │ + 0x00fd5b80 20202020 2d666e6f 2d776172 6e2d756e -fno-warn-un │ │ │ │ + 0x00fd5b90 75736564 2d646f2d 62696e64 0a202065 used-do-bind. e │ │ │ │ + 0x00fd5ba0 6c73650a 20202020 6768632d 6f707469 lse. ghc-opti │ │ │ │ + 0x00fd5bb0 6f6e733a 202d7468 72656164 6564202d ons: -threaded - │ │ │ │ + 0x00fd5bc0 57616c6c 202d6677 61726e2d 74616273 Wall -fwarn-tabs │ │ │ │ + 0x00fd5bd0 202d6675 6e626f78 2d737472 6963742d -funbox-strict- │ │ │ │ + 0x00fd5be0 6669656c 6473202d 4f320a00 7b2d2320 fields -O2..{-# │ │ │ │ + 0x00fd5bf0 4c414e47 55414745 20435050 20202020 LANGUAGE CPP │ │ │ │ + 0x00fd5c00 20202020 20202020 20232d7d 0a7b2d23 #-}.{-# │ │ │ │ + 0x00fd5c10 204c414e 47554147 45205465 6d706c61 LANGUAGE Templa │ │ │ │ + 0x00fd5c20 74654861 736b656c 6c20232d 7d0a0a7b teHaskell #-}..{ │ │ │ │ + 0x00fd5c30 2d0a0a4e 4f54453a 20446f6e 2774206d -..NOTE: Don't m │ │ │ │ + 0x00fd5c40 6f646966 79207468 69732066 696c6520 odify this file │ │ │ │ + 0x00fd5c50 756e6c65 73732079 6f75206b 6e6f7720 unless you know │ │ │ │ + 0x00fd5c60 77686174 20796f75 20617265 20646f69 what you are doi │ │ │ │ + 0x00fd5c70 6e672e20 20496620 796f7520 6172650a ng. If you are. │ │ │ │ + 0x00fd5c80 6e657720 746f2073 6e61702c 20737461 new to snap, sta │ │ │ │ + 0x00fd5c90 72742077 69746820 53697465 2e687320 rt with Site.hs │ │ │ │ + 0x00fd5ca0 616e6420 4170706c 69636174 696f6e2e and Application. │ │ │ │ + 0x00fd5cb0 68732e20 20546869 73206669 6c652063 hs. This file c │ │ │ │ + 0x00fd5cc0 6f6e7461 696e730a 626f696c 6572706c ontains.boilerpl │ │ │ │ + 0x00fd5cd0 61746520 6e656564 65642066 6f722064 ate needed for d │ │ │ │ + 0x00fd5ce0 796e616d 69632072 656c6f61 64696e67 ynamic reloading │ │ │ │ + 0x00fd5cf0 20616e64 20697320 6e6f7420 6d65616e and is not mean │ │ │ │ + 0x00fd5d00 7420666f 72206765 6e657261 6c0a636f t for general.co │ │ │ │ + 0x00fd5d10 6e73756d 7074696f 6e2e0a0a 4f636361 nsumption...Occa │ │ │ │ + 0x00fd5d20 73696f6e 616c6c79 20696620 7765206d sionally if we m │ │ │ │ + 0x00fd5d30 6f646966 79207468 65207761 79207468 odify the way th │ │ │ │ + 0x00fd5d40 65206479 6e616d69 63207265 6c6f6164 e dynamic reload │ │ │ │ + 0x00fd5d50 65722077 6f726b73 20616e64 20796f75 er works and you │ │ │ │ + 0x00fd5d60 2077616e 7420746f 0a757067 72616465 want to.upgrade │ │ │ │ + 0x00fd5d70 2c20796f 75206d69 67687420 68617665 , you might have │ │ │ │ + 0x00fd5d80 20746f20 73776170 206f7574 20746869 to swap out thi │ │ │ │ + 0x00fd5d90 73206669 6c652066 6f722061 206e6577 s file for a new │ │ │ │ + 0x00fd5da0 65722076 65727369 6f6e2e20 20427574 er version. But │ │ │ │ + 0x00fd5db0 20696e0a 6d6f7374 20636173 65732079 in.most cases y │ │ │ │ + 0x00fd5dc0 6f75276c 6c206e65 76657220 6e656564 ou'll never need │ │ │ │ + 0x00fd5dd0 20746f20 6d6f6469 66792074 68697320 to modify this │ │ │ │ + 0x00fd5de0 636f6465 2e0a0a2d 7d0a6d6f 64756c65 code...-}.module │ │ │ │ + 0x00fd5df0 204d6169 6e207768 6572650a 0a2d2d2d Main where..--- │ │ │ │ + 0x00fd5e00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd5e10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd5e20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd5e30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd5e40 2d2d2d2d 2d2d2d2d 2d2d2d0a 696d706f -----------.impo │ │ │ │ + 0x00fd5e50 72742020 20202020 20202020 20436f6e rt Con │ │ │ │ + 0x00fd5e60 74726f6c 2e457863 65707469 6f6e2028 trol.Exception ( │ │ │ │ + 0x00fd5e70 536f6d65 45786365 7074696f 6e2c2074 SomeException, t │ │ │ │ + 0x00fd5e80 7279290a 696d706f 72742071 75616c69 ry).import quali │ │ │ │ + 0x00fd5e90 66696564 20446174 612e5465 78742061 fied Data.Text a │ │ │ │ + 0x00fd5ea0 7320540a 696d706f 72742020 20202020 s T.import │ │ │ │ + 0x00fd5eb0 20202020 20536e61 702e4874 74702e53 Snap.Http.S │ │ │ │ + 0x00fd5ec0 65727665 720a696d 706f7274 20202020 erver.import │ │ │ │ + 0x00fd5ed0 20202020 20202053 6e61702e 536e6170 Snap.Snap │ │ │ │ + 0x00fd5ee0 6c65740a 696d706f 72742020 20202020 let.import │ │ │ │ + 0x00fd5ef0 20202020 20536e61 702e536e 61706c65 Snap.Snaple │ │ │ │ + 0x00fd5f00 742e436f 6e666967 0a696d70 6f727420 t.Config.import │ │ │ │ + 0x00fd5f10 20202020 20202020 2020536e 61702e43 Snap.C │ │ │ │ + 0x00fd5f20 6f72650a 696d706f 72742020 20202020 ore.import │ │ │ │ + 0x00fd5f30 20202020 20537973 74656d2e 494f0a69 System.IO.i │ │ │ │ + 0x00fd5f40 6d706f72 74202020 20202020 20202020 mport │ │ │ │ + 0x00fd5f50 53697465 0a0a2369 66646566 20444556 Site..#ifdef DEV │ │ │ │ + 0x00fd5f60 454c4f50 4d454e54 0a696d70 6f727420 ELOPMENT.import │ │ │ │ + 0x00fd5f70 20202020 20202020 2020536e 61702e4c Snap.L │ │ │ │ + 0x00fd5f80 6f616465 722e4479 6e616d69 630a2365 oader.Dynamic.#e │ │ │ │ + 0x00fd5f90 6c73650a 696d706f 72742020 20202020 lse.import │ │ │ │ + 0x00fd5fa0 20202020 20536e61 702e4c6f 61646572 Snap.Loader │ │ │ │ + 0x00fd5fb0 2e537461 7469630a 23656e64 69660a0a .Static.#endif.. │ │ │ │ + 0x00fd5fc0 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ + 0x00fd5fd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd5fe0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd5ff0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6000 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ + 0x00fd6010 2d2d207c 20546869 73206973 20746865 -- | This is the │ │ │ │ + 0x00fd6020 20656e74 72792070 6f696e74 20666f72 entry point for │ │ │ │ + 0x00fd6030 20746869 73207765 62207365 72766572 this web server │ │ │ │ + 0x00fd6040 20617070 6c696361 74696f6e 2e204974 application. It │ │ │ │ + 0x00fd6050 20737570 706f7274 730a2d2d 20656173 supports.-- eas │ │ │ │ + 0x00fd6060 696c7920 73776974 6368696e 67206265 ily switching be │ │ │ │ + 0x00fd6070 74776565 6e20696e 74657270 72657469 tween interpreti │ │ │ │ + 0x00fd6080 6e672073 6f757263 6520616e 64207275 ng source and ru │ │ │ │ + 0x00fd6090 6e6e696e 67207374 61746963 616c6c79 nning statically │ │ │ │ + 0x00fd60a0 20636f6d 70696c65 640a2d2d 20636f64 compiled.-- cod │ │ │ │ + 0x00fd60b0 652e0a2d 2d0a2d2d 20496e20 65697468 e..--.-- In eith │ │ │ │ + 0x00fd60c0 6572206d 6f64652c 20746865 2067656e er mode, the gen │ │ │ │ + 0x00fd60d0 65726174 65642070 726f6772 616d2073 erated program s │ │ │ │ + 0x00fd60e0 686f756c 64206265 2072756e 2066726f hould be run fro │ │ │ │ + 0x00fd60f0 6d207468 6520726f 6f74206f 66207468 m the root of th │ │ │ │ + 0x00fd6100 650a2d2d 2070726f 6a656374 20747265 e.-- project tre │ │ │ │ + 0x00fd6110 652e2057 68656e20 69742069 73207275 e. When it is ru │ │ │ │ + 0x00fd6120 6e2c2069 74206c6f 63617465 73206974 n, it locates it │ │ │ │ + 0x00fd6130 73207465 6d706c61 7465732c 20737461 s templates, sta │ │ │ │ + 0x00fd6140 74696320 636f6e74 656e742c 20616e64 tic content, and │ │ │ │ + 0x00fd6150 0a2d2d20 736f7572 63652066 696c6573 .-- source files │ │ │ │ + 0x00fd6160 20696e20 64657665 6c6f706d 656e7420 in development │ │ │ │ + 0x00fd6170 6d6f6465 2c207265 6c617469 76652074 mode, relative t │ │ │ │ + 0x00fd6180 6f207468 65206375 7272656e 7420776f o the current wo │ │ │ │ + 0x00fd6190 726b696e 67206469 72656374 6f72792e rking directory. │ │ │ │ + 0x00fd61a0 0a2d2d0a 2d2d2057 68656e20 636f6d70 .--.-- When comp │ │ │ │ + 0x00fd61b0 696c6564 20776974 68207468 65206465 iled with the de │ │ │ │ + 0x00fd61c0 76656c6f 706d656e 7420666c 61672c20 velopment flag, │ │ │ │ + 0x00fd61d0 6f6e6c79 20636861 6e676573 20746f20 only changes to │ │ │ │ + 0x00fd61e0 74686520 6c696272 61726965 732c2079 the libraries, y │ │ │ │ + 0x00fd61f0 6f75720a 2d2d2063 6162616c 2066696c our.-- cabal fil │ │ │ │ + 0x00fd6200 652c206f 72207468 69732066 696c6520 e, or this file │ │ │ │ + 0x00fd6210 73686f75 6c642072 65717569 72652061 should require a │ │ │ │ + 0x00fd6220 20726563 6f6d7069 6c652074 6f206265 recompile to be │ │ │ │ + 0x00fd6230 20706963 6b656420 75702e0a 2d2d2045 picked up..-- E │ │ │ │ + 0x00fd6240 76657279 7468696e 6720656c 73652069 verything else i │ │ │ │ + 0x00fd6250 7320696e 74657270 72657465 64206174 s interpreted at │ │ │ │ + 0x00fd6260 2072756e 74696d65 2e205468 65726520 runtime. There │ │ │ │ + 0x00fd6270 61726520 61206665 7720636f 6e736571 are a few conseq │ │ │ │ + 0x00fd6280 75656e63 6573206f 660a2d2d 20746869 uences of.-- thi │ │ │ │ + 0x00fd6290 732e0a2d 2d0a2d2d 20466972 73742c20 s..--.-- First, │ │ │ │ + 0x00fd62a0 74686973 20697320 6d756368 20736c6f this is much slo │ │ │ │ + 0x00fd62b0 7765722e 2052756e 6e696e67 20746865 wer. Running the │ │ │ │ + 0x00fd62c0 20696e74 65727072 65746572 2074616b interpreter tak │ │ │ │ + 0x00fd62d0 65732061 20736967 6e696669 63616e74 es a significant │ │ │ │ + 0x00fd62e0 0a2d2d20 6368756e 6b206f66 2074696d .-- chunk of tim │ │ │ │ + 0x00fd62f0 65202861 20636f75 706c6520 74656e74 e (a couple tent │ │ │ │ + 0x00fd6300 6873206f 66206120 7365636f 6e64206f hs of a second o │ │ │ │ + 0x00fd6310 6e207468 65206175 74686f72 2773206d n the author's m │ │ │ │ + 0x00fd6320 61636869 6e652c20 61742074 6869730a achine, at this. │ │ │ │ + 0x00fd6330 2d2d2074 696d6529 2c207265 67617264 -- time), regard │ │ │ │ + 0x00fd6340 6c657373 206f6620 74686520 73696d70 less of the simp │ │ │ │ + 0x00fd6350 6c696369 7479206f 66207468 65206c6f licity of the lo │ │ │ │ + 0x00fd6360 61646564 20636f64 652e2049 6e206f72 aded code. In or │ │ │ │ + 0x00fd6370 64657220 746f0a2d 2d207265 636f6d70 der to.-- recomp │ │ │ │ + 0x00fd6380 696c6520 616e6420 72652d6c 6f616420 ile and re-load │ │ │ │ + 0x00fd6390 73657276 65722073 74617465 20617320 server state as │ │ │ │ + 0x00fd63a0 696e6672 65717565 6e746c79 20617320 infrequently as │ │ │ │ + 0x00fd63b0 706f7373 69626c65 2c207468 6520736f possible, the so │ │ │ │ + 0x00fd63c0 75726365 0a2d2d20 64697265 63746f72 urce.-- director │ │ │ │ + 0x00fd63d0 69657320 61726520 77617463 68656420 ies are watched │ │ │ │ + 0x00fd63e0 666f7220 75706461 7465732c 20617320 for updates, as │ │ │ │ + 0x00fd63f0 61726520 616e7920 65787472 61206469 are any extra di │ │ │ │ + 0x00fd6400 72656374 6f726965 73207370 65636966 rectories specif │ │ │ │ + 0x00fd6410 6965640a 2d2d2062 656c6f77 2e0a2d2d ied.-- below..-- │ │ │ │ + 0x00fd6420 0a2d2d20 5365636f 6e642c20 74686520 .-- Second, the │ │ │ │ + 0x00fd6430 67656e65 72617465 64207365 72766572 generated server │ │ │ │ + 0x00fd6440 2062696e 61727920 6973204d 55434820 binary is MUCH │ │ │ │ + 0x00fd6450 6c617267 65722c20 73696e63 65206974 larger, since it │ │ │ │ + 0x00fd6460 206c696e 6b732069 6e207468 650a2d2d links in the.-- │ │ │ │ + 0x00fd6470 20474843 20415049 20287669 61207468 GHC API (via th │ │ │ │ + 0x00fd6480 65206869 6e74206c 69627261 7279292e e hint library). │ │ │ │ + 0x00fd6490 0a2d2d0a 2d2d2054 68697264 2c20616e .--.-- Third, an │ │ │ │ + 0x00fd64a0 64207468 65207265 61736f6e 20796f75 d the reason you │ │ │ │ + 0x00fd64b0 20776f75 6c642065 76657220 77616e74 would ever want │ │ │ │ + 0x00fd64c0 20746f20 61637475 616c6c79 20636f6d to actually com │ │ │ │ + 0x00fd64d0 70696c65 20776974 680a2d2d 20646576 pile with.-- dev │ │ │ │ + 0x00fd64e0 656c6f70 6d656e74 206d6f64 652c2069 elopment mode, i │ │ │ │ + 0x00fd64f0 73207468 61742069 7420656e 61626c65 s that it enable │ │ │ │ + 0x00fd6500 73206120 66617374 65722064 6576656c s a faster devel │ │ │ │ + 0x00fd6510 6f706d65 6e742063 79636c65 2e20596f opment cycle. Yo │ │ │ │ + 0x00fd6520 75206361 6e0a2d2d 2073696d 706c7920 u can.-- simply │ │ │ │ + 0x00fd6530 65646974 20612066 696c652c 20736176 edit a file, sav │ │ │ │ + 0x00fd6540 6520796f 75722063 68616e67 65732c20 e your changes, │ │ │ │ + 0x00fd6550 616e6420 68697420 72656c6f 61642074 and hit reload t │ │ │ │ + 0x00fd6560 6f207365 6520796f 75722063 68616e67 o see your chang │ │ │ │ + 0x00fd6570 65730a2d 2d207265 666c6563 74656420 es.-- reflected │ │ │ │ + 0x00fd6580 696d6d65 64696174 656c792e 0a2d2d0a immediately..--. │ │ │ │ + 0x00fd6590 2d2d2057 68656e20 74686973 20697320 -- When this is │ │ │ │ + 0x00fd65a0 636f6d70 696c6564 20776974 686f7574 compiled without │ │ │ │ + 0x00fd65b0 20746865 20646576 656c6f70 6d656e74 the development │ │ │ │ + 0x00fd65c0 20666c61 672c2061 6c6c2074 68652061 flag, all the a │ │ │ │ + 0x00fd65d0 6374696f 6e732061 72650a2d 2d207374 ctions are.-- st │ │ │ │ + 0x00fd65e0 61746963 616c6c79 20636f6d 70696c65 atically compile │ │ │ │ + 0x00fd65f0 6420696e 2e205468 69732072 6573756c d in. This resul │ │ │ │ + 0x00fd6600 74732069 6e206661 73746572 20657865 ts in faster exe │ │ │ │ + 0x00fd6610 63757469 6f6e2c20 6120736d 616c6c65 cution, a smalle │ │ │ │ + 0x00fd6620 72206269 6e617279 0a2d2d20 73697a65 r binary.-- size │ │ │ │ + 0x00fd6630 2c20616e 64206861 76696e67 20746f20 , and having to │ │ │ │ + 0x00fd6640 7265636f 6d70696c 65207468 65207365 recompile the se │ │ │ │ + 0x00fd6650 72766572 20666f72 20616e79 20636f64 rver for any cod │ │ │ │ + 0x00fd6660 65206368 616e6765 2e0a2d2d 0a6d6169 e change..--.mai │ │ │ │ + 0x00fd6670 6e203a3a 20494f20 28290a6d 61696e20 n :: IO ().main │ │ │ │ + 0x00fd6680 3d20646f 0a202020 202d2d20 44657065 = do. -- Depe │ │ │ │ + 0x00fd6690 6e64696e 67206f6e 20746865 20766572 nding on the ver │ │ │ │ + 0x00fd66a0 73696f6e 206f6620 6c6f6164 536e6170 sion of loadSnap │ │ │ │ + 0x00fd66b0 54482069 6e207363 6f70652c 20746869 TH in scope, thi │ │ │ │ + 0x00fd66c0 73206569 74686572 20656e61 626c6573 s either enables │ │ │ │ + 0x00fd66d0 0a202020 202d2d20 64796e61 6d696320 . -- dynamic │ │ │ │ + 0x00fd66e0 72656c6f 6164696e 672c206f 7220636f reloading, or co │ │ │ │ + 0x00fd66f0 6d70696c 65732069 74207769 74686f75 mpiles it withou │ │ │ │ + 0x00fd6700 742e2054 6865206c 61737420 61726775 t. The last argu │ │ │ │ + 0x00fd6710 6d656e74 20746f0a 20202020 2d2d206c ment to. -- l │ │ │ │ + 0x00fd6720 6f616453 6e617054 48206973 2061206c oadSnapTH is a l │ │ │ │ + 0x00fd6730 69737420 6f662061 64646974 696f6e61 ist of additiona │ │ │ │ + 0x00fd6740 6c206469 72656374 6f726965 7320746f l directories to │ │ │ │ + 0x00fd6750 20776174 63682066 6f722063 68616e67 watch for chang │ │ │ │ + 0x00fd6760 65732074 6f0a2020 20202d2d 20747269 es to. -- tri │ │ │ │ + 0x00fd6770 67676572 2072656c 6f616473 20696e20 gger reloads in │ │ │ │ + 0x00fd6780 64657665 6c6f706d 656e7420 6d6f6465 development mode │ │ │ │ + 0x00fd6790 2e204974 20646f65 736e2774 206e6565 . It doesn't nee │ │ │ │ + 0x00fd67a0 6420746f 20696e63 6c756465 20736f75 d to include sou │ │ │ │ + 0x00fd67b0 7263650a 20202020 2d2d2064 69726563 rce. -- direc │ │ │ │ + 0x00fd67c0 746f7269 65732c20 74686f73 65206172 tories, those ar │ │ │ │ + 0x00fd67d0 65207069 636b6564 20757020 6175746f e picked up auto │ │ │ │ + 0x00fd67e0 6d617469 63616c6c 79206279 20746865 matically by the │ │ │ │ + 0x00fd67f0 2073706c 6963652e 0a202020 2028636f splice.. (co │ │ │ │ + 0x00fd6800 6e662c20 73697465 2c20636c 65616e75 nf, site, cleanu │ │ │ │ + 0x00fd6810 7029203c 2d202428 6c6f6164 536e6170 p) <- $(loadSnap │ │ │ │ + 0x00fd6820 5448205b 7c206765 74436f6e 66207c5d TH [| getConf |] │ │ │ │ + 0x00fd6830 0a202020 20202020 20202020 20202020 . │ │ │ │ + 0x00fd6840 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd6850 20202020 20202020 20202027 67657441 'getA │ │ │ │ + 0x00fd6860 6374696f 6e730a20 20202020 20202020 ctions. │ │ │ │ + 0x00fd6870 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd6880 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd6890 205b2273 6e61706c 6574732f 68656973 ["snaplets/heis │ │ │ │ + 0x00fd68a0 742f7465 6d706c61 74657322 5d290a0a t/templates"]).. │ │ │ │ + 0x00fd68b0 20202020 5f203c2d 20747279 20242068 _ <- try $ h │ │ │ │ + 0x00fd68c0 74747053 65727665 20636f6e 66207369 ttpServe conf si │ │ │ │ + 0x00fd68d0 7465203a 3a20494f 20284569 74686572 te :: IO (Either │ │ │ │ + 0x00fd68e0 20536f6d 65457863 65707469 6f6e2028 SomeException ( │ │ │ │ + 0x00fd68f0 29290a20 20202063 6c65616e 75700a0a )). cleanup.. │ │ │ │ + 0x00fd6900 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ + 0x00fd6910 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6920 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6930 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6940 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ + 0x00fd6950 2d2d207c 20546869 73206163 74696f6e -- | This action │ │ │ │ + 0x00fd6960 206c6f61 64732074 68652063 6f6e6669 loads the confi │ │ │ │ + 0x00fd6970 67207573 65642062 79207468 69732061 g used by this a │ │ │ │ + 0x00fd6980 70706c69 63617469 6f6e2e20 54686520 pplication. The │ │ │ │ + 0x00fd6990 6c6f6164 65642063 6f6e6669 670a2d2d loaded config.-- │ │ │ │ + 0x00fd69a0 20697320 72657475 726e6564 20617320 is returned as │ │ │ │ + 0x00fd69b0 74686520 66697273 7420656c 656d656e the first elemen │ │ │ │ + 0x00fd69c0 74206f66 20746865 20747570 6c652070 t of the tuple p │ │ │ │ + 0x00fd69d0 726f6475 63656420 62792074 6865206c roduced by the l │ │ │ │ + 0x00fd69e0 6f616453 6e617054 480a2d2d 2053706c oadSnapTH.-- Spl │ │ │ │ + 0x00fd69f0 6963652e 20546865 20747970 65206973 ice. The type is │ │ │ │ + 0x00fd6a00 206e6f74 20736f6c 69646c79 20666978 not solidly fix │ │ │ │ + 0x00fd6a10 65642c20 74686f75 67682069 74206d75 ed, though it mu │ │ │ │ + 0x00fd6a20 73742062 6520616e 20494f20 61637469 st be an IO acti │ │ │ │ + 0x00fd6a30 6f6e2074 6861740a 2d2d2070 726f6475 on that.-- produ │ │ │ │ + 0x00fd6a40 63657320 74686520 73616d65 20747970 ces the same typ │ │ │ │ + 0x00fd6a50 65206173 20276765 74416374 696f6e73 e as 'getActions │ │ │ │ + 0x00fd6a60 27207461 6b65732e 20497420 616c736f ' takes. It also │ │ │ │ + 0x00fd6a70 206d7573 74206265 20616e20 696e7374 must be an inst │ │ │ │ + 0x00fd6a80 616e6365 206f660a 2d2d2054 79706561 ance of.-- Typea │ │ │ │ + 0x00fd6a90 626c652e 20496620 74686520 74797065 ble. If the type │ │ │ │ + 0x00fd6aa0 206f6620 74686973 20697320 6368616e of this is chan │ │ │ │ + 0x00fd6ab0 6765642c 20612066 756c6c20 7265636f ged, a full reco │ │ │ │ + 0x00fd6ac0 6d70696c 65207769 6c6c2062 65206e65 mpile will be ne │ │ │ │ + 0x00fd6ad0 65646564 20746f0a 2d2d2070 69636b20 eded to.-- pick │ │ │ │ + 0x00fd6ae0 75702074 68652063 68616e67 652c2065 up the change, e │ │ │ │ + 0x00fd6af0 76656e20 696e2064 6576656c 6f706d65 ven in developme │ │ │ │ + 0x00fd6b00 6e74206d 6f64652e 0a2d2d0a 2d2d2054 nt mode..--.-- T │ │ │ │ + 0x00fd6b10 68697320 61637469 6f6e2069 73206f6e his action is on │ │ │ │ + 0x00fd6b20 6c792072 756e206f 6e63652c 20726567 ly run once, reg │ │ │ │ + 0x00fd6b30 6172646c 65737320 6f662077 68657468 ardless of wheth │ │ │ │ + 0x00fd6b40 65722064 6576656c 6f706d65 6e74206f er development o │ │ │ │ + 0x00fd6b50 720a2d2d 2070726f 64756374 696f6e20 r.-- production │ │ │ │ + 0x00fd6b60 6d6f6465 20697320 696e2075 73652e0a mode is in use.. │ │ │ │ + 0x00fd6b70 67657443 6f6e6620 3a3a2049 4f202843 getConf :: IO (C │ │ │ │ + 0x00fd6b80 6f6e6669 6720536e 61702041 7070436f onfig Snap AppCo │ │ │ │ + 0x00fd6b90 6e666967 290a6765 74436f6e 66203d20 nfig).getConf = │ │ │ │ + 0x00fd6ba0 636f6d6d 616e644c 696e6541 7070436f commandLineAppCo │ │ │ │ + 0x00fd6bb0 6e666967 20646566 61756c74 436f6e66 nfig defaultConf │ │ │ │ + 0x00fd6bc0 69670a0a 0a2d2d2d 2d2d2d2d 2d2d2d2d ig...----------- │ │ │ │ + 0x00fd6bd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6be0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6bf0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6c00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6c10 2d2d2d0a 2d2d207c 20546869 73206675 ---.-- | This fu │ │ │ │ + 0x00fd6c20 6e637469 6f6e2067 656e6572 61746573 nction generates │ │ │ │ + 0x00fd6c30 20746865 20746865 20736974 65206861 the the site ha │ │ │ │ + 0x00fd6c40 6e646c65 7220616e 6420636c 65616e75 ndler and cleanu │ │ │ │ + 0x00fd6c50 70206163 74696f6e 2066726f 6d207468 p action from th │ │ │ │ + 0x00fd6c60 650a2d2d 20636f6e 66696775 72617469 e.-- configurati │ │ │ │ + 0x00fd6c70 6f6e2e20 496e2070 726f6475 6374696f on. In productio │ │ │ │ + 0x00fd6c80 6e206d6f 64652c20 74686973 20616374 n mode, this act │ │ │ │ + 0x00fd6c90 696f6e20 6973206f 6e6c7920 72756e20 ion is only run │ │ │ │ + 0x00fd6ca0 6f6e6365 2e20496e 0a2d2d20 64657665 once. In.-- deve │ │ │ │ + 0x00fd6cb0 6c6f706d 656e7420 6d6f6465 2c207468 lopment mode, th │ │ │ │ + 0x00fd6cc0 69732061 6374696f 6e206973 2072756e is action is run │ │ │ │ + 0x00fd6cd0 20776865 6e657665 72207468 65206170 whenever the ap │ │ │ │ + 0x00fd6ce0 706c6963 6174696f 6e206973 2072656c plication is rel │ │ │ │ + 0x00fd6cf0 6f616465 642e0a2d 2d0a2d2d 20446576 oaded..--.-- Dev │ │ │ │ + 0x00fd6d00 656c6f70 6d656e74 206d6f64 6520616c elopment mode al │ │ │ │ + 0x00fd6d10 736f206d 616b6573 20737572 65207468 so makes sure th │ │ │ │ + 0x00fd6d20 61742074 68652063 6c65616e 75702061 at the cleanup a │ │ │ │ + 0x00fd6d30 6374696f 6e732061 72652072 756e0a2d ctions are run.- │ │ │ │ + 0x00fd6d40 2d206170 70726f70 72696174 656c7920 - appropriately │ │ │ │ + 0x00fd6d50 6265666f 72652073 68757464 6f776e2e before shutdown. │ │ │ │ + 0x00fd6d60 20546865 20636c65 616e7570 20616374 The cleanup act │ │ │ │ + 0x00fd6d70 696f6e20 72657475 726e6564 2066726f ion returned fro │ │ │ │ + 0x00fd6d80 6d206c6f 6164536e 61705448 0a2d2d20 m loadSnapTH.-- │ │ │ │ + 0x00fd6d90 73686f75 6c642073 74696c6c 20626520 should still be │ │ │ │ + 0x00fd6da0 75736564 20616674 65722074 68652073 used after the s │ │ │ │ + 0x00fd6db0 65727665 72206861 73207374 6f707065 erver has stoppe │ │ │ │ + 0x00fd6dc0 64206861 6e646c69 6e672072 65717565 d handling reque │ │ │ │ + 0x00fd6dd0 7374732c 20617320 7468650a 2d2d2063 sts, as the.-- c │ │ │ │ + 0x00fd6de0 6c65616e 75702061 6374696f 6e732061 leanup actions a │ │ │ │ + 0x00fd6df0 7265206f 6e6c7920 6175746f 6d617469 re only automati │ │ │ │ + 0x00fd6e00 63616c6c 79207275 6e207768 656e2061 cally run when a │ │ │ │ + 0x00fd6e10 2072656c 6f616420 69732074 72696767 reload is trigg │ │ │ │ + 0x00fd6e20 65726564 2e0a2d2d 0a2d2d20 54686973 ered..--.-- This │ │ │ │ + 0x00fd6e30 2073616d 706c6520 646f6573 6e277420 sample doesn't │ │ │ │ + 0x00fd6e40 61637475 616c6c79 20757365 20746865 actually use the │ │ │ │ + 0x00fd6e50 20636f6e 66696720 70617373 65642069 config passed i │ │ │ │ + 0x00fd6e60 6e2c2062 7574206d 6f72650a 2d2d2073 n, but more.-- s │ │ │ │ + 0x00fd6e70 6f706869 73746963 61746564 20636f64 ophisticated cod │ │ │ │ + 0x00fd6e80 65206d69 6768742e 0a676574 41637469 e might..getActi │ │ │ │ + 0x00fd6e90 6f6e7320 3a3a2043 6f6e6669 6720536e ons :: Config Sn │ │ │ │ + 0x00fd6ea0 61702041 7070436f 6e666967 202d3e20 ap AppConfig -> │ │ │ │ + 0x00fd6eb0 494f2028 536e6170 2028292c 20494f20 IO (Snap (), IO │ │ │ │ + 0x00fd6ec0 2829290a 67657441 6374696f 6e732063 ()).getActions c │ │ │ │ + 0x00fd6ed0 6f6e6620 3d20646f 0a202020 20286d73 onf = do. (ms │ │ │ │ + 0x00fd6ee0 67732c20 73697465 2c20636c 65616e75 gs, site, cleanu │ │ │ │ + 0x00fd6ef0 7029203c 2d207275 6e536e61 706c6574 p) <- runSnaplet │ │ │ │ + 0x00fd6f00 0a202020 20202020 20286170 70456e76 . (appEnv │ │ │ │ + 0x00fd6f10 69726f6e 6d656e74 203d3c3c 20676574 ironment =<< get │ │ │ │ + 0x00fd6f20 4f746865 7220636f 6e662920 6170700a Other conf) app. │ │ │ │ + 0x00fd6f30 20202020 68507574 5374724c 6e207374 hPutStrLn st │ │ │ │ + 0x00fd6f40 64657272 20242054 2e756e70 61636b20 derr $ T.unpack │ │ │ │ + 0x00fd6f50 6d736773 0a202020 20726574 75726e20 msgs. return │ │ │ │ + 0x00fd6f60 28736974 652c2063 6c65616e 7570290a (site, cleanup). │ │ │ │ + 0x00fd6f70 007b2d23 204c414e 47554147 45204f76 .{-# LANGUAGE Ov │ │ │ │ + 0x00fd6f80 65726c6f 61646564 53747269 6e677320 erloadedStrings │ │ │ │ + 0x00fd6f90 232d7d0a 0a2d2d2d 2d2d2d2d 2d2d2d2d #-}..----------- │ │ │ │ + 0x00fd6fa0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6fb0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6fc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6fd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd6fe0 2d2d2d0a 2d2d207c 20546869 73206d6f ---.-- | This mo │ │ │ │ + 0x00fd6ff0 64756c65 20697320 77686572 6520616c dule is where al │ │ │ │ + 0x00fd7000 6c207468 6520726f 75746573 20616e64 l the routes and │ │ │ │ + 0x00fd7010 2068616e 646c6572 73206172 65206465 handlers are de │ │ │ │ + 0x00fd7020 66696e65 6420666f 7220796f 75720a2d fined for your.- │ │ │ │ + 0x00fd7030 2d207369 74652e20 54686520 27617070 - site. The 'app │ │ │ │ + 0x00fd7040 27206675 6e637469 6f6e2069 73207468 ' function is th │ │ │ │ + 0x00fd7050 6520696e 69746961 6c697a65 72207468 e initializer th │ │ │ │ + 0x00fd7060 61742063 6f6d6269 6e657320 65766572 at combines ever │ │ │ │ + 0x00fd7070 79746869 6e670a2d 2d20746f 67657468 ything.-- togeth │ │ │ │ + 0x00fd7080 65722061 6e642069 73206578 706f7274 er and is export │ │ │ │ + 0x00fd7090 65642062 79207468 6973206d 6f64756c ed by this modul │ │ │ │ + 0x00fd70a0 652e0a6d 6f64756c 65205369 74650a20 e..module Site. │ │ │ │ + 0x00fd70b0 20282061 70700a20 20292077 68657265 ( app. ) where │ │ │ │ + 0x00fd70c0 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ + 0x00fd70d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd70e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd70f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7100 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7110 0a696d70 6f727420 20202020 20202020 .import │ │ │ │ + 0x00fd7120 2020436f 6e74726f 6c2e4170 706c6963 Control.Applic │ │ │ │ + 0x00fd7130 61746976 650a696d 706f7274 20202020 ative.import │ │ │ │ + 0x00fd7140 20202020 20202044 6174612e 42797465 Data.Byte │ │ │ │ + 0x00fd7150 53747269 6e672028 42797465 53747269 String (ByteStri │ │ │ │ + 0x00fd7160 6e67290a 696d706f 72742020 20202020 ng).import │ │ │ │ + 0x00fd7170 20202020 20446174 612e4d61 702e5379 Data.Map.Sy │ │ │ │ + 0x00fd7180 6e746178 20282823 2329290a 696d706f ntax ((##)).impo │ │ │ │ + 0x00fd7190 72742071 75616c69 66696564 20446174 rt qualified Dat │ │ │ │ + 0x00fd71a0 612e5465 78742061 7320540a 696d706f a.Text as T.impo │ │ │ │ + 0x00fd71b0 72742020 20202020 20202020 20536e61 rt Sna │ │ │ │ + 0x00fd71c0 702e436f 72650a69 6d706f72 74202020 p.Core.import │ │ │ │ + 0x00fd71d0 20202020 20202020 536e6170 2e536e61 Snap.Sna │ │ │ │ + 0x00fd71e0 706c6574 0a696d70 6f727420 20202020 plet.import │ │ │ │ + 0x00fd71f0 20202020 2020536e 61702e53 6e61706c Snap.Snapl │ │ │ │ + 0x00fd7200 65742e41 7574680a 696d706f 72742020 et.Auth.import │ │ │ │ + 0x00fd7210 20202020 20202020 20536e61 702e536e Snap.Sn │ │ │ │ + 0x00fd7220 61706c65 742e4175 74682e42 61636b65 aplet.Auth.Backe │ │ │ │ + 0x00fd7230 6e64732e 4a736f6e 46696c65 0a696d70 nds.JsonFile.imp │ │ │ │ + 0x00fd7240 6f727420 20202020 20202020 2020536e ort Sn │ │ │ │ + 0x00fd7250 61702e53 6e61706c 65742e48 65697374 ap.Snaplet.Heist │ │ │ │ + 0x00fd7260 0a696d70 6f727420 20202020 20202020 .import │ │ │ │ + 0x00fd7270 2020536e 61702e53 6e61706c 65742e53 Snap.Snaplet.S │ │ │ │ + 0x00fd7280 65737369 6f6e2e42 61636b65 6e64732e ession.Backends. │ │ │ │ + 0x00fd7290 436f6f6b 69655365 7373696f 6e0a696d CookieSession.im │ │ │ │ + 0x00fd72a0 706f7274 20202020 20202020 20202053 port S │ │ │ │ + 0x00fd72b0 6e61702e 5574696c 2e46696c 65536572 nap.Util.FileSer │ │ │ │ + 0x00fd72c0 76650a69 6d706f72 74207175 616c6966 ve.import qualif │ │ │ │ + 0x00fd72d0 69656420 48656973 742e496e 74657270 ied Heist.Interp │ │ │ │ + 0x00fd72e0 72657465 64206173 20490a2d 2d2d2d2d reted as I.----- │ │ │ │ + 0x00fd72f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ 0x00fd7300 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ 0x00fd7310 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ 0x00fd7320 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7330 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7340 2d2d2d2d 0a2d2d20 7c204c6f 6773206f ----.-- | Logs o │ │ │ │ - 0x00fd7350 75742061 6e642072 65646972 65637473 ut and redirects │ │ │ │ - 0x00fd7360 20746865 20757365 7220746f 20746865 the user to the │ │ │ │ - 0x00fd7370 20736974 6520696e 6465782e 0a68616e site index..han │ │ │ │ - 0x00fd7380 646c654c 6f676f75 74203a3a 2048616e dleLogout :: Han │ │ │ │ - 0x00fd7390 646c6572 20417070 20284175 74684d61 dler App (AuthMa │ │ │ │ - 0x00fd73a0 6e616765 72204170 70292028 290a6861 nager App) ().ha │ │ │ │ - 0x00fd73b0 6e646c65 4c6f676f 7574203d 206c6f67 ndleLogout = log │ │ │ │ - 0x00fd73c0 6f757420 3e3e2072 65646972 65637420 out >> redirect │ │ │ │ - 0x00fd73d0 222f220a 0a0a2d2d 2d2d2d2d 2d2d2d2d "/"...---------- │ │ │ │ - 0x00fd73e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd73f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7400 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7410 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7420 2d2d2d2d 0a2d2d20 7c204861 6e646c65 ----.-- | Handle │ │ │ │ - 0x00fd7430 206e6577 20757365 7220666f 726d2073 new user form s │ │ │ │ - 0x00fd7440 75626d69 740a6861 6e646c65 4e657755 ubmit.handleNewU │ │ │ │ - 0x00fd7450 73657220 3a3a2048 616e646c 65722041 ser :: Handler A │ │ │ │ - 0x00fd7460 70702028 41757468 4d616e61 67657220 pp (AuthManager │ │ │ │ - 0x00fd7470 41707029 2028290a 68616e64 6c654e65 App) ().handleNe │ │ │ │ - 0x00fd7480 77557365 72203d20 6d657468 6f642047 wUser = method G │ │ │ │ - 0x00fd7490 45542068 616e646c 65466f72 6d203c7c ET handleForm <| │ │ │ │ - 0x00fd74a0 3e206d65 74686f64 20504f53 54206861 > method POST ha │ │ │ │ - 0x00fd74b0 6e646c65 466f726d 5375626d 69740a20 ndleFormSubmit. │ │ │ │ - 0x00fd74c0 20776865 72650a20 20202068 616e646c where. handl │ │ │ │ - 0x00fd74d0 65466f72 6d203d20 72656e64 65722022 eForm = render " │ │ │ │ - 0x00fd74e0 6e65775f 75736572 220a2020 20206861 new_user". ha │ │ │ │ - 0x00fd74f0 6e646c65 466f726d 5375626d 6974203d ndleFormSubmit = │ │ │ │ - 0x00fd7500 20726567 69737465 72557365 7220226c registerUser "l │ │ │ │ - 0x00fd7510 6f67696e 22202270 61737377 6f726422 ogin" "password" │ │ │ │ - 0x00fd7520 203e3e20 72656469 72656374 20222f22 >> redirect "/" │ │ │ │ - 0x00fd7530 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...------------- │ │ │ │ - 0x00fd7540 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7550 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7560 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7570 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7580 2d0a2d2d 207c2054 68652061 70706c69 -.-- | The appli │ │ │ │ - 0x00fd7590 63617469 6f6e2773 20726f75 7465732e cation's routes. │ │ │ │ - 0x00fd75a0 0a726f75 74657320 3a3a205b 28427974 .routes :: [(Byt │ │ │ │ - 0x00fd75b0 65537472 696e672c 2048616e 646c6572 eString, Handler │ │ │ │ - 0x00fd75c0 20417070 20417070 20282929 5d0a726f App App ())].ro │ │ │ │ - 0x00fd75d0 75746573 203d205b 2028226c 6f67696e utes = [ ("login │ │ │ │ - 0x00fd75e0 222c2020 20207769 74682061 75746820 ", with auth │ │ │ │ - 0x00fd75f0 68616e64 6c654c6f 67696e53 75626d69 handleLoginSubmi │ │ │ │ - 0x00fd7600 74290a20 20202020 20202020 2c202822 t). , (" │ │ │ │ - 0x00fd7610 6c6f676f 7574222c 20202077 69746820 logout", with │ │ │ │ - 0x00fd7620 61757468 2068616e 646c654c 6f676f75 auth handleLogou │ │ │ │ - 0x00fd7630 74290a20 20202020 20202020 2c202822 t). , (" │ │ │ │ - 0x00fd7640 6e65775f 75736572 222c2077 69746820 new_user", with │ │ │ │ - 0x00fd7650 61757468 2068616e 646c654e 65775573 auth handleNewUs │ │ │ │ - 0x00fd7660 6572290a 20202020 20202020 202c2028 er). , ( │ │ │ │ - 0x00fd7670 22222c20 20202020 20202020 73657276 "", serv │ │ │ │ - 0x00fd7680 65446972 6563746f 72792022 73746174 eDirectory "stat │ │ │ │ - 0x00fd7690 69632229 0a202020 20202020 20205d0a ic"). ]. │ │ │ │ - 0x00fd76a0 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ - 0x00fd76b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd76c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd76d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7330 2d2d2d2d 2d2d2d2d 2d0a696d 706f7274 ---------.import │ │ │ │ + 0x00fd7340 20202020 20202020 20202041 70706c69 Appli │ │ │ │ + 0x00fd7350 63617469 6f6e0a0a 0a2d2d2d 2d2d2d2d cation...------- │ │ │ │ + 0x00fd7360 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7370 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7380 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7390 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd73a0 2d2d2d2d 2d2d2d0a 2d2d207c 2052656e -------.-- | Ren │ │ │ │ + 0x00fd73b0 64657220 6c6f6769 6e20666f 726d0a68 der login form.h │ │ │ │ + 0x00fd73c0 616e646c 654c6f67 696e203a 3a204d61 andleLogin :: Ma │ │ │ │ + 0x00fd73d0 79626520 542e5465 7874202d 3e204861 ybe T.Text -> Ha │ │ │ │ + 0x00fd73e0 6e646c65 72204170 70202841 7574684d ndler App (AuthM │ │ │ │ + 0x00fd73f0 616e6167 65722041 70702920 28290a68 anager App) ().h │ │ │ │ + 0x00fd7400 616e646c 654c6f67 696e2061 75746845 andleLogin authE │ │ │ │ + 0x00fd7410 72726f72 203d2068 65697374 4c6f6361 rror = heistLoca │ │ │ │ + 0x00fd7420 6c202849 2e62696e 6453706c 69636573 l (I.bindSplices │ │ │ │ + 0x00fd7430 20657272 73292024 2072656e 64657220 errs) $ render │ │ │ │ + 0x00fd7440 226c6f67 696e220a 20207768 6572650a "login". where. │ │ │ │ + 0x00fd7450 20202020 65727273 203d206d 61796265 errs = maybe │ │ │ │ + 0x00fd7460 206d656d 70747920 73706c69 63652061 mempty splice a │ │ │ │ + 0x00fd7470 75746845 72726f72 0a202020 2073706c uthError. spl │ │ │ │ + 0x00fd7480 69636520 65727220 3d20226c 6f67696e ice err = "login │ │ │ │ + 0x00fd7490 4572726f 72222023 2320492e 74657874 Error" ## I.text │ │ │ │ + 0x00fd74a0 53706c69 63652065 72720a0a 0a2d2d2d Splice err...--- │ │ │ │ + 0x00fd74b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd74c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd74d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd74e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd74f0 2d2d2d2d 2d2d2d2d 2d2d2d0a 2d2d207c -----------.-- | │ │ │ │ + 0x00fd7500 2048616e 646c6520 6c6f6769 6e207375 Handle login su │ │ │ │ + 0x00fd7510 626d6974 0a68616e 646c654c 6f67696e bmit.handleLogin │ │ │ │ + 0x00fd7520 5375626d 6974203a 3a204861 6e646c65 Submit :: Handle │ │ │ │ + 0x00fd7530 72204170 70202841 7574684d 616e6167 r App (AuthManag │ │ │ │ + 0x00fd7540 65722041 70702920 28290a68 616e646c er App) ().handl │ │ │ │ + 0x00fd7550 654c6f67 696e5375 626d6974 203d0a20 eLoginSubmit =. │ │ │ │ + 0x00fd7560 2020206c 6f67696e 55736572 20226c6f loginUser "lo │ │ │ │ + 0x00fd7570 67696e22 20227061 7373776f 72642220 gin" "password" │ │ │ │ + 0x00fd7580 4e6f7468 696e670a 20202020 20202020 Nothing. │ │ │ │ + 0x00fd7590 20202020 2020285c 5f202d3e 2068616e (\_ -> han │ │ │ │ + 0x00fd75a0 646c654c 6f67696e 20657272 29202872 dleLogin err) (r │ │ │ │ + 0x00fd75b0 65646972 65637420 222f2229 0a202077 edirect "/"). w │ │ │ │ + 0x00fd75c0 68657265 0a202020 20657272 203d204a here. err = J │ │ │ │ + 0x00fd75d0 75737420 22556e6b 6e6f776e 20757365 ust "Unknown use │ │ │ │ + 0x00fd75e0 72206f72 20706173 73776f72 64220a0a r or password".. │ │ │ │ + 0x00fd75f0 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ + 0x00fd7600 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7610 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7620 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7630 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ + 0x00fd7640 2d2d207c 204c6f67 73206f75 7420616e -- | Logs out an │ │ │ │ + 0x00fd7650 64207265 64697265 63747320 74686520 d redirects the │ │ │ │ + 0x00fd7660 75736572 20746f20 74686520 73697465 user to the site │ │ │ │ + 0x00fd7670 20696e64 65782e0a 68616e64 6c654c6f index..handleLo │ │ │ │ + 0x00fd7680 676f7574 203a3a20 48616e64 6c657220 gout :: Handler │ │ │ │ + 0x00fd7690 41707020 28417574 684d616e 61676572 App (AuthManager │ │ │ │ + 0x00fd76a0 20417070 29202829 0a68616e 646c654c App) ().handleL │ │ │ │ + 0x00fd76b0 6f676f75 74203d20 6c6f676f 7574203e ogout = logout > │ │ │ │ + 0x00fd76c0 3e207265 64697265 63742022 2f220a0a > redirect "/".. │ │ │ │ + 0x00fd76d0 0a2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d .--------------- │ │ │ │ 0x00fd76e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd76f0 0a2d2d20 7c205468 65206170 706c6963 .-- | The applic │ │ │ │ - 0x00fd7700 6174696f 6e20696e 69746961 6c697a65 ation initialize │ │ │ │ - 0x00fd7710 722e0a61 7070203a 3a20536e 61706c65 r..app :: Snaple │ │ │ │ - 0x00fd7720 74496e69 74204170 70204170 700a6170 tInit App App.ap │ │ │ │ - 0x00fd7730 70203d20 6d616b65 536e6170 6c657420 p = makeSnaplet │ │ │ │ - 0x00fd7740 22617070 22202241 6e20736e 61706c65 "app" "An snaple │ │ │ │ - 0x00fd7750 74206578 616d706c 65206170 706c6963 t example applic │ │ │ │ - 0x00fd7760 6174696f 6e2e2220 4e6f7468 696e6720 ation." Nothing │ │ │ │ - 0x00fd7770 2420646f 0a202020 2068203c 2d206e65 $ do. h <- ne │ │ │ │ - 0x00fd7780 7374536e 61706c65 74202222 20686569 stSnaplet "" hei │ │ │ │ - 0x00fd7790 73742024 20686569 7374496e 69742022 st $ heistInit " │ │ │ │ - 0x00fd77a0 74656d70 6c617465 73220a20 20202073 templates". s │ │ │ │ - 0x00fd77b0 203c2d20 6e657374 536e6170 6c657420 <- nestSnaplet │ │ │ │ - 0x00fd77c0 22736573 73222073 65737320 240a2020 "sess" sess $. │ │ │ │ - 0x00fd77d0 20202020 20202020 20696e69 74436f6f initCoo │ │ │ │ - 0x00fd77e0 6b696553 65737369 6f6e4d61 6e616765 kieSessionManage │ │ │ │ - 0x00fd77f0 72202273 6974655f 6b65792e 74787422 r "site_key.txt" │ │ │ │ - 0x00fd7800 20227365 73732220 4e6f7468 696e6720 "sess" Nothing │ │ │ │ - 0x00fd7810 284a7573 74203336 3030290a 0a202020 (Just 3600).. │ │ │ │ - 0x00fd7820 202d2d20 4e4f5445 3a205765 27726520 -- NOTE: We're │ │ │ │ - 0x00fd7830 7573696e 6720696e 69744a73 6f6e4669 using initJsonFi │ │ │ │ - 0x00fd7840 6c654175 74684d61 6e616765 72206865 leAuthManager he │ │ │ │ - 0x00fd7850 72652062 65636175 73652069 74277320 re because it's │ │ │ │ - 0x00fd7860 65617379 20616e64 0a202020 202d2d20 easy and. -- │ │ │ │ - 0x00fd7870 646f6573 6e277420 72657175 69726520 doesn't require │ │ │ │ - 0x00fd7880 616e7920 6b696e64 206f6620 64617461 any kind of data │ │ │ │ - 0x00fd7890 62617365 20736572 76657220 746f2072 base server to r │ │ │ │ - 0x00fd78a0 756e2e20 20496e20 70726163 74696365 un. In practice │ │ │ │ - 0x00fd78b0 2c0a2020 20202d2d 20796f75 276c6c20 ,. -- you'll │ │ │ │ - 0x00fd78c0 70726f62 61626c79 2077616e 7420746f probably want to │ │ │ │ - 0x00fd78d0 20636861 6e676520 74686973 20746f20 change this to │ │ │ │ - 0x00fd78e0 61206d6f 72652072 6f627573 74206175 a more robust au │ │ │ │ - 0x00fd78f0 74682062 61636b65 6e642e0a 20202020 th backend.. │ │ │ │ - 0x00fd7900 61203c2d 206e6573 74536e61 706c6574 a <- nestSnaplet │ │ │ │ - 0x00fd7910 20226175 74682220 61757468 20240a20 "auth" auth $. │ │ │ │ - 0x00fd7920 20202020 20202020 2020696e 69744a73 initJs │ │ │ │ - 0x00fd7930 6f6e4669 6c654175 74684d61 6e616765 onFileAuthManage │ │ │ │ - 0x00fd7940 72206465 66417574 68536574 74696e67 r defAuthSetting │ │ │ │ - 0x00fd7950 73207365 73732022 75736572 732e6a73 s sess "users.js │ │ │ │ - 0x00fd7960 6f6e220a 20202020 61646452 6f757465 on". addRoute │ │ │ │ - 0x00fd7970 7320726f 75746573 0a202020 20616464 s routes. add │ │ │ │ - 0x00fd7980 41757468 53706c69 63657320 68206175 AuthSplices h au │ │ │ │ - 0x00fd7990 74680a20 20202072 65747572 6e202420 th. return $ │ │ │ │ - 0x00fd79a0 41707020 68207320 610a0a00 2e2f7372 App h s a..../sr │ │ │ │ - 0x00fd79b0 632f5369 74652e68 73007b2d 23204c41 c/Site.hs.{-# LA │ │ │ │ - 0x00fd79c0 4e475541 47452054 656d706c 61746548 NGUAGE TemplateH │ │ │ │ - 0x00fd79d0 61736b65 6c6c2023 2d7d0a0a 2d2d2d2d askell #-}..---- │ │ │ │ - 0x00fd79e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd79f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7a00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7a10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7a20 2d2d2d2d 2d2d2d2d 2d2d0a2d 2d207c20 ----------.-- | │ │ │ │ - 0x00fd7a30 54686973 206d6f64 756c6520 64656669 This module defi │ │ │ │ - 0x00fd7a40 6e657320 6f757220 6170706c 69636174 nes our applicat │ │ │ │ - 0x00fd7a50 696f6e27 73207374 61746520 74797065 ion's state type │ │ │ │ - 0x00fd7a60 20616e64 20616e20 616c6961 7320666f and an alias fo │ │ │ │ - 0x00fd7a70 72206974 730a2d2d 2068616e 646c6572 r its.-- handler │ │ │ │ - 0x00fd7a80 206d6f6e 61642e0a 6d6f6475 6c652041 monad..module A │ │ │ │ - 0x00fd7a90 70706c69 63617469 6f6e2077 68657265 pplication where │ │ │ │ - 0x00fd7aa0 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ - 0x00fd7ab0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7ac0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7ad0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7ae0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7af0 0a696d70 6f727420 436f6e74 726f6c2e .import Control. │ │ │ │ - 0x00fd7b00 4c656e73 0a696d70 6f727420 536e6170 Lens.import Snap │ │ │ │ - 0x00fd7b10 2e536e61 706c6574 0a696d70 6f727420 .Snaplet.import │ │ │ │ - 0x00fd7b20 536e6170 2e536e61 706c6574 2e486569 Snap.Snaplet.Hei │ │ │ │ - 0x00fd7b30 73740a69 6d706f72 7420536e 61702e53 st.import Snap.S │ │ │ │ - 0x00fd7b40 6e61706c 65742e41 7574680a 696d706f naplet.Auth.impo │ │ │ │ - 0x00fd7b50 72742053 6e61702e 536e6170 6c65742e rt Snap.Snaplet. │ │ │ │ - 0x00fd7b60 53657373 696f6e0a 0a2d2d2d 2d2d2d2d Session..------- │ │ │ │ - 0x00fd7b70 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7b80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7b90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7ba0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7bb0 2d2d2d2d 2d2d2d0a 64617461 20417070 -------.data App │ │ │ │ - 0x00fd7bc0 203d2041 70700a20 2020207b 205f6865 = App. { _he │ │ │ │ - 0x00fd7bd0 69737420 3a3a2053 6e61706c 65742028 ist :: Snaplet ( │ │ │ │ - 0x00fd7be0 48656973 74204170 70290a20 2020202c Heist App). , │ │ │ │ - 0x00fd7bf0 205f7365 7373203a 3a20536e 61706c65 _sess :: Snaple │ │ │ │ - 0x00fd7c00 74205365 7373696f 6e4d616e 61676572 t SessionManager │ │ │ │ - 0x00fd7c10 0a202020 202c205f 61757468 203a3a20 . , _auth :: │ │ │ │ - 0x00fd7c20 536e6170 6c657420 28417574 684d616e Snaplet (AuthMan │ │ │ │ - 0x00fd7c30 61676572 20417070 290a2020 20207d0a ager App). }. │ │ │ │ - 0x00fd7c40 0a6d616b 654c656e 73657320 27274170 .makeLenses ''Ap │ │ │ │ - 0x00fd7c50 700a0a69 6e737461 6e636520 48617348 p..instance HasH │ │ │ │ - 0x00fd7c60 65697374 20417070 20776865 72650a20 eist App where. │ │ │ │ - 0x00fd7c70 20202068 65697374 4c656e73 203d2073 heistLens = s │ │ │ │ - 0x00fd7c80 7562536e 61706c65 74206865 6973740a ubSnaplet heist. │ │ │ │ - 0x00fd7c90 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..-------------- │ │ │ │ - 0x00fd7ca0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7cb0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7cc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7cd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7ce0 0a747970 65204170 7048616e 646c6572 .type AppHandler │ │ │ │ - 0x00fd7cf0 203d2048 616e646c 65722041 70702041 = Handler App A │ │ │ │ - 0x00fd7d00 70700a0a 0a002e2f 7372632f 4170706c pp...../src/Appl │ │ │ │ - 0x00fd7d10 69636174 696f6e2e 6873007b 2d23204c ication.hs.{-# L │ │ │ │ - 0x00fd7d20 414e4755 41474520 43505020 20202020 ANGUAGE CPP │ │ │ │ - 0x00fd7d30 20202020 20202020 232d7d0a 7b2d2320 #-}.{-# │ │ │ │ - 0x00fd7d40 4c414e47 55414745 2054656d 706c6174 LANGUAGE Templat │ │ │ │ - 0x00fd7d50 65486173 6b656c6c 20232d7d 0a0a7b2d eHaskell #-}..{- │ │ │ │ - 0x00fd7d60 0a0a4e4f 54453a20 446f6e27 74206d6f ..NOTE: Don't mo │ │ │ │ - 0x00fd7d70 64696679 20746869 73206669 6c652075 dify this file u │ │ │ │ - 0x00fd7d80 6e6c6573 7320796f 75206b6e 6f772077 nless you know w │ │ │ │ - 0x00fd7d90 68617420 796f7520 61726520 646f696e hat you are doin │ │ │ │ - 0x00fd7da0 672e2020 49662079 6f752061 72650a6e g. If you are.n │ │ │ │ - 0x00fd7db0 65772074 6f20736e 61702c20 73746172 ew to snap, star │ │ │ │ - 0x00fd7dc0 74207769 74682053 6974652e 68732061 t with Site.hs a │ │ │ │ - 0x00fd7dd0 6e642041 70706c69 63617469 6f6e2e68 nd Application.h │ │ │ │ - 0x00fd7de0 732e2020 54686973 2066696c 6520636f s. This file co │ │ │ │ - 0x00fd7df0 6e746169 6e730a62 6f696c65 72706c61 ntains.boilerpla │ │ │ │ - 0x00fd7e00 7465206e 65656465 6420666f 72206479 te needed for dy │ │ │ │ - 0x00fd7e10 6e616d69 63207265 6c6f6164 696e6720 namic reloading │ │ │ │ - 0x00fd7e20 616e6420 6973206e 6f74206d 65616e74 and is not meant │ │ │ │ - 0x00fd7e30 20666f72 2067656e 6572616c 0a636f6e for general.con │ │ │ │ - 0x00fd7e40 73756d70 74696f6e 2e0a0a4f 63636173 sumption...Occas │ │ │ │ - 0x00fd7e50 696f6e61 6c6c7920 69662077 65206d6f ionally if we mo │ │ │ │ - 0x00fd7e60 64696679 20746865 20776179 20746865 dify the way the │ │ │ │ - 0x00fd7e70 2064796e 616d6963 2072656c 6f616465 dynamic reloade │ │ │ │ - 0x00fd7e80 7220776f 726b7320 616e6420 796f7520 r works and you │ │ │ │ - 0x00fd7e90 77616e74 20746f0a 75706772 6164652c want to.upgrade, │ │ │ │ - 0x00fd7ea0 20796f75 206d6967 68742068 61766520 you might have │ │ │ │ - 0x00fd7eb0 746f2073 77617020 6f757420 74686973 to swap out this │ │ │ │ - 0x00fd7ec0 2066696c 6520666f 72206120 6e657765 file for a newe │ │ │ │ - 0x00fd7ed0 72207665 7273696f 6e2e2020 42757420 r version. But │ │ │ │ - 0x00fd7ee0 696e0a6d 6f737420 63617365 7320796f in.most cases yo │ │ │ │ - 0x00fd7ef0 75276c6c 206e6576 6572206e 65656420 u'll never need │ │ │ │ - 0x00fd7f00 746f206d 6f646966 79207468 69732063 to modify this c │ │ │ │ - 0x00fd7f10 6f64652e 0a0a2d7d 0a6d6f64 756c6520 ode...-}.module │ │ │ │ - 0x00fd7f20 4d61696e 20776865 72650a0a 2d2d2d2d Main where..---- │ │ │ │ - 0x00fd7f30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7f40 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7f50 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7f60 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd7f70 2d2d2d2d 2d2d2d2d 2d2d0a69 6d706f72 ----------.impor │ │ │ │ - 0x00fd7f80 74202020 20202020 20202020 436f6e74 t Cont │ │ │ │ - 0x00fd7f90 726f6c2e 45786365 7074696f 6e202853 rol.Exception (S │ │ │ │ - 0x00fd7fa0 6f6d6545 78636570 74696f6e 2c207472 omeException, tr │ │ │ │ - 0x00fd7fb0 79290a69 6d706f72 74207175 616c6966 y).import qualif │ │ │ │ - 0x00fd7fc0 69656420 44617461 2e546578 74206173 ied Data.Text as │ │ │ │ - 0x00fd7fd0 20540a69 6d706f72 74202020 20202020 T.import │ │ │ │ - 0x00fd7fe0 20202020 536e6170 2e487474 702e5365 Snap.Http.Se │ │ │ │ - 0x00fd7ff0 72766572 0a696d70 6f727420 20202020 rver.import │ │ │ │ - 0x00fd8000 20202020 2020536e 61702e53 6e61706c Snap.Snapl │ │ │ │ - 0x00fd8010 65740a69 6d706f72 74202020 20202020 et.import │ │ │ │ - 0x00fd8020 20202020 536e6170 2e536e61 706c6574 Snap.Snaplet │ │ │ │ - 0x00fd8030 2e436f6e 6669670a 696d706f 72742020 .Config.import │ │ │ │ - 0x00fd8040 20202020 20202020 20536e61 702e436f Snap.Co │ │ │ │ - 0x00fd8050 72650a69 6d706f72 74202020 20202020 re.import │ │ │ │ - 0x00fd8060 20202020 53797374 656d2e49 4f0a696d System.IO.im │ │ │ │ - 0x00fd8070 706f7274 20202020 20202020 20202053 port S │ │ │ │ - 0x00fd8080 6974650a 0a236966 64656620 44455645 ite..#ifdef DEVE │ │ │ │ - 0x00fd8090 4c4f504d 454e540a 696d706f 72742020 LOPMENT.import │ │ │ │ - 0x00fd80a0 20202020 20202020 20536e61 702e4c6f Snap.Lo │ │ │ │ - 0x00fd80b0 61646572 2e44796e 616d6963 0a23656c ader.Dynamic.#el │ │ │ │ - 0x00fd80c0 73650a69 6d706f72 74202020 20202020 se.import │ │ │ │ - 0x00fd80d0 20202020 536e6170 2e4c6f61 6465722e Snap.Loader. │ │ │ │ - 0x00fd80e0 53746174 69630a23 656e6469 660a0a0a Static.#endif... │ │ │ │ - 0x00fd80f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8100 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8110 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8120 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8130 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d0a2d --------------.- │ │ │ │ - 0x00fd8140 2d207c20 54686973 20697320 74686520 - | This is the │ │ │ │ - 0x00fd8150 656e7472 7920706f 696e7420 666f7220 entry point for │ │ │ │ - 0x00fd8160 74686973 20776562 20736572 76657220 this web server │ │ │ │ - 0x00fd8170 6170706c 69636174 696f6e2e 20497420 application. It │ │ │ │ - 0x00fd8180 73757070 6f727473 0a2d2d20 65617369 supports.-- easi │ │ │ │ - 0x00fd8190 6c792073 77697463 68696e67 20626574 ly switching bet │ │ │ │ - 0x00fd81a0 7765656e 20696e74 65727072 6574696e ween interpretin │ │ │ │ - 0x00fd81b0 6720736f 75726365 20616e64 2072756e g source and run │ │ │ │ - 0x00fd81c0 6e696e67 20737461 74696361 6c6c7920 ning statically │ │ │ │ - 0x00fd81d0 636f6d70 696c6564 0a2d2d20 636f6465 compiled.-- code │ │ │ │ - 0x00fd81e0 2e0a2d2d 0a2d2d20 496e2065 69746865 ..--.-- In eithe │ │ │ │ - 0x00fd81f0 72206d6f 64652c20 74686520 67656e65 r mode, the gene │ │ │ │ - 0x00fd8200 72617465 64207072 6f677261 6d207368 rated program sh │ │ │ │ - 0x00fd8210 6f756c64 20626520 72756e20 66726f6d ould be run from │ │ │ │ - 0x00fd8220 20746865 20726f6f 74206f66 20746865 the root of the │ │ │ │ - 0x00fd8230 0a2d2d20 70726f6a 65637420 74726565 .-- project tree │ │ │ │ - 0x00fd8240 2e205768 656e2069 74206973 2072756e . When it is run │ │ │ │ - 0x00fd8250 2c206974 206c6f63 61746573 20697473 , it locates its │ │ │ │ - 0x00fd8260 2074656d 706c6174 65732c20 73746174 templates, stat │ │ │ │ - 0x00fd8270 69632063 6f6e7465 6e742c20 616e640a ic content, and. │ │ │ │ - 0x00fd8280 2d2d2073 6f757263 65206669 6c657320 -- source files │ │ │ │ - 0x00fd8290 696e2064 6576656c 6f706d65 6e74206d in development m │ │ │ │ - 0x00fd82a0 6f64652c 2072656c 61746976 6520746f ode, relative to │ │ │ │ - 0x00fd82b0 20746865 20637572 72656e74 20776f72 the current wor │ │ │ │ - 0x00fd82c0 6b696e67 20646972 6563746f 72792e0a king directory.. │ │ │ │ - 0x00fd82d0 2d2d0a2d 2d205768 656e2063 6f6d7069 --.-- When compi │ │ │ │ - 0x00fd82e0 6c656420 77697468 20746865 20646576 led with the dev │ │ │ │ - 0x00fd82f0 656c6f70 6d656e74 20666c61 672c206f elopment flag, o │ │ │ │ - 0x00fd8300 6e6c7920 6368616e 67657320 746f2074 nly changes to t │ │ │ │ - 0x00fd8310 6865206c 69627261 72696573 2c20796f he libraries, yo │ │ │ │ - 0x00fd8320 75720a2d 2d206361 62616c20 66696c65 ur.-- cabal file │ │ │ │ - 0x00fd8330 2c206f72 20746869 73206669 6c652073 , or this file s │ │ │ │ - 0x00fd8340 686f756c 64207265 71756972 65206120 hould require a │ │ │ │ - 0x00fd8350 7265636f 6d70696c 6520746f 20626520 recompile to be │ │ │ │ - 0x00fd8360 7069636b 65642075 702e0a2d 2d204576 picked up..-- Ev │ │ │ │ - 0x00fd8370 65727974 68696e67 20656c73 65206973 erything else is │ │ │ │ - 0x00fd8380 20696e74 65727072 65746564 20617420 interpreted at │ │ │ │ - 0x00fd8390 72756e74 696d652e 20546865 72652061 runtime. There a │ │ │ │ - 0x00fd83a0 72652061 20666577 20636f6e 73657175 re a few consequ │ │ │ │ - 0x00fd83b0 656e6365 73206f66 0a2d2d20 74686973 ences of.-- this │ │ │ │ - 0x00fd83c0 2e0a2d2d 0a2d2d20 46697273 742c2074 ..--.-- First, t │ │ │ │ - 0x00fd83d0 68697320 6973206d 75636820 736c6f77 his is much slow │ │ │ │ - 0x00fd83e0 65722e20 52756e6e 696e6720 74686520 er. Running the │ │ │ │ - 0x00fd83f0 696e7465 72707265 74657220 74616b65 interpreter take │ │ │ │ - 0x00fd8400 73206120 7369676e 69666963 616e740a s a significant. │ │ │ │ - 0x00fd8410 2d2d2063 68756e6b 206f6620 74696d65 -- chunk of time │ │ │ │ - 0x00fd8420 20286120 636f7570 6c652074 656e7468 (a couple tenth │ │ │ │ - 0x00fd8430 73206f66 20612073 65636f6e 64206f6e s of a second on │ │ │ │ - 0x00fd8440 20746865 20617574 686f7227 73206d61 the author's ma │ │ │ │ - 0x00fd8450 6368696e 652c2061 74207468 69730a2d chine, at this.- │ │ │ │ - 0x00fd8460 2d207469 6d65292c 20726567 6172646c - time), regardl │ │ │ │ - 0x00fd8470 65737320 6f662074 68652073 696d706c ess of the simpl │ │ │ │ - 0x00fd8480 69636974 79206f66 20746865 206c6f61 icity of the loa │ │ │ │ - 0x00fd8490 64656420 636f6465 2e20496e 206f7264 ded code. In ord │ │ │ │ - 0x00fd84a0 65722074 6f0a2d2d 20726563 6f6d7069 er to.-- recompi │ │ │ │ - 0x00fd84b0 6c652061 6e642072 652d6c6f 61642073 le and re-load s │ │ │ │ - 0x00fd84c0 65727665 72207374 61746520 61732069 erver state as i │ │ │ │ - 0x00fd84d0 6e667265 7175656e 746c7920 61732070 nfrequently as p │ │ │ │ - 0x00fd84e0 6f737369 626c652c 20746865 20736f75 ossible, the sou │ │ │ │ - 0x00fd84f0 7263650a 2d2d2064 69726563 746f7269 rce.-- directori │ │ │ │ - 0x00fd8500 65732061 72652077 61746368 65642066 es are watched f │ │ │ │ - 0x00fd8510 6f722075 70646174 65732c20 61732061 or updates, as a │ │ │ │ - 0x00fd8520 72652061 6e792065 78747261 20646972 re any extra dir │ │ │ │ - 0x00fd8530 6563746f 72696573 20737065 63696669 ectories specifi │ │ │ │ - 0x00fd8540 65640a2d 2d206265 6c6f772e 0a2d2d0a ed.-- below..--. │ │ │ │ - 0x00fd8550 2d2d2053 65636f6e 642c2074 68652067 -- Second, the g │ │ │ │ - 0x00fd8560 656e6572 61746564 20736572 76657220 enerated server │ │ │ │ - 0x00fd8570 62696e61 72792069 73204d55 4348206c binary is MUCH l │ │ │ │ - 0x00fd8580 61726765 722c2073 696e6365 20697420 arger, since it │ │ │ │ - 0x00fd8590 6c696e6b 7320696e 20746865 0a2d2d20 links in the.-- │ │ │ │ - 0x00fd85a0 47484320 41504920 28766961 20746865 GHC API (via the │ │ │ │ - 0x00fd85b0 2068696e 74206c69 62726172 79292e0a hint library).. │ │ │ │ - 0x00fd85c0 2d2d0a2d 2d205468 6972642c 20616e64 --.-- Third, and │ │ │ │ - 0x00fd85d0 20746865 20726561 736f6e20 796f7520 the reason you │ │ │ │ - 0x00fd85e0 776f756c 64206576 65722077 616e7420 would ever want │ │ │ │ - 0x00fd85f0 746f2061 63747561 6c6c7920 636f6d70 to actually comp │ │ │ │ - 0x00fd8600 696c6520 77697468 0a2d2d20 64657665 ile with.-- deve │ │ │ │ - 0x00fd8610 6c6f706d 656e7420 6d6f6465 2c206973 lopment mode, is │ │ │ │ - 0x00fd8620 20746861 74206974 20656e61 626c6573 that it enables │ │ │ │ - 0x00fd8630 20612066 61737465 72206465 76656c6f a faster develo │ │ │ │ - 0x00fd8640 706d656e 74206379 636c652e 20596f75 pment cycle. You │ │ │ │ - 0x00fd8650 2063616e 0a2d2d20 73696d70 6c792065 can.-- simply e │ │ │ │ - 0x00fd8660 64697420 61206669 6c652c20 73617665 dit a file, save │ │ │ │ - 0x00fd8670 20796f75 72206368 616e6765 732c2061 your changes, a │ │ │ │ - 0x00fd8680 6e642068 69742072 656c6f61 6420746f nd hit reload to │ │ │ │ - 0x00fd8690 20736565 20796f75 72206368 616e6765 see your change │ │ │ │ - 0x00fd86a0 730a2d2d 20726566 6c656374 65642069 s.-- reflected i │ │ │ │ - 0x00fd86b0 6d6d6564 69617465 6c792e0a 2d2d0a2d mmediately..--.- │ │ │ │ - 0x00fd86c0 2d205768 656e2074 68697320 69732063 - When this is c │ │ │ │ - 0x00fd86d0 6f6d7069 6c656420 77697468 6f757420 ompiled without │ │ │ │ - 0x00fd86e0 74686520 64657665 6c6f706d 656e7420 the development │ │ │ │ - 0x00fd86f0 666c6167 2c20616c 6c207468 65206163 flag, all the ac │ │ │ │ - 0x00fd8700 74696f6e 73206172 650a2d2d 20737461 tions are.-- sta │ │ │ │ - 0x00fd8710 74696361 6c6c7920 636f6d70 696c6564 tically compiled │ │ │ │ - 0x00fd8720 20696e2e 20546869 73207265 73756c74 in. This result │ │ │ │ - 0x00fd8730 7320696e 20666173 74657220 65786563 s in faster exec │ │ │ │ - 0x00fd8740 7574696f 6e2c2061 20736d61 6c6c6572 ution, a smaller │ │ │ │ - 0x00fd8750 2062696e 6172790a 2d2d2073 697a652c binary.-- size, │ │ │ │ - 0x00fd8760 20616e64 20686176 696e6720 746f2072 and having to r │ │ │ │ - 0x00fd8770 65636f6d 70696c65 20746865 20736572 ecompile the ser │ │ │ │ - 0x00fd8780 76657220 666f7220 616e7920 636f6465 ver for any code │ │ │ │ - 0x00fd8790 20636861 6e67652e 0a2d2d0a 6d61696e change..--.main │ │ │ │ - 0x00fd87a0 203a3a20 494f2028 290a6d61 696e203d :: IO ().main = │ │ │ │ - 0x00fd87b0 20646f0a 20202020 2d2d2044 6570656e do. -- Depen │ │ │ │ - 0x00fd87c0 64696e67 206f6e20 74686520 76657273 ding on the vers │ │ │ │ - 0x00fd87d0 696f6e20 6f66206c 6f616453 6e617054 ion of loadSnapT │ │ │ │ - 0x00fd87e0 4820696e 2073636f 70652c20 74686973 H in scope, this │ │ │ │ - 0x00fd87f0 20656974 68657220 656e6162 6c65730a either enables. │ │ │ │ - 0x00fd8800 20202020 2d2d2064 796e616d 69632072 -- dynamic r │ │ │ │ - 0x00fd8810 656c6f61 64696e67 2c206f72 20636f6d eloading, or com │ │ │ │ - 0x00fd8820 70696c65 73206974 20776974 686f7574 piles it without │ │ │ │ - 0x00fd8830 2e205468 65206c61 73742061 7267756d . The last argum │ │ │ │ - 0x00fd8840 656e7420 746f0a20 2020202d 2d206c6f ent to. -- lo │ │ │ │ - 0x00fd8850 6164536e 61705448 20697320 61206c69 adSnapTH is a li │ │ │ │ - 0x00fd8860 7374206f 66206164 64697469 6f6e616c st of additional │ │ │ │ - 0x00fd8870 20646972 6563746f 72696573 20746f20 directories to │ │ │ │ - 0x00fd8880 77617463 6820666f 72206368 616e6765 watch for change │ │ │ │ - 0x00fd8890 7320746f 0a202020 202d2d20 74726967 s to. -- trig │ │ │ │ - 0x00fd88a0 67657220 72656c6f 61647320 696e2064 ger reloads in d │ │ │ │ - 0x00fd88b0 6576656c 6f706d65 6e74206d 6f64652e evelopment mode. │ │ │ │ - 0x00fd88c0 20497420 646f6573 6e277420 6e656564 It doesn't need │ │ │ │ - 0x00fd88d0 20746f20 696e636c 75646520 736f7572 to include sour │ │ │ │ - 0x00fd88e0 63650a20 2020202d 2d206469 72656374 ce. -- direct │ │ │ │ - 0x00fd88f0 6f726965 732c2074 686f7365 20617265 ories, those are │ │ │ │ - 0x00fd8900 20706963 6b656420 75702061 75746f6d picked up autom │ │ │ │ - 0x00fd8910 61746963 616c6c79 20627920 74686520 atically by the │ │ │ │ - 0x00fd8920 73706c69 63652e0a 20202020 28636f6e splice.. (con │ │ │ │ - 0x00fd8930 662c2073 6974652c 20636c65 616e7570 f, site, cleanup │ │ │ │ - 0x00fd8940 29203c2d 2024286c 6f616453 6e617054 ) <- $(loadSnapT │ │ │ │ - 0x00fd8950 48205b7c 20676574 436f6e66 207c5d0a H [| getConf |]. │ │ │ │ - 0x00fd8960 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd8970 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd8980 20202020 20202020 20202767 65744163 'getAc │ │ │ │ - 0x00fd8990 74696f6e 730a2020 20202020 20202020 tions. │ │ │ │ - 0x00fd89a0 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd89b0 20202020 20202020 20202020 20202020 │ │ │ │ - 0x00fd89c0 5b22736e 61706c65 74732f68 65697374 ["snaplets/heist │ │ │ │ - 0x00fd89d0 2f74656d 706c6174 6573225d 290a0a20 /templates"]).. │ │ │ │ - 0x00fd89e0 2020205f 203c2d20 74727920 24206874 _ <- try $ ht │ │ │ │ - 0x00fd89f0 74705365 72766520 636f6e66 20736974 tpServe conf sit │ │ │ │ - 0x00fd8a00 65203a3a 20494f20 28456974 68657220 e :: IO (Either │ │ │ │ - 0x00fd8a10 536f6d65 45786365 7074696f 6e202829 SomeException () │ │ │ │ - 0x00fd8a20 290a2020 2020636c 65616e75 700a0a0a ). cleanup... │ │ │ │ - 0x00fd8a30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8a40 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8a50 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8a60 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8a70 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d0a2d --------------.- │ │ │ │ - 0x00fd8a80 2d207c20 54686973 20616374 696f6e20 - | This action │ │ │ │ - 0x00fd8a90 6c6f6164 73207468 6520636f 6e666967 loads the config │ │ │ │ - 0x00fd8aa0 20757365 64206279 20746869 73206170 used by this ap │ │ │ │ - 0x00fd8ab0 706c6963 6174696f 6e2e2054 6865206c plication. The l │ │ │ │ - 0x00fd8ac0 6f616465 6420636f 6e666967 0a2d2d20 oaded config.-- │ │ │ │ - 0x00fd8ad0 69732072 65747572 6e656420 61732074 is returned as t │ │ │ │ - 0x00fd8ae0 68652066 69727374 20656c65 6d656e74 he first element │ │ │ │ - 0x00fd8af0 206f6620 74686520 7475706c 65207072 of the tuple pr │ │ │ │ - 0x00fd8b00 6f647563 65642062 79207468 65206c6f oduced by the lo │ │ │ │ - 0x00fd8b10 6164536e 61705448 0a2d2d20 53706c69 adSnapTH.-- Spli │ │ │ │ - 0x00fd8b20 63652e20 54686520 74797065 20697320 ce. The type is │ │ │ │ - 0x00fd8b30 6e6f7420 736f6c69 646c7920 66697865 not solidly fixe │ │ │ │ - 0x00fd8b40 642c2074 686f7567 68206974 206d7573 d, though it mus │ │ │ │ - 0x00fd8b50 74206265 20616e20 494f2061 6374696f t be an IO actio │ │ │ │ - 0x00fd8b60 6e207468 61740a2d 2d207072 6f647563 n that.-- produc │ │ │ │ - 0x00fd8b70 65732074 68652073 616d6520 74797065 es the same type │ │ │ │ - 0x00fd8b80 20617320 27676574 41637469 6f6e7327 as 'getActions' │ │ │ │ - 0x00fd8b90 2074616b 65732e20 49742061 6c736f20 takes. It also │ │ │ │ - 0x00fd8ba0 6d757374 20626520 616e2069 6e737461 must be an insta │ │ │ │ - 0x00fd8bb0 6e636520 6f660a2d 2d205479 70656162 nce of.-- Typeab │ │ │ │ - 0x00fd8bc0 6c652e20 49662074 68652074 79706520 le. If the type │ │ │ │ - 0x00fd8bd0 6f662074 68697320 69732063 68616e67 of this is chang │ │ │ │ - 0x00fd8be0 65642c20 61206675 6c6c2072 65636f6d ed, a full recom │ │ │ │ - 0x00fd8bf0 70696c65 2077696c 6c206265 206e6565 pile will be nee │ │ │ │ - 0x00fd8c00 64656420 746f0a2d 2d207069 636b2075 ded to.-- pick u │ │ │ │ - 0x00fd8c10 70207468 65206368 616e6765 2c206576 p the change, ev │ │ │ │ - 0x00fd8c20 656e2069 6e206465 76656c6f 706d656e en in developmen │ │ │ │ - 0x00fd8c30 74206d6f 64652e0a 2d2d0a2d 2d205468 t mode..--.-- Th │ │ │ │ - 0x00fd8c40 69732061 6374696f 6e206973 206f6e6c is action is onl │ │ │ │ - 0x00fd8c50 79207275 6e206f6e 63652c20 72656761 y run once, rega │ │ │ │ - 0x00fd8c60 72646c65 7373206f 66207768 65746865 rdless of whethe │ │ │ │ - 0x00fd8c70 72206465 76656c6f 706d656e 74206f72 r development or │ │ │ │ - 0x00fd8c80 0a2d2d20 70726f64 75637469 6f6e206d .-- production m │ │ │ │ - 0x00fd8c90 6f646520 69732069 6e207573 652e0a67 ode is in use..g │ │ │ │ - 0x00fd8ca0 6574436f 6e66203a 3a20494f 2028436f etConf :: IO (Co │ │ │ │ - 0x00fd8cb0 6e666967 20536e61 70204170 70436f6e nfig Snap AppCon │ │ │ │ - 0x00fd8cc0 66696729 0a676574 436f6e66 203d2063 fig).getConf = c │ │ │ │ - 0x00fd8cd0 6f6d6d61 6e644c69 6e654170 70436f6e ommandLineAppCon │ │ │ │ - 0x00fd8ce0 66696720 64656661 756c7443 6f6e6669 fig defaultConfi │ │ │ │ - 0x00fd8cf0 670a0a0a 2d2d2d2d 2d2d2d2d 2d2d2d2d g...------------ │ │ │ │ - 0x00fd8d00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8d10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8d20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8d30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ - 0x00fd8d40 2d2d0a2d 2d207c20 54686973 2066756e --.-- | This fun │ │ │ │ - 0x00fd8d50 6374696f 6e206765 6e657261 74657320 ction generates │ │ │ │ - 0x00fd8d60 74686520 74686520 73697465 2068616e the the site han │ │ │ │ - 0x00fd8d70 646c6572 20616e64 20636c65 616e7570 dler and cleanup │ │ │ │ - 0x00fd8d80 20616374 696f6e20 66726f6d 20746865 action from the │ │ │ │ - 0x00fd8d90 0a2d2d20 636f6e66 69677572 6174696f .-- configuratio │ │ │ │ - 0x00fd8da0 6e2e2049 6e207072 6f647563 74696f6e n. In production │ │ │ │ - 0x00fd8db0 206d6f64 652c2074 68697320 61637469 mode, this acti │ │ │ │ - 0x00fd8dc0 6f6e2069 73206f6e 6c792072 756e206f on is only run o │ │ │ │ - 0x00fd8dd0 6e63652e 20496e0a 2d2d2064 6576656c nce. In.-- devel │ │ │ │ - 0x00fd8de0 6f706d65 6e74206d 6f64652c 20746869 opment mode, thi │ │ │ │ - 0x00fd8df0 73206163 74696f6e 20697320 72756e20 s action is run │ │ │ │ - 0x00fd8e00 7768656e 65766572 20746865 20617070 whenever the app │ │ │ │ - 0x00fd8e10 6c696361 74696f6e 20697320 72656c6f lication is relo │ │ │ │ - 0x00fd8e20 61646564 2e0a2d2d 0a2d2d20 44657665 aded..--.-- Deve │ │ │ │ - 0x00fd8e30 6c6f706d 656e7420 6d6f6465 20616c73 lopment mode als │ │ │ │ - 0x00fd8e40 6f206d61 6b657320 73757265 20746861 o makes sure tha │ │ │ │ - 0x00fd8e50 74207468 6520636c 65616e75 70206163 t the cleanup ac │ │ │ │ - 0x00fd8e60 74696f6e 73206172 65207275 6e0a2d2d tions are run.-- │ │ │ │ - 0x00fd8e70 20617070 726f7072 69617465 6c792062 appropriately b │ │ │ │ - 0x00fd8e80 65666f72 65207368 7574646f 776e2e20 efore shutdown. │ │ │ │ - 0x00fd8e90 54686520 636c6561 6e757020 61637469 The cleanup acti │ │ │ │ - 0x00fd8ea0 6f6e2072 65747572 6e656420 66726f6d on returned from │ │ │ │ - 0x00fd8eb0 206c6f61 64536e61 7054480a 2d2d2073 loadSnapTH.-- s │ │ │ │ - 0x00fd8ec0 686f756c 64207374 696c6c20 62652075 hould still be u │ │ │ │ - 0x00fd8ed0 73656420 61667465 72207468 65207365 sed after the se │ │ │ │ - 0x00fd8ee0 72766572 20686173 2073746f 70706564 rver has stopped │ │ │ │ - 0x00fd8ef0 2068616e 646c696e 67207265 71756573 handling reques │ │ │ │ - 0x00fd8f00 74732c20 61732074 68650a2d 2d20636c ts, as the.-- cl │ │ │ │ - 0x00fd8f10 65616e75 70206163 74696f6e 73206172 eanup actions ar │ │ │ │ - 0x00fd8f20 65206f6e 6c792061 75746f6d 61746963 e only automatic │ │ │ │ - 0x00fd8f30 616c6c79 2072756e 20776865 6e206120 ally run when a │ │ │ │ - 0x00fd8f40 72656c6f 61642069 73207472 69676765 reload is trigge │ │ │ │ - 0x00fd8f50 7265642e 0a2d2d0a 2d2d2054 68697320 red..--.-- This │ │ │ │ - 0x00fd8f60 73616d70 6c652064 6f65736e 27742061 sample doesn't a │ │ │ │ - 0x00fd8f70 63747561 6c6c7920 75736520 74686520 ctually use the │ │ │ │ - 0x00fd8f80 636f6e66 69672070 61737365 6420696e config passed in │ │ │ │ - 0x00fd8f90 2c206275 74206d6f 72650a2d 2d20736f , but more.-- so │ │ │ │ - 0x00fd8fa0 70686973 74696361 74656420 636f6465 phisticated code │ │ │ │ - 0x00fd8fb0 206d6967 68742e0a 67657441 6374696f might..getActio │ │ │ │ - 0x00fd8fc0 6e73203a 3a20436f 6e666967 20536e61 ns :: Config Sna │ │ │ │ - 0x00fd8fd0 70204170 70436f6e 66696720 2d3e2049 p AppConfig -> I │ │ │ │ - 0x00fd8fe0 4f202853 6e617020 28292c20 494f2028 O (Snap (), IO ( │ │ │ │ - 0x00fd8ff0 29290a67 65744163 74696f6e 7320636f )).getActions co │ │ │ │ - 0x00fd9000 6e66203d 20646f0a 20202020 286d7367 nf = do. (msg │ │ │ │ - 0x00fd9010 732c2073 6974652c 20636c65 616e7570 s, site, cleanup │ │ │ │ - 0x00fd9020 29203c2d 2072756e 536e6170 6c65740a ) <- runSnaplet. │ │ │ │ - 0x00fd9030 20202020 20202020 28617070 456e7669 (appEnvi │ │ │ │ - 0x00fd9040 726f6e6d 656e7420 3d3c3c20 6765744f ronment =<< getO │ │ │ │ - 0x00fd9050 74686572 20636f6e 66292061 70700a20 ther conf) app. │ │ │ │ - 0x00fd9060 20202068 50757453 74724c6e 20737464 hPutStrLn std │ │ │ │ - 0x00fd9070 65727220 2420542e 756e7061 636b206d err $ T.unpack m │ │ │ │ - 0x00fd9080 7367730a 20202020 72657475 726e2028 sgs. return ( │ │ │ │ - 0x00fd9090 73697465 2c20636c 65616e75 70290a00 site, cleanup).. │ │ │ │ + 0x00fd76f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7700 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7710 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d0a ---------------. │ │ │ │ + 0x00fd7720 2d2d207c 2048616e 646c6520 6e657720 -- | Handle new │ │ │ │ + 0x00fd7730 75736572 20666f72 6d207375 626d6974 user form submit │ │ │ │ + 0x00fd7740 0a68616e 646c654e 65775573 6572203a .handleNewUser : │ │ │ │ + 0x00fd7750 3a204861 6e646c65 72204170 70202841 : Handler App (A │ │ │ │ + 0x00fd7760 7574684d 616e6167 65722041 70702920 uthManager App) │ │ │ │ + 0x00fd7770 28290a68 616e646c 654e6577 55736572 ().handleNewUser │ │ │ │ + 0x00fd7780 203d206d 6574686f 64204745 54206861 = method GET ha │ │ │ │ + 0x00fd7790 6e646c65 466f726d 203c7c3e 206d6574 ndleForm <|> met │ │ │ │ + 0x00fd77a0 686f6420 504f5354 2068616e 646c6546 hod POST handleF │ │ │ │ + 0x00fd77b0 6f726d53 75626d69 740a2020 77686572 ormSubmit. wher │ │ │ │ + 0x00fd77c0 650a2020 20206861 6e646c65 466f726d e. handleForm │ │ │ │ + 0x00fd77d0 203d2072 656e6465 7220226e 65775f75 = render "new_u │ │ │ │ + 0x00fd77e0 73657222 0a202020 2068616e 646c6546 ser". handleF │ │ │ │ + 0x00fd77f0 6f726d53 75626d69 74203d20 72656769 ormSubmit = regi │ │ │ │ + 0x00fd7800 73746572 55736572 20226c6f 67696e22 sterUser "login" │ │ │ │ + 0x00fd7810 20227061 7373776f 72642220 3e3e2072 "password" >> r │ │ │ │ + 0x00fd7820 65646972 65637420 222f220a 0a0a2d2d edirect "/"...-- │ │ │ │ + 0x00fd7830 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7840 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7850 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7860 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7870 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a2d2d20 ------------.-- │ │ │ │ + 0x00fd7880 7c205468 65206170 706c6963 6174696f | The applicatio │ │ │ │ + 0x00fd7890 6e277320 726f7574 65732e0a 726f7574 n's routes..rout │ │ │ │ + 0x00fd78a0 6573203a 3a205b28 42797465 53747269 es :: [(ByteStri │ │ │ │ + 0x00fd78b0 6e672c20 48616e64 6c657220 41707020 ng, Handler App │ │ │ │ + 0x00fd78c0 41707020 2829295d 0a726f75 74657320 App ())].routes │ │ │ │ + 0x00fd78d0 3d205b20 28226c6f 67696e22 2c202020 = [ ("login", │ │ │ │ + 0x00fd78e0 20776974 68206175 74682068 616e646c with auth handl │ │ │ │ + 0x00fd78f0 654c6f67 696e5375 626d6974 290a2020 eLoginSubmit). │ │ │ │ + 0x00fd7900 20202020 2020202c 2028226c 6f676f75 , ("logou │ │ │ │ + 0x00fd7910 74222c20 20207769 74682061 75746820 t", with auth │ │ │ │ + 0x00fd7920 68616e64 6c654c6f 676f7574 290a2020 handleLogout). │ │ │ │ + 0x00fd7930 20202020 2020202c 2028226e 65775f75 , ("new_u │ │ │ │ + 0x00fd7940 73657222 2c207769 74682061 75746820 ser", with auth │ │ │ │ + 0x00fd7950 68616e64 6c654e65 77557365 72290a20 handleNewUser). │ │ │ │ + 0x00fd7960 20202020 20202020 2c202822 222c2020 , ("", │ │ │ │ + 0x00fd7970 20202020 20202073 65727665 44697265 serveDire │ │ │ │ + 0x00fd7980 63746f72 79202273 74617469 6322290a ctory "static"). │ │ │ │ + 0x00fd7990 20202020 20202020 205d0a0a 0a2d2d2d ]...--- │ │ │ │ + 0x00fd79a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd79b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd79c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd79d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd79e0 2d2d2d2d 2d2d2d2d 2d2d2d0a 2d2d207c -----------.-- | │ │ │ │ + 0x00fd79f0 20546865 20617070 6c696361 74696f6e The application │ │ │ │ + 0x00fd7a00 20696e69 7469616c 697a6572 2e0a6170 initializer..ap │ │ │ │ + 0x00fd7a10 70203a3a 20536e61 706c6574 496e6974 p :: SnapletInit │ │ │ │ + 0x00fd7a20 20417070 20417070 0a617070 203d206d App App.app = m │ │ │ │ + 0x00fd7a30 616b6553 6e61706c 65742022 61707022 akeSnaplet "app" │ │ │ │ + 0x00fd7a40 2022416e 20736e61 706c6574 20657861 "An snaplet exa │ │ │ │ + 0x00fd7a50 6d706c65 20617070 6c696361 74696f6e mple application │ │ │ │ + 0x00fd7a60 2e22204e 6f746869 6e672024 20646f0a ." Nothing $ do. │ │ │ │ + 0x00fd7a70 20202020 68203c2d 206e6573 74536e61 h <- nestSna │ │ │ │ + 0x00fd7a80 706c6574 20222220 68656973 74202420 plet "" heist $ │ │ │ │ + 0x00fd7a90 68656973 74496e69 74202274 656d706c heistInit "templ │ │ │ │ + 0x00fd7aa0 61746573 220a2020 20207320 3c2d206e ates". s <- n │ │ │ │ + 0x00fd7ab0 65737453 6e61706c 65742022 73657373 estSnaplet "sess │ │ │ │ + 0x00fd7ac0 22207365 73732024 0a202020 20202020 " sess $. │ │ │ │ + 0x00fd7ad0 20202020 696e6974 436f6f6b 69655365 initCookieSe │ │ │ │ + 0x00fd7ae0 7373696f 6e4d616e 61676572 20227369 ssionManager "si │ │ │ │ + 0x00fd7af0 74655f6b 65792e74 78742220 22736573 te_key.txt" "ses │ │ │ │ + 0x00fd7b00 7322204e 6f746869 6e672028 4a757374 s" Nothing (Just │ │ │ │ + 0x00fd7b10 20333630 30290a0a 20202020 2d2d204e 3600).. -- N │ │ │ │ + 0x00fd7b20 4f54453a 20576527 72652075 73696e67 OTE: We're using │ │ │ │ + 0x00fd7b30 20696e69 744a736f 6e46696c 65417574 initJsonFileAut │ │ │ │ + 0x00fd7b40 684d616e 61676572 20686572 65206265 hManager here be │ │ │ │ + 0x00fd7b50 63617573 65206974 27732065 61737920 cause it's easy │ │ │ │ + 0x00fd7b60 616e640a 20202020 2d2d2064 6f65736e and. -- doesn │ │ │ │ + 0x00fd7b70 27742072 65717569 72652061 6e79206b 't require any k │ │ │ │ + 0x00fd7b80 696e6420 6f662064 61746162 61736520 ind of database │ │ │ │ + 0x00fd7b90 73657276 65722074 6f207275 6e2e2020 server to run. │ │ │ │ + 0x00fd7ba0 496e2070 72616374 6963652c 0a202020 In practice,. │ │ │ │ + 0x00fd7bb0 202d2d20 796f7527 6c6c2070 726f6261 -- you'll proba │ │ │ │ + 0x00fd7bc0 626c7920 77616e74 20746f20 6368616e bly want to chan │ │ │ │ + 0x00fd7bd0 67652074 68697320 746f2061 206d6f72 ge this to a mor │ │ │ │ + 0x00fd7be0 6520726f 62757374 20617574 68206261 e robust auth ba │ │ │ │ + 0x00fd7bf0 636b656e 642e0a20 20202061 203c2d20 ckend.. a <- │ │ │ │ + 0x00fd7c00 6e657374 536e6170 6c657420 22617574 nestSnaplet "aut │ │ │ │ + 0x00fd7c10 68222061 75746820 240a2020 20202020 h" auth $. │ │ │ │ + 0x00fd7c20 20202020 20696e69 744a736f 6e46696c initJsonFil │ │ │ │ + 0x00fd7c30 65417574 684d616e 61676572 20646566 eAuthManager def │ │ │ │ + 0x00fd7c40 41757468 53657474 696e6773 20736573 AuthSettings ses │ │ │ │ + 0x00fd7c50 73202275 73657273 2e6a736f 6e220a20 s "users.json". │ │ │ │ + 0x00fd7c60 20202061 6464526f 75746573 20726f75 addRoutes rou │ │ │ │ + 0x00fd7c70 7465730a 20202020 61646441 75746853 tes. addAuthS │ │ │ │ + 0x00fd7c80 706c6963 65732068 20617574 680a2020 plices h auth. │ │ │ │ + 0x00fd7c90 20207265 7475726e 20242041 70702068 return $ App h │ │ │ │ + 0x00fd7ca0 20732061 0a0a002e 2f737263 2f536974 s a..../src/Sit │ │ │ │ + 0x00fd7cb0 652e6873 007b2d23 204c414e 47554147 e.hs.{-# LANGUAG │ │ │ │ + 0x00fd7cc0 45205465 6d706c61 74654861 736b656c E TemplateHaskel │ │ │ │ + 0x00fd7cd0 6c20232d 7d0a0a2d 2d2d2d2d 2d2d2d2d l #-}..--------- │ │ │ │ + 0x00fd7ce0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7cf0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7d00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7d10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7d20 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This │ │ │ │ + 0x00fd7d30 6d6f6475 6c652064 6566696e 6573206f module defines o │ │ │ │ + 0x00fd7d40 75722061 70706c69 63617469 6f6e2773 ur application's │ │ │ │ + 0x00fd7d50 20737461 74652074 79706520 616e6420 state type and │ │ │ │ + 0x00fd7d60 616e2061 6c696173 20666f72 20697473 an alias for its │ │ │ │ + 0x00fd7d70 0a2d2d20 68616e64 6c657220 6d6f6e61 .-- handler mona │ │ │ │ + 0x00fd7d80 642e0a6d 6f64756c 65204170 706c6963 d..module Applic │ │ │ │ + 0x00fd7d90 6174696f 6e207768 6572650a 0a2d2d2d ation where..--- │ │ │ │ + 0x00fd7da0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7db0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7dc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7dd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7de0 2d2d2d2d 2d2d2d2d 2d2d2d0a 696d706f -----------.impo │ │ │ │ + 0x00fd7df0 72742043 6f6e7472 6f6c2e4c 656e730a rt Control.Lens. │ │ │ │ + 0x00fd7e00 696d706f 72742053 6e61702e 536e6170 import Snap.Snap │ │ │ │ + 0x00fd7e10 6c65740a 696d706f 72742053 6e61702e let.import Snap. │ │ │ │ + 0x00fd7e20 536e6170 6c65742e 48656973 740a696d Snaplet.Heist.im │ │ │ │ + 0x00fd7e30 706f7274 20536e61 702e536e 61706c65 port Snap.Snaple │ │ │ │ + 0x00fd7e40 742e4175 74680a69 6d706f72 7420536e t.Auth.import Sn │ │ │ │ + 0x00fd7e50 61702e53 6e61706c 65742e53 65737369 ap.Snaplet.Sessi │ │ │ │ + 0x00fd7e60 6f6e0a0a 2d2d2d2d 2d2d2d2d 2d2d2d2d on..------------ │ │ │ │ + 0x00fd7e70 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7e80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7e90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7ea0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7eb0 2d2d0a64 61746120 41707020 3d204170 --.data App = Ap │ │ │ │ + 0x00fd7ec0 700a2020 20207b20 5f686569 7374203a p. { _heist : │ │ │ │ + 0x00fd7ed0 3a20536e 61706c65 74202848 65697374 : Snaplet (Heist │ │ │ │ + 0x00fd7ee0 20417070 290a2020 20202c20 5f736573 App). , _ses │ │ │ │ + 0x00fd7ef0 73203a3a 20536e61 706c6574 20536573 s :: Snaplet Ses │ │ │ │ + 0x00fd7f00 73696f6e 4d616e61 6765720a 20202020 sionManager. │ │ │ │ + 0x00fd7f10 2c205f61 75746820 3a3a2053 6e61706c , _auth :: Snapl │ │ │ │ + 0x00fd7f20 65742028 41757468 4d616e61 67657220 et (AuthManager │ │ │ │ + 0x00fd7f30 41707029 0a202020 207d0a0a 6d616b65 App). }..make │ │ │ │ + 0x00fd7f40 4c656e73 65732027 27417070 0a0a696e Lenses ''App..in │ │ │ │ + 0x00fd7f50 7374616e 63652048 61734865 69737420 stance HasHeist │ │ │ │ + 0x00fd7f60 41707020 77686572 650a2020 20206865 App where. he │ │ │ │ + 0x00fd7f70 6973744c 656e7320 3d207375 62536e61 istLens = subSna │ │ │ │ + 0x00fd7f80 706c6574 20686569 73740a0a 0a2d2d2d plet heist...--- │ │ │ │ + 0x00fd7f90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7fa0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7fb0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7fc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ---------------- │ │ │ │ + 0x00fd7fd0 2d2d2d2d 2d2d2d2d 2d2d2d0a 74797065 -----------.type │ │ │ │ + 0x00fd7fe0 20417070 48616e64 6c657220 3d204861 AppHandler = Ha │ │ │ │ + 0x00fd7ff0 6e646c65 72204170 70204170 700a0a0a ndler App App... │ │ │ │ + 0x00fd8000 002e2f73 72632f41 70706c69 63617469 ../src/Applicati │ │ │ │ + 0x00fd8010 6f6e2e68 73004e61 6d653a20 20202020 on.hs.Name: │ │ │ │ + 0x00fd8020 20202020 20202020 20202070 726f6a6e projn │ │ │ │ + 0x00fd8030 616d650a 56657273 696f6e3a 20202020 ame.Version: │ │ │ │ + 0x00fd8040 20202020 20202020 20302e31 0a53796e 0.1.Syn │ │ │ │ + 0x00fd8050 6f707369 733a2020 20202020 20202020 opsis: │ │ │ │ + 0x00fd8060 20205072 6f6a6563 74205379 6e6f7073 Project Synops │ │ │ │ + 0x00fd8070 69732048 6572650a 44657363 72697074 is Here.Descript │ │ │ │ + 0x00fd8080 696f6e3a 20202020 20202020 2050726f ion: Pro │ │ │ │ + 0x00fd8090 6a656374 20446573 63726970 74696f6e ject Description │ │ │ │ + 0x00fd80a0 20486572 650a4c69 63656e73 653a2020 Here.License: │ │ │ │ + 0x00fd80b0 20202020 20202020 20202041 6c6c5269 AllRi │ │ │ │ + 0x00fd80c0 67687473 52657365 72766564 0a417574 ghtsReserved.Aut │ │ │ │ + 0x00fd80d0 686f723a 20202020 20202020 20202020 hor: │ │ │ │ + 0x00fd80e0 20204175 74686f72 0a4d6169 6e746169 Author.Maintai │ │ │ │ + 0x00fd80f0 6e65723a 20202020 20202020 20206d61 ner: ma │ │ │ │ + 0x00fd8100 696e7461 696e6572 40657861 6d706c65 intainer@example │ │ │ │ + 0x00fd8110 2e636f6d 0a537461 62696c69 74793a20 .com.Stability: │ │ │ │ + 0x00fd8120 20202020 20202020 20204578 70657269 Experi │ │ │ │ + 0x00fd8130 6d656e74 616c0a43 61746567 6f72793a mental.Category: │ │ │ │ + 0x00fd8140 20202020 20202020 20202020 5765620a Web. │ │ │ │ + 0x00fd8150 4275696c 642d7479 70653a20 20202020 Build-type: │ │ │ │ + 0x00fd8160 20202020 2053696d 706c650a 43616261 Simple.Caba │ │ │ │ + 0x00fd8170 6c2d7665 7273696f 6e3a2020 20202020 l-version: │ │ │ │ + 0x00fd8180 203e3d31 2e320a0a 466c6167 20646576 >=1.2..Flag dev │ │ │ │ + 0x00fd8190 656c6f70 6d656e74 0a202044 65736372 elopment. Descr │ │ │ │ + 0x00fd81a0 69707469 6f6e3a20 57686574 68657220 iption: Whether │ │ │ │ + 0x00fd81b0 746f2062 75696c64 20746865 20736572 to build the ser │ │ │ │ + 0x00fd81c0 76657220 696e2064 6576656c 6f706d65 ver in developme │ │ │ │ + 0x00fd81d0 6e742028 696e7465 72707265 74656429 nt (interpreted) │ │ │ │ + 0x00fd81e0 206d6f64 650a2020 44656661 756c743a mode. Default: │ │ │ │ + 0x00fd81f0 2046616c 73650a0a 466c6167 206f6c64 False..Flag old │ │ │ │ + 0x00fd8200 2d626173 650a2020 64656661 756c743a -base. default: │ │ │ │ + 0x00fd8210 2046616c 73650a20 206d616e 75616c3a False. manual: │ │ │ │ + 0x00fd8220 2046616c 73650a0a 45786563 75746162 False..Executab │ │ │ │ + 0x00fd8230 6c652070 726f6a6e 616d650a 20206873 le projname. hs │ │ │ │ + 0x00fd8240 2d736f75 7263652d 64697273 3a207372 -source-dirs: sr │ │ │ │ + 0x00fd8250 630a2020 6d61696e 2d69733a 204d6169 c. main-is: Mai │ │ │ │ + 0x00fd8260 6e2e6873 0a0a2020 4275696c 642d6465 n.hs.. Build-de │ │ │ │ + 0x00fd8270 70656e64 733a0a20 20202062 61736520 pends:. base │ │ │ │ + 0x00fd8280 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd8290 20202020 203e3d20 342e3420 20202020 >= 4.4 │ │ │ │ + 0x00fd82a0 2626203c 20352c0a 20202020 62797465 && < 5,. byte │ │ │ │ + 0x00fd82b0 73747269 6e672020 20202020 20202020 string │ │ │ │ + 0x00fd82c0 20202020 20203e3d 20302e39 2e312020 >= 0.9.1 │ │ │ │ + 0x00fd82d0 20262620 3c20302e 31312c0a 20202020 && < 0.11,. │ │ │ │ + 0x00fd82e0 68656973 74202020 20202020 20202020 heist │ │ │ │ + 0x00fd82f0 20202020 20202020 20203e3d 20312e30 >= 1.0 │ │ │ │ + 0x00fd8300 20202020 20262620 3c20312e 322c0a20 && < 1.2,. │ │ │ │ + 0x00fd8310 2020206c 656e7320 20202020 20202020 lens │ │ │ │ + 0x00fd8320 20202020 20202020 20202020 203e3d20 >= │ │ │ │ + 0x00fd8330 332e372e 36202020 2626203c 20342e31 3.7.6 && < 4.1 │ │ │ │ + 0x00fd8340 382c0a20 2020206d 61702d73 796e7461 8,. map-synta │ │ │ │ + 0x00fd8350 78202020 20202020 20202020 20202020 x │ │ │ │ + 0x00fd8360 203e3d20 302e3220 20202020 2626203c >= 0.2 && < │ │ │ │ + 0x00fd8370 20302e34 2c0a2020 20206d6f 6e61642d 0.4,. monad- │ │ │ │ + 0x00fd8380 636f6e74 726f6c20 20202020 20202020 control │ │ │ │ + 0x00fd8390 20202020 3e3d2031 2e302020 20202026 >= 1.0 & │ │ │ │ + 0x00fd83a0 26203c20 312e312c 0a202020 206d746c & < 1.1,. mtl │ │ │ │ + 0x00fd83b0 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd83c0 20202020 2020203e 3d203220 20202020 >= 2 │ │ │ │ + 0x00fd83d0 20202626 203c2032 2e332c0a 20202020 && < 2.3,. │ │ │ │ + 0x00fd83e0 736e6170 20202020 20202020 20202020 snap │ │ │ │ + 0x00fd83f0 20202020 20202020 20203e3d 20312e30 >= 1.0 │ │ │ │ + 0x00fd8400 20202020 20262620 3c20312e 322c0a20 && < 1.2,. │ │ │ │ + 0x00fd8410 20202073 6e61702d 636f7265 20202020 snap-core │ │ │ │ + 0x00fd8420 20202020 20202020 20202020 203e3d20 >= │ │ │ │ + 0x00fd8430 312e3020 20202020 2626203c 20312e31 1.0 && < 1.1 │ │ │ │ + 0x00fd8440 2c0a2020 2020736e 61702d73 65727665 ,. snap-serve │ │ │ │ + 0x00fd8450 72202020 20202020 20202020 20202020 r │ │ │ │ + 0x00fd8460 3e3d2031 2e302020 20202026 26203c20 >= 1.0 && < │ │ │ │ + 0x00fd8470 312e322c 0a202020 20736e61 702d6c6f 1.2,. snap-lo │ │ │ │ + 0x00fd8480 61646572 2d737461 74696320 20202020 ader-static │ │ │ │ + 0x00fd8490 2020203e 3d20312e 30202020 20202626 >= 1.0 && │ │ │ │ + 0x00fd84a0 203c2031 2e312c0a 20202020 74657874 < 1.1,. text │ │ │ │ + 0x00fd84b0 20202020 20202020 20202020 20202020 │ │ │ │ + 0x00fd84c0 20202020 20203e3d 20302e31 31202020 >= 0.11 │ │ │ │ + 0x00fd84d0 20262620 3c20312e 332c0a20 20202074 && < 1.3,. t │ │ │ │ + 0x00fd84e0 696d6520 20202020 20202020 20202020 ime │ │ │ │ + 0x00fd84f0 20202020 20202020 203e3d20 312e3120 >= 1.1 │ │ │ │ + 0x00fd8500 20202020 2626203c 20312e39 2c0a2020 && < 1.9,. │ │ │ │ + 0x00fd8510 2020786d 6c68746d 6c202020 20202020 xmlhtml │ │ │ │ + 0x00fd8520 20202020 20202020 20202020 3e3d2030 >= 0 │ │ │ │ + 0x00fd8530 2e312020 20202026 26203c20 302e330a .1 && < 0.3. │ │ │ │ + 0x00fd8540 0a202069 6620666c 61672864 6576656c . if flag(devel │ │ │ │ + 0x00fd8550 6f706d65 6e74290a 20202020 6275696c opment). buil │ │ │ │ + 0x00fd8560 642d6465 70656e64 733a0a20 20202020 d-depends:. │ │ │ │ + 0x00fd8570 20736e61 702d6c6f 61646572 2d64796e snap-loader-dyn │ │ │ │ + 0x00fd8580 616d6963 203e3d20 312e3020 2626203c amic >= 1.0 && < │ │ │ │ + 0x00fd8590 20312e31 0a202020 20637070 2d6f7074 1.1. cpp-opt │ │ │ │ + 0x00fd85a0 696f6e73 3a202d44 44455645 4c4f504d ions: -DDEVELOPM │ │ │ │ + 0x00fd85b0 454e540a 20202020 2d2d2049 6e206465 ENT. -- In de │ │ │ │ + 0x00fd85c0 76656c6f 706d656e 74206d6f 64652c20 velopment mode, │ │ │ │ + 0x00fd85d0 73706565 64206973 20616c72 65616479 speed is already │ │ │ │ + 0x00fd85e0 20676f69 6e672074 6f207375 66666572 going to suffer │ │ │ │ + 0x00fd85f0 2c20736f 20736b69 700a2020 20202d2d , so skip. -- │ │ │ │ + 0x00fd8600 20746865 2066616e 6379206f 7074696d the fancy optim │ │ │ │ + 0x00fd8610 697a6174 696f6e20 666c6167 732e2020 ization flags. │ │ │ │ + 0x00fd8620 41646469 74696f6e 616c6c79 2c206469 Additionally, di │ │ │ │ + 0x00fd8630 7361626c 6520616c 6c0a2020 20202d2d sable all. -- │ │ │ │ + 0x00fd8640 20776172 6e696e67 732e2020 54686520 warnings. The │ │ │ │ + 0x00fd8650 68696e74 206c6962 72617279 20646f65 hint library doe │ │ │ │ + 0x00fd8660 736e2774 20676976 6520616e 206f7074 sn't give an opt │ │ │ │ + 0x00fd8670 696f6e20 746f2065 78656375 74650a20 ion to execute. │ │ │ │ + 0x00fd8680 2020202d 2d20636f 6d70696c 65642063 -- compiled c │ │ │ │ + 0x00fd8690 6f646520 7768656e 20746865 72652077 ode when there w │ │ │ │ + 0x00fd86a0 65726520 616c736f 20776172 6e696e67 ere also warning │ │ │ │ + 0x00fd86b0 732c2073 6f206469 7361626c 696e670a s, so disabling. │ │ │ │ + 0x00fd86c0 20202020 2d2d2077 61726e69 6e677320 -- warnings │ │ │ │ + 0x00fd86d0 616c6c6f 77732071 7569636b 65722077 allows quicker w │ │ │ │ + 0x00fd86e0 6f726b66 6c6f772e 0a202020 20676863 orkflow.. ghc │ │ │ │ + 0x00fd86f0 2d6f7074 696f6e73 3a202d74 68726561 -options: -threa │ │ │ │ + 0x00fd8700 64656420 2d770a20 20656c73 650a2020 ded -w. else. │ │ │ │ + 0x00fd8710 20206966 20696d70 6c286768 63203e3d if impl(ghc >= │ │ │ │ + 0x00fd8720 20362e31 322e3029 0a202020 20202067 6.12.0). g │ │ │ │ + 0x00fd8730 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ + 0x00fd8740 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ + 0x00fd8750 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ + 0x00fd8760 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ + 0x00fd8770 320a2020 20202020 20202020 20202020 2. │ │ │ │ + 0x00fd8780 20202020 202d666e 6f2d7761 726e2d6f -fno-warn-o │ │ │ │ + 0x00fd8790 72706861 6e73202d 666e6f2d 7761726e rphans -fno-warn │ │ │ │ + 0x00fd87a0 2d756e75 7365642d 646f2d62 696e640a -unused-do-bind. │ │ │ │ + 0x00fd87b0 20202020 656c7365 0a202020 20202067 else. g │ │ │ │ + 0x00fd87c0 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ + 0x00fd87d0 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ + 0x00fd87e0 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ + 0x00fd87f0 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ + 0x00fd8800 320a2020 20202020 20202020 20202020 2. │ │ │ │ + 0x00fd8810 20202020 202d666e 6f2d7761 726e2d6f -fno-warn-o │ │ │ │ + 0x00fd8820 72706861 6e730a00 3c617070 6c792074 rphans..<apply t │ │ │ │ + 0x00fd8830 656d706c 6174653d 22626173 65223e0a emplate="base">. │ │ │ │ + 0x00fd8840 0a20203c 69664c6f 67676564 496e3e0a . <ifLoggedIn>. │ │ │ │ + 0x00fd8850 20202020 3c703e0a 20202020 20205468 <p>. Th │ │ │ │ + 0x00fd8860 69732069 73206120 73696d70 6c652064 is is a simple d │ │ │ │ + 0x00fd8870 656d6f20 70616765 20736572 76656420 emo page served │ │ │ │ + 0x00fd8880 7573696e 670a2020 20202020 3c612068 using. <a h │ │ │ │ + 0x00fd8890 7265663d 22687474 703a2f2f 736e6170 ref="http://snap │ │ │ │ + 0x00fd88a0 6672616d 65776f72 6b2e636f 6d2f646f framework.com/do │ │ │ │ + 0x00fd88b0 63732f74 75746f72 69616c73 2f686569 cs/tutorials/hei │ │ │ │ + 0x00fd88c0 7374223e 48656973 743c2f61 3e0a2020 st">Heist</a>. │ │ │ │ + 0x00fd88d0 20202020 616e6420 74686520 3c612068 and the <a h │ │ │ │ + 0x00fd88e0 7265663d 22687474 703a2f2f 736e6170 ref="http://snap │ │ │ │ + 0x00fd88f0 6672616d 65776f72 6b2e636f 6d2f223e framework.com/"> │ │ │ │ + 0x00fd8900 536e6170 3c2f613e 20776562 20667261 Snap</a> web fra │ │ │ │ + 0x00fd8910 6d65776f 726b2e0a 20202020 3c2f703e mework.. </p> │ │ │ │ + 0x00fd8920 0a0a2020 20203c70 3e436f6e 67726174 .. <p>Congrat │ │ │ │ + 0x00fd8930 73212020 596f7527 7265206c 6f676765 s! You're logge │ │ │ │ + 0x00fd8940 6420696e 20617320 273c6c6f 67676564 d in as '<logged │ │ │ │ + 0x00fd8950 496e5573 65722f3e 273c2f70 3e0a0a20 InUser/>'</p>.. │ │ │ │ + 0x00fd8960 2020203c 703e3c61 20687265 663d222f <p><a href="/ │ │ │ │ + 0x00fd8970 6c6f676f 7574223e 4c6f676f 75743c2f logout">Logout</ │ │ │ │ + 0x00fd8980 613e3c2f 703e0a20 203c2f69 664c6f67 a></p>. </ifLog │ │ │ │ + 0x00fd8990 67656449 6e3e0a0a 20203c69 664c6f67 gedIn>.. <ifLog │ │ │ │ + 0x00fd89a0 6765644f 75743e0a 20202020 3c617070 gedOut>. <app │ │ │ │ + 0x00fd89b0 6c792074 656d706c 6174653d 225f6c6f ly template="_lo │ │ │ │ + 0x00fd89c0 67696e22 2f3e0a20 203c2f69 664c6f67 gin"/>. </ifLog │ │ │ │ + 0x00fd89d0 6765644f 75743e0a 0a3c2f61 70706c79 gedOut>..</apply │ │ │ │ + 0x00fd89e0 3e0a002e 2f736e61 706c6574 732f6865 >.../snaplets/he │ │ │ │ + 0x00fd89f0 6973742f 74656d70 6c617465 732f696e ist/templates/in │ │ │ │ + 0x00fd8a00 6465782e 74706c00 3c68313e 536e6170 dex.tpl.<h1>Snap │ │ │ │ + 0x00fd8a10 20457861 6d706c65 20417070 204c6f67 Example App Log │ │ │ │ + 0x00fd8a20 696e3c2f 68313e0a 0a3c703e 3c6c6f67 in</h1>..<p><log │ │ │ │ + 0x00fd8a30 696e4572 726f722f 3e3c2f70 3e0a0a3c inError/></p>..< │ │ │ │ + 0x00fd8a40 62696e64 20746167 3d22706f 73744163 bind tag="postAc │ │ │ │ + 0x00fd8a50 74696f6e 223e2f6c 6f67696e 3c2f6269 tion">/login</bi │ │ │ │ + 0x00fd8a60 6e643e0a 3c62696e 64207461 673d2273 nd>.<bind tag="s │ │ │ │ + 0x00fd8a70 75626d69 74546578 74223e4c 6f67696e ubmitText">Login │ │ │ │ + 0x00fd8a80 3c2f6269 6e643e0a 3c617070 6c792074 </bind>.<apply t │ │ │ │ + 0x00fd8a90 656d706c 6174653d 22757365 72666f72 emplate="userfor │ │ │ │ + 0x00fd8aa0 6d222f3e 0a0a3c70 3e446f6e 27742068 m"/>..<p>Don't h │ │ │ │ + 0x00fd8ab0 61766520 61206c6f 67696e20 7965743f ave a login yet? │ │ │ │ + 0x00fd8ac0 203c6120 68726566 3d222f6e 65775f75 <a href="/new_u │ │ │ │ + 0x00fd8ad0 73657222 3e437265 61746520 61206e65 ser">Create a ne │ │ │ │ + 0x00fd8ae0 77207573 65723c2f 613e3c2f 703e0a00 w user</a></p>.. │ │ │ │ + 0x00fd8af0 2e2f736e 61706c65 74732f68 65697374 ./snaplets/heist │ │ │ │ + 0x00fd8b00 2f74656d 706c6174 65732f5f 6c6f6769 /templates/_logi │ │ │ │ + 0x00fd8b10 6e2e7470 6c003c66 6f726d20 6d657468 n.tpl.<form meth │ │ │ │ + 0x00fd8b20 6f643d22 706f7374 22206163 74696f6e od="post" action │ │ │ │ + 0x00fd8b30 3d22247b 706f7374 41637469 6f6e7d22 ="${postAction}" │ │ │ │ + 0x00fd8b40 3e0a2020 3c746162 6c652069 643d2269 >. <table id="i │ │ │ │ + 0x00fd8b50 6e666f22 3e0a2020 20203c74 723e0a20 nfo">. <tr>. │ │ │ │ + 0x00fd8b60 20202020 203c7464 3e4c6f67 696e3a3c <td>Login:< │ │ │ │ + 0x00fd8b70 2f74643e 3c74643e 3c696e70 75742074 /td><td><input t │ │ │ │ + 0x00fd8b80 7970653d 22746578 7422206e 616d653d ype="text" name= │ │ │ │ + 0x00fd8b90 226c6f67 696e2220 73697a65 3d223230 "login" size="20 │ │ │ │ + 0x00fd8ba0 22202f3e 3c2f7464 3e0a2020 20203c2f " /></td>. </ │ │ │ │ + 0x00fd8bb0 74723e0a 20202020 3c74723e 0a202020 tr>. <tr>. │ │ │ │ + 0x00fd8bc0 2020203c 74643e50 61737377 6f72643a <td>Password: │ │ │ │ + 0x00fd8bd0 3c2f7464 3e3c7464 3e3c696e 70757420 </td><td><input │ │ │ │ + 0x00fd8be0 74797065 3d227061 7373776f 72642220 type="password" │ │ │ │ + 0x00fd8bf0 6e616d65 3d227061 7373776f 72642220 name="password" │ │ │ │ + 0x00fd8c00 73697a65 3d223230 22202f3e 3c2f7464 size="20" /></td │ │ │ │ + 0x00fd8c10 3e0a2020 20203c2f 74723e0a 20202020 >. </tr>. │ │ │ │ + 0x00fd8c20 3c74723e 0a202020 2020203c 74643e3c <tr>. <td>< │ │ │ │ + 0x00fd8c30 2f74643e 0a202020 2020203c 74643e3c /td>. <td>< │ │ │ │ + 0x00fd8c40 696e7075 74207479 70653d22 7375626d input type="subm │ │ │ │ + 0x00fd8c50 69742220 76616c75 653d2224 7b737562 it" value="${sub │ │ │ │ + 0x00fd8c60 6d697454 6578747d 22202f3e 3c2f7464 mitText}" /></td │ │ │ │ + 0x00fd8c70 3e0a2020 20203c2f 74723e0a 20203c2f >. </tr>. </ │ │ │ │ + 0x00fd8c80 7461626c 653e0a3c 2f666f72 6d3e0a00 table>.</form>.. │ │ │ │ + 0x00fd8c90 2e2f736e 61706c65 74732f68 65697374 ./snaplets/heist │ │ │ │ + 0x00fd8ca0 2f74656d 706c6174 65732f75 73657266 /templates/userf │ │ │ │ + 0x00fd8cb0 6f726d2e 74706c00 3c617070 6c792074 orm.tpl.<apply t │ │ │ │ + 0x00fd8cc0 656d706c 6174653d 22626173 65223e0a emplate="base">. │ │ │ │ + 0x00fd8cd0 20203c61 70706c79 2074656d 706c6174 <apply templat │ │ │ │ + 0x00fd8ce0 653d225f 6c6f6769 6e222f3e 0a3c2f61 e="_login"/>.</a │ │ │ │ + 0x00fd8cf0 70706c79 3e0a002e 2f736e61 706c6574 pply>.../snaplet │ │ │ │ + 0x00fd8d00 732f6865 6973742f 74656d70 6c617465 s/heist/template │ │ │ │ + 0x00fd8d10 732f6c6f 67696e2e 74706c00 3c68746d s/login.tpl.<htm │ │ │ │ + 0x00fd8d20 6c3e0a20 203c6865 61643e0a 20202020 l>. <head>. │ │ │ │ + 0x00fd8d30 3c746974 6c653e53 6e617020 77656220 <title>Snap web │ │ │ │ + 0x00fd8d40 73657276 65723c2f 7469746c 653e0a20 server. │ │ │ │ + 0x00fd8d50 2020203c 6c696e6b 2072656c 3d227374 . │ │ │ │ + 0x00fd8d90 203c2f68 6561643e 0a20203c 626f6479 . .
.. │ │ │ │ + 0x00fd8dc0 3c617070 6c792d63 6f6e7465 6e742f3e │ │ │ │ + 0x00fd8dd0 0a0a2020 20203c2f 6469763e 0a20203c ..
. < │ │ │ │ + 0x00fd8de0 2f626f64 793e0a3c 2f68746d 6c3e0a00 /body>... │ │ │ │ + 0x00fd8df0 2e2f736e 61706c65 74732f68 65697374 ./snaplets/heist │ │ │ │ + 0x00fd8e00 2f74656d 706c6174 65732f62 6173652e /templates/base. │ │ │ │ + 0x00fd8e10 74706c00 3c617070 6c792074 656d706c tpl.. ..../snaplet │ │ │ │ + 0x00fd8e60 732f6865 6973742f 74656d70 6c617465 s/heist/template │ │ │ │ + 0x00fd8e70 732f6e65 775f7573 65722e74 706c003c s/new_user.tpl.< │ │ │ │ + 0x00fd8e80 68313e52 65676973 74657220 61206e65 h1>Register a ne │ │ │ │ + 0x00fd8e90 77207573 65723c2f 68313e0a 0a3c6269 w user../new_user.Add │ │ │ │ + 0x00fd8ee0 55736572 3c2f6269 6e643e0a 3c617070 User..../snap │ │ │ │ + 0x00fd8f10 6c657473 2f686569 73742f74 656d706c lets/heist/templ │ │ │ │ + 0x00fd8f20 61746573 2f5f6e65 775f7573 65722e74 ates/_new_user.t │ │ │ │ + 0x00fd8f30 706c0068 746d6c20 7b0a2020 20706164 pl.html {. pad │ │ │ │ + 0x00fd8f40 64696e67 3a20303b 0a202020 6d617267 ding: 0;. marg │ │ │ │ + 0x00fd8f50 696e3a20 303b0a20 20206261 636b6772 in: 0;. backgr │ │ │ │ + 0x00fd8f60 6f756e64 2d636f6c 6f723a20 23666666 ound-color: #fff │ │ │ │ + 0x00fd8f70 6666663b 0a202020 666f6e74 2d66616d fff;. font-fam │ │ │ │ + 0x00fd8f80 696c793a 20566572 64616e61 2c204865 ily: Verdana, He │ │ │ │ + 0x00fd8f90 6c766574 6963612c 2073616e 732d7365 lvetica, sans-se │ │ │ │ + 0x00fd8fa0 7269663b 0a7d0a62 6f647920 7b0a2020 rif;.}.body {. │ │ │ │ + 0x00fd8fb0 20706164 64696e67 3a20303b 0a202020 padding: 0;. │ │ │ │ + 0x00fd8fc0 6d617267 696e3a20 303b0a7d 0a61207b margin: 0;.}.a { │ │ │ │ + 0x00fd8fd0 0a202020 74657874 2d646563 6f726174 . text-decorat │ │ │ │ + 0x00fd8fe0 696f6e3a 20756e64 65726c69 6e653b0a ion: underline;. │ │ │ │ + 0x00fd8ff0 7d0a6120 3a686f76 6572207b 0a202020 }.a :hover {. │ │ │ │ + 0x00fd9000 63757273 6f723a20 706f696e 7465723b cursor: pointer; │ │ │ │ + 0x00fd9010 0a202020 74657874 2d646563 6f726174 . text-decorat │ │ │ │ + 0x00fd9020 696f6e3a 20756e64 65726c69 6e653b0a ion: underline;. │ │ │ │ + 0x00fd9030 7d0a696d 67207b0a 20202062 6f726465 }.img {. borde │ │ │ │ + 0x00fd9040 723a206e 6f6e653b 0a7d0a23 636f6e74 r: none;.}.#cont │ │ │ │ + 0x00fd9050 656e7420 7b0a2020 20706164 64696e67 ent {. padding │ │ │ │ + 0x00fd9060 2d6c6566 743a2031 656d3b0a 7d0a2369 -left: 1em;.}.#i │ │ │ │ + 0x00fd9070 6e666f20 7b0a2020 20666f6e 742d7369 nfo {. font-si │ │ │ │ + 0x00fd9080 7a653a20 3630253b 0a7d0a00 2e2f7374 ze: 60%;.}.../st │ │ │ │ + 0x00fd9090 61746963 2f736372 65656e2e 63737300 atic/screen.css. │ │ │ │ 0x00fd90a0 2e2f736e 61706c65 74732f68 65697374 ./snaplets/heist │ │ │ │ 0x00fd90b0 2f74656d 706c6174 6573002e 2f736e61 /templates../sna │ │ │ │ 0x00fd90c0 706c6574 732f6865 69737400 2e2f736e plets/heist../sn │ │ │ │ 0x00fd90d0 61706c65 7473002e 2f737461 74696300 aplets../static. │ │ │ │ - 0x00fd90e0 3a736574 202d6973 72630a3a 73657420 :set -isrc.:set │ │ │ │ - 0x00fd90f0 2d686964 652d7061 636b6167 65204d6f -hide-package Mo │ │ │ │ - 0x00fd9100 6e616443 61746368 494f2d6d 746c0a3a nadCatchIO-mtl.: │ │ │ │ - 0x00fd9110 73657420 2d686964 652d7061 636b6167 set -hide-packag │ │ │ │ - 0x00fd9120 65206d6f 6e616473 2d66640a 3a736574 e monads-fd.:set │ │ │ │ - 0x00fd9130 202d584f 7665726c 6f616465 64537472 -XOverloadedStr │ │ │ │ - 0x00fd9140 696e6773 0a002e2f 2e676863 69004e61 ings.../.ghci.Na │ │ │ │ - 0x00fd9150 6d653a20 20202020 20202020 20202020 me: │ │ │ │ - 0x00fd9160 20202070 726f6a6e 616d650a 56657273 projname.Vers │ │ │ │ - 0x00fd9170 696f6e3a 20202020 20202020 20202020 ion: │ │ │ │ - 0x00fd9180 20302e31 0a53796e 6f707369 733a2020 0.1.Synopsis: │ │ │ │ - 0x00fd9190 20202020 20202020 20205072 6f6a6563 Projec │ │ │ │ - 0x00fd91a0 74205379 6e6f7073 69732048 6572650a t Synopsis Here. │ │ │ │ - 0x00fd91b0 44657363 72697074 696f6e3a 20202020 Description: │ │ │ │ - 0x00fd91c0 20202020 2050726f 6a656374 20446573 Project Des │ │ │ │ - 0x00fd91d0 63726970 74696f6e 20486572 650a4c69 cription Here.Li │ │ │ │ - 0x00fd91e0 63656e73 653a2020 20202020 20202020 cense: │ │ │ │ - 0x00fd91f0 20202041 6c6c5269 67687473 52657365 AllRightsRese │ │ │ │ - 0x00fd9200 72766564 0a417574 686f723a 20202020 rved.Author: │ │ │ │ - 0x00fd9210 20202020 20202020 20204175 74686f72 Author │ │ │ │ - 0x00fd9220 0a4d6169 6e746169 6e65723a 20202020 .Maintainer: │ │ │ │ - 0x00fd9230 20202020 20206d61 696e7461 696e6572 maintainer │ │ │ │ - 0x00fd9240 40657861 6d706c65 2e636f6d 0a537461 @example.com.Sta │ │ │ │ - 0x00fd9250 62696c69 74793a20 20202020 20202020 bility: │ │ │ │ - 0x00fd9260 20204578 70657269 6d656e74 616c0a43 Experimental.C │ │ │ │ - 0x00fd9270 61746567 6f72793a 20202020 20202020 ategory: │ │ │ │ - 0x00fd9280 20202020 5765620a 4275696c 642d7479 Web.Build-ty │ │ │ │ - 0x00fd9290 70653a20 20202020 20202020 2053696d pe: Sim │ │ │ │ - 0x00fd92a0 706c650a 43616261 6c2d7665 7273696f ple.Cabal-versio │ │ │ │ - 0x00fd92b0 6e3a2020 20202020 203e3d31 2e320a0a n: >=1.2.. │ │ │ │ - 0x00fd92c0 45786563 75746162 6c652070 726f6a6e Executable projn │ │ │ │ - 0x00fd92d0 616d650a 20206873 2d736f75 7263652d ame. hs-source- │ │ │ │ - 0x00fd92e0 64697273 3a207372 630a2020 6d61696e dirs: src. main │ │ │ │ - 0x00fd92f0 2d69733a 204d6169 6e2e6873 0a0a2020 -is: Main.hs.. │ │ │ │ - 0x00fd9300 4275696c 642d6465 70656e64 733a0a20 Build-depends:. │ │ │ │ - 0x00fd9310 20202062 61736520 20202020 20202020 base │ │ │ │ - 0x00fd9320 20202020 20202020 20202020 203e3d20 >= │ │ │ │ - 0x00fd9330 34202020 20202626 203c2035 2c0a2020 4 && < 5,. │ │ │ │ - 0x00fd9340 20206279 74657374 72696e67 20202020 bytestring │ │ │ │ - 0x00fd9350 20202020 20202020 20202020 3e3d2030 >= 0 │ │ │ │ - 0x00fd9360 2e392e31 20262620 3c20302e 31312c0a .9.1 && < 0.11,. │ │ │ │ - 0x00fd9370 20202020 6d746c20 20202020 20202020 mtl │ │ │ │ - 0x00fd9380 20202020 20202020 20202020 20203e3d >= │ │ │ │ - 0x00fd9390 20322020 20202026 26203c20 332c0a20 2 && < 3,. │ │ │ │ - 0x00fd93a0 20202073 6e61702d 636f7265 20202020 snap-core │ │ │ │ - 0x00fd93b0 20202020 20202020 20202020 203e3d20 >= │ │ │ │ - 0x00fd93c0 312e3020 20202626 203c2031 2e312c0a 1.0 && < 1.1,. │ │ │ │ - 0x00fd93d0 20202020 736e6170 2d736572 76657220 snap-server │ │ │ │ - 0x00fd93e0 20202020 20202020 20202020 20203e3d >= │ │ │ │ - 0x00fd93f0 20312e30 20202026 26203c20 312e320a 1.0 && < 1.2. │ │ │ │ - 0x00fd9400 0a202069 6620696d 706c2867 6863203e . if impl(ghc > │ │ │ │ - 0x00fd9410 3d20362e 31322e30 290a2020 20206768 = 6.12.0). gh │ │ │ │ - 0x00fd9420 632d6f70 74696f6e 733a202d 74687265 c-options: -thre │ │ │ │ - 0x00fd9430 61646564 202d5761 6c6c202d 66776172 aded -Wall -fwar │ │ │ │ - 0x00fd9440 6e2d7461 6273202d 66756e62 6f782d73 n-tabs -funbox-s │ │ │ │ - 0x00fd9450 74726963 742d6669 656c6473 202d4f32 trict-fields -O2 │ │ │ │ - 0x00fd9460 0a202020 20202020 20202020 20202020 . │ │ │ │ - 0x00fd9470 20202d66 6e6f2d77 61726e2d 756e7573 -fno-warn-unus │ │ │ │ - 0x00fd9480 65642d64 6f2d6269 6e640a20 20656c73 ed-do-bind. els │ │ │ │ - 0x00fd9490 650a2020 20206768 632d6f70 74696f6e e. ghc-option │ │ │ │ - 0x00fd94a0 733a202d 74687265 61646564 202d5761 s: -threaded -Wa │ │ │ │ - 0x00fd94b0 6c6c202d 66776172 6e2d7461 6273202d ll -fwarn-tabs - │ │ │ │ - 0x00fd94c0 66756e62 6f782d73 74726963 742d6669 funbox-strict-fi │ │ │ │ - 0x00fd94d0 656c6473 202d4f32 0a002e2f 666f6f2e elds -O2.../foo. │ │ │ │ - 0x00fd94e0 63616261 6c00706c 61636568 6f6c6465 cabal.placeholde │ │ │ │ - 0x00fd94f0 720a002e 2f6c6f67 2f706c61 6365686f r.../log/placeho │ │ │ │ - 0x00fd9500 6c646572 007b2d23 204c414e 47554147 lder.{-# LANGUAG │ │ │ │ - 0x00fd9510 45204f76 65726c6f 61646564 53747269 E OverloadedStri │ │ │ │ - 0x00fd9520 6e677320 232d7d0a 6d6f6475 6c65204d ngs #-}.module M │ │ │ │ - 0x00fd9530 61696e20 77686572 650a0a69 6d706f72 ain where..impor │ │ │ │ - 0x00fd9540 74202020 20202020 20202020 436f6e74 t Cont │ │ │ │ - 0x00fd9550 726f6c2e 4170706c 69636174 6976650a rol.Applicative. │ │ │ │ - 0x00fd9560 696d706f 72742020 20202020 20202020 import │ │ │ │ - 0x00fd9570 20536e61 702e436f 72650a69 6d706f72 Snap.Core.impor │ │ │ │ - 0x00fd9580 74202020 20202020 20202020 536e6170 t Snap │ │ │ │ - 0x00fd9590 2e557469 6c2e4669 6c655365 7276650a .Util.FileServe. │ │ │ │ - 0x00fd95a0 696d706f 72742020 20202020 20202020 import │ │ │ │ - 0x00fd95b0 20536e61 702e4874 74702e53 65727665 Snap.Http.Serve │ │ │ │ - 0x00fd95c0 720a0a6d 61696e20 3a3a2049 4f202829 r..main :: IO () │ │ │ │ - 0x00fd95d0 0a6d6169 6e203d20 71756963 6b487474 .main = quickHtt │ │ │ │ - 0x00fd95e0 70536572 76652073 6974650a 0a736974 pServe site..sit │ │ │ │ - 0x00fd95f0 65203a3a 20536e61 70202829 0a736974 e :: Snap ().sit │ │ │ │ - 0x00fd9600 65203d0a 20202020 6966546f 70202877 e =. ifTop (w │ │ │ │ - 0x00fd9610 72697465 42532022 68656c6c 6f20776f riteBS "hello wo │ │ │ │ - 0x00fd9620 726c6422 29203c7c 3e0a2020 2020726f rld") <|>. ro │ │ │ │ - 0x00fd9630 75746520 5b202822 666f6f22 2c207772 ute [ ("foo", wr │ │ │ │ - 0x00fd9640 69746542 53202262 61722229 0a202020 iteBS "bar"). │ │ │ │ - 0x00fd9650 20202020 2020202c 20282265 63686f2f , ("echo/ │ │ │ │ - 0x00fd9660 3a656368 6f706172 616d222c 20656368 :echoparam", ech │ │ │ │ - 0x00fd9670 6f48616e 646c6572 290a2020 20202020 oHandler). │ │ │ │ - 0x00fd9680 20202020 5d203c7c 3e0a2020 20206469 ] <|>. di │ │ │ │ - 0x00fd9690 72202273 74617469 63222028 73657276 r "static" (serv │ │ │ │ - 0x00fd96a0 65446972 6563746f 72792022 2e22290a eDirectory "."). │ │ │ │ - 0x00fd96b0 0a656368 6f48616e 646c6572 203a3a20 .echoHandler :: │ │ │ │ - 0x00fd96c0 536e6170 2028290a 6563686f 48616e64 Snap ().echoHand │ │ │ │ - 0x00fd96d0 6c657220 3d20646f 0a202020 20706172 ler = do. par │ │ │ │ - 0x00fd96e0 616d203c 2d206765 74506172 616d2022 am <- getParam " │ │ │ │ - 0x00fd96f0 6563686f 70617261 6d220a20 2020206d echoparam". m │ │ │ │ - 0x00fd9700 61796265 20287772 69746542 5320226d aybe (writeBS "m │ │ │ │ - 0x00fd9710 75737420 73706563 69667920 6563686f ust specify echo │ │ │ │ - 0x00fd9720 2f706172 616d2069 6e205552 4c22290a /param in URL"). │ │ │ │ - 0x00fd9730 20202020 20202020 20207772 69746542 writeB │ │ │ │ - 0x00fd9740 53207061 72616d0a 002e2f73 72632f4d S param.../src/M │ │ │ │ - 0x00fd9750 61696e2e 6873002e 2f6c6f67 002e2f73 ain.hs../log../s │ │ │ │ - 0x00fd9760 7263006d 61696e3a 4d61696e 2e48656c rc.main:Main.Hel │ │ │ │ + 0x00fd90e0 7b2d2320 4c414e47 55414745 204f7665 {-# LANGUAGE Ove │ │ │ │ + 0x00fd90f0 726c6f61 64656453 7472696e 67732023 rloadedStrings # │ │ │ │ + 0x00fd9100 2d7d0a6d 6f64756c 65204d61 696e2077 -}.module Main w │ │ │ │ + 0x00fd9110 68657265 0a0a696d 706f7274 20202020 here..import │ │ │ │ + 0x00fd9120 20202020 20202043 6f6e7472 6f6c2e41 Control.A │ │ │ │ + 0x00fd9130 70706c69 63617469 76650a69 6d706f72 pplicative.impor │ │ │ │ + 0x00fd9140 74202020 20202020 20202020 536e6170 t Snap │ │ │ │ + 0x00fd9150 2e436f72 650a696d 706f7274 20202020 .Core.import │ │ │ │ + 0x00fd9160 20202020 20202053 6e61702e 5574696c Snap.Util │ │ │ │ + 0x00fd9170 2e46696c 65536572 76650a69 6d706f72 .FileServe.impor │ │ │ │ + 0x00fd9180 74202020 20202020 20202020 536e6170 t Snap │ │ │ │ + 0x00fd9190 2e487474 702e5365 72766572 0a0a6d61 .Http.Server..ma │ │ │ │ + 0x00fd91a0 696e203a 3a20494f 2028290a 6d61696e in :: IO ().main │ │ │ │ + 0x00fd91b0 203d2071 7569636b 48747470 53657276 = quickHttpServ │ │ │ │ + 0x00fd91c0 65207369 74650a0a 73697465 203a3a20 e site..site :: │ │ │ │ + 0x00fd91d0 536e6170 2028290a 73697465 203d0a20 Snap ().site =. │ │ │ │ + 0x00fd91e0 20202069 66546f70 20287772 69746542 ifTop (writeB │ │ │ │ + 0x00fd91f0 53202268 656c6c6f 20776f72 6c642229 S "hello world") │ │ │ │ + 0x00fd9200 203c7c3e 0a202020 20726f75 7465205b <|>. route [ │ │ │ │ + 0x00fd9210 20282266 6f6f222c 20777269 74654253 ("foo", writeBS │ │ │ │ + 0x00fd9220 20226261 7222290a 20202020 20202020 "bar"). │ │ │ │ + 0x00fd9230 20202c20 28226563 686f2f3a 6563686f , ("echo/:echo │ │ │ │ + 0x00fd9240 70617261 6d222c20 6563686f 48616e64 param", echoHand │ │ │ │ + 0x00fd9250 6c657229 0a202020 20202020 2020205d ler). ] │ │ │ │ + 0x00fd9260 203c7c3e 0a202020 20646972 20227374 <|>. dir "st │ │ │ │ + 0x00fd9270 61746963 22202873 65727665 44697265 atic" (serveDire │ │ │ │ + 0x00fd9280 63746f72 7920222e 22290a0a 6563686f ctory ".")..echo │ │ │ │ + 0x00fd9290 48616e64 6c657220 3a3a2053 6e617020 Handler :: Snap │ │ │ │ + 0x00fd92a0 28290a65 63686f48 616e646c 6572203d ().echoHandler = │ │ │ │ + 0x00fd92b0 20646f0a 20202020 70617261 6d203c2d do. param <- │ │ │ │ + 0x00fd92c0 20676574 50617261 6d202265 63686f70 getParam "echop │ │ │ │ + 0x00fd92d0 6172616d 220a2020 20206d61 79626520 aram". maybe │ │ │ │ + 0x00fd92e0 28777269 74654253 20226d75 73742073 (writeBS "must s │ │ │ │ + 0x00fd92f0 70656369 66792065 63686f2f 70617261 pecify echo/para │ │ │ │ + 0x00fd9300 6d20696e 2055524c 22290a20 20202020 m in URL"). │ │ │ │ + 0x00fd9310 20202020 20777269 74654253 20706172 writeBS par │ │ │ │ + 0x00fd9320 616d0a00 2e2f7372 632f4d61 696e2e68 am.../src/Main.h │ │ │ │ + 0x00fd9330 7300706c 61636568 6f6c6465 720a002e s.placeholder... │ │ │ │ + 0x00fd9340 2f6c6f67 2f706c61 6365686f 6c646572 /log/placeholder │ │ │ │ + 0x00fd9350 003a7365 74202d69 7372630a 3a736574 .:set -isrc.:set │ │ │ │ + 0x00fd9360 202d6869 64652d70 61636b61 6765204d -hide-package M │ │ │ │ + 0x00fd9370 6f6e6164 43617463 68494f2d 6d746c0a onadCatchIO-mtl. │ │ │ │ + 0x00fd9380 3a736574 202d6869 64652d70 61636b61 :set -hide-packa │ │ │ │ + 0x00fd9390 6765206d 6f6e6164 732d6664 0a3a7365 ge monads-fd.:se │ │ │ │ + 0x00fd93a0 74202d58 4f766572 6c6f6164 65645374 t -XOverloadedSt │ │ │ │ + 0x00fd93b0 72696e67 730a002e 2f2e6768 6369004e rings.../.ghci.N │ │ │ │ + 0x00fd93c0 616d653a 20202020 20202020 20202020 ame: │ │ │ │ + 0x00fd93d0 20202020 70726f6a 6e616d65 0a566572 projname.Ver │ │ │ │ + 0x00fd93e0 73696f6e 3a202020 20202020 20202020 sion: │ │ │ │ + 0x00fd93f0 2020302e 310a5379 6e6f7073 69733a20 0.1.Synopsis: │ │ │ │ + 0x00fd9400 20202020 20202020 20202050 726f6a65 Proje │ │ │ │ + 0x00fd9410 63742053 796e6f70 73697320 48657265 ct Synopsis Here │ │ │ │ + 0x00fd9420 0a446573 63726970 74696f6e 3a202020 .Description: │ │ │ │ + 0x00fd9430 20202020 20205072 6f6a6563 74204465 Project De │ │ │ │ + 0x00fd9440 73637269 7074696f 6e204865 72650a4c scription Here.L │ │ │ │ + 0x00fd9450 6963656e 73653a20 20202020 20202020 icense: │ │ │ │ + 0x00fd9460 20202020 416c6c52 69676874 73526573 AllRightsRes │ │ │ │ + 0x00fd9470 65727665 640a4175 74686f72 3a202020 erved.Author: │ │ │ │ + 0x00fd9480 20202020 20202020 20202041 7574686f Autho │ │ │ │ + 0x00fd9490 720a4d61 696e7461 696e6572 3a202020 r.Maintainer: │ │ │ │ + 0x00fd94a0 20202020 2020206d 61696e74 61696e65 maintaine │ │ │ │ + 0x00fd94b0 72406578 616d706c 652e636f 6d0a5374 r@example.com.St │ │ │ │ + 0x00fd94c0 6162696c 6974793a 20202020 20202020 ability: │ │ │ │ + 0x00fd94d0 20202045 78706572 696d656e 74616c0a Experimental. │ │ │ │ + 0x00fd94e0 43617465 676f7279 3a202020 20202020 Category: │ │ │ │ + 0x00fd94f0 20202020 20576562 0a427569 6c642d74 Web.Build-t │ │ │ │ + 0x00fd9500 7970653a 20202020 20202020 20205369 ype: Si │ │ │ │ + 0x00fd9510 6d706c65 0a436162 616c2d76 65727369 mple.Cabal-versi │ │ │ │ + 0x00fd9520 6f6e3a20 20202020 20203e3d 312e320a on: >=1.2. │ │ │ │ + 0x00fd9530 0a457865 63757461 626c6520 70726f6a .Executable proj │ │ │ │ + 0x00fd9540 6e616d65 0a202068 732d736f 75726365 name. hs-source │ │ │ │ + 0x00fd9550 2d646972 733a2073 72630a20 206d6169 -dirs: src. mai │ │ │ │ + 0x00fd9560 6e2d6973 3a204d61 696e2e68 730a0a20 n-is: Main.hs.. │ │ │ │ + 0x00fd9570 20427569 6c642d64 6570656e 64733a0a Build-depends:. │ │ │ │ + 0x00fd9580 20202020 62617365 20202020 20202020 base │ │ │ │ + 0x00fd9590 20202020 20202020 20202020 20203e3d >= │ │ │ │ + 0x00fd95a0 20342020 20202026 26203c20 352c0a20 4 && < 5,. │ │ │ │ + 0x00fd95b0 20202062 79746573 7472696e 67202020 bytestring │ │ │ │ + 0x00fd95c0 20202020 20202020 20202020 203e3d20 >= │ │ │ │ + 0x00fd95d0 302e392e 31202626 203c2030 2e31312c 0.9.1 && < 0.11, │ │ │ │ + 0x00fd95e0 0a202020 206d746c 20202020 20202020 . mtl │ │ │ │ + 0x00fd95f0 20202020 20202020 20202020 2020203e > │ │ │ │ + 0x00fd9600 3d203220 20202020 2626203c 20332c0a = 2 && < 3,. │ │ │ │ + 0x00fd9610 20202020 736e6170 2d636f72 65202020 snap-core │ │ │ │ + 0x00fd9620 20202020 20202020 20202020 20203e3d >= │ │ │ │ + 0x00fd9630 20312e30 20202026 26203c20 312e312c 1.0 && < 1.1, │ │ │ │ + 0x00fd9640 0a202020 20736e61 702d7365 72766572 . snap-server │ │ │ │ + 0x00fd9650 20202020 20202020 20202020 2020203e > │ │ │ │ + 0x00fd9660 3d20312e 30202020 2626203c 20312e32 = 1.0 && < 1.2 │ │ │ │ + 0x00fd9670 0a0a2020 69662069 6d706c28 67686320 .. if impl(ghc │ │ │ │ + 0x00fd9680 3e3d2036 2e31322e 30290a20 20202067 >= 6.12.0). g │ │ │ │ + 0x00fd9690 68632d6f 7074696f 6e733a20 2d746872 hc-options: -thr │ │ │ │ + 0x00fd96a0 65616465 64202d57 616c6c20 2d667761 eaded -Wall -fwa │ │ │ │ + 0x00fd96b0 726e2d74 61627320 2d66756e 626f782d rn-tabs -funbox- │ │ │ │ + 0x00fd96c0 73747269 63742d66 69656c64 73202d4f strict-fields -O │ │ │ │ + 0x00fd96d0 320a2020 20202020 20202020 20202020 2. │ │ │ │ + 0x00fd96e0 2020202d 666e6f2d 7761726e 2d756e75 -fno-warn-unu │ │ │ │ + 0x00fd96f0 7365642d 646f2d62 696e640a 2020656c sed-do-bind. el │ │ │ │ + 0x00fd9700 73650a20 20202067 68632d6f 7074696f se. ghc-optio │ │ │ │ + 0x00fd9710 6e733a20 2d746872 65616465 64202d57 ns: -threaded -W │ │ │ │ + 0x00fd9720 616c6c20 2d667761 726e2d74 61627320 all -fwarn-tabs │ │ │ │ + 0x00fd9730 2d66756e 626f782d 73747269 63742d66 -funbox-strict-f │ │ │ │ + 0x00fd9740 69656c64 73202d4f 320a002e 2f666f6f ields -O2.../foo │ │ │ │ + 0x00fd9750 2e636162 616c002e 2f737263 002e2f6c .cabal../src../l │ │ │ │ + 0x00fd9760 6f67006d 61696e3a 4d61696e 2e48656c og.main:Main.Hel │ │ │ │ 0x00fd9770 70004461 74612e54 6578742e 636f6e63 p.Data.Text.conc │ │ │ │ 0x00fd9780 61743a20 73697a65 206f7665 72666c6f at: size overflo │ │ │ │ 0x00fd9790 77006f76 6572666c 6f774572 726f7200 w.overflowError. │ │ │ │ 0x00fd97a0 7461696c 00627265 616b4f6e 416c6c00 tail.breakOnAll. │ │ │ │ 0x00fd97b0 62726561 6b4f6e00 73706c69 744f6e00 breakOn.splitOn. │ │ │ │ 0x00fd97c0 3a20656d 70747920 696e7075 74004461 : empty input.Da │ │ │ │ 0x00fd97d0 74612e54 6578742e 004e6567 61746976 ta.Text..Negativ │ │ │ ├── readelf --wide --decompress --hex-dump=.data {} │ │ │ │ @@ -18,36 +18,36 @@ │ │ │ │ 0x0114ca30 00000000 00000000 5797fd00 00000000 ........W....... │ │ │ │ 0x0114ca40 602cf800 00000000 18ca1401 00000000 `,.............. │ │ │ │ 0x0114ca50 39142b01 00000000 00000000 00000000 9.+............. │ │ │ │ 0x0114ca60 602cf800 00000000 f0c91401 00000000 `,.............. │ │ │ │ 0x0114ca70 42ca1401 00000000 00000000 00000000 B............... │ │ │ │ 0x0114ca80 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0114ca90 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114caa0 4997fd00 00000000 e852fb00 00000000 I........R...... │ │ │ │ + 0x0114caa0 4b97fd00 00000000 e852fb00 00000000 K........R...... │ │ │ │ 0x0114cab0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cac0 00000000 00000000 0595fd00 00000000 ................ │ │ │ │ + 0x0114cac0 00000000 00000000 bf93fd00 00000000 ................ │ │ │ │ 0x0114cad0 b812f800 00000000 80ca1401 00000000 ................ │ │ │ │ 0x0114cae0 a8ca1401 00000000 00000000 00000000 ................ │ │ │ │ 0x0114caf0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0114cb00 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cb10 f394fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114cb10 b793fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114cb20 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cb30 00000000 00000000 e694fd00 00000000 ................ │ │ │ │ + 0x0114cb30 00000000 00000000 5193fd00 00000000 ........Q....... │ │ │ │ 0x0114cb40 b812f800 00000000 f0ca1401 00000000 ................ │ │ │ │ 0x0114cb50 18cb1401 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cb60 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0114cb70 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cb80 da94fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114cb80 3f93fd00 00000000 e852fb00 00000000 ?........R...... │ │ │ │ 0x0114cb90 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cba0 00000000 00000000 4e91fd00 00000000 ........N....... │ │ │ │ + 0x0114cba0 00000000 00000000 3293fd00 00000000 ........2....... │ │ │ │ 0x0114cbb0 b812f800 00000000 60cb1401 00000000 ........`....... │ │ │ │ 0x0114cbc0 88cb1401 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cbd0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0114cbe0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cbf0 4691fd00 00000000 e852fb00 00000000 F........R...... │ │ │ │ + 0x0114cbf0 2493fd00 00000000 e852fb00 00000000 $........R...... │ │ │ │ 0x0114cc00 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cc10 00000000 00000000 e090fd00 00000000 ................ │ │ │ │ 0x0114cc20 b812f800 00000000 d0cb1401 00000000 ................ │ │ │ │ 0x0114cc30 f8cb1401 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cc40 602cf800 00000000 21cc1401 00000000 `,......!....... │ │ │ │ 0x0114cc50 39142b01 00000000 00000000 00000000 9.+............. │ │ │ │ 0x0114cc60 602cf800 00000000 b1cb1401 00000000 `,.............. │ │ │ │ @@ -65,158 +65,158 @@ │ │ │ │ 0x0114cd20 00000000 00000000 cc90fd00 00000000 ................ │ │ │ │ 0x0114cd30 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0114cd40 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cd50 bb90fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114cd60 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cd70 00000000 00000000 a090fd00 00000000 ................ │ │ │ │ 0x0114cd80 602cf800 00000000 58cd1401 00000000 `,......X....... │ │ │ │ - 0x0114cd90 39142b01 00000000 00000000 00000000 9.+............. │ │ │ │ + 0x0114cd90 62ca1401 00000000 00000000 00000000 b............... │ │ │ │ 0x0114cda0 602cf800 00000000 30cd1401 00000000 `,......0....... │ │ │ │ 0x0114cdb0 82cd1401 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cdc0 602cf800 00000000 08cd1401 00000000 `,.............. │ │ │ │ 0x0114cdd0 a2cd1401 00000000 00000000 00000000 ................ │ │ │ │ 0x0114cde0 602cf800 00000000 e0cc1401 00000000 `,.............. │ │ │ │ 0x0114cdf0 c2cd1401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114ce00 602cf800 00000000 18ca1401 00000000 `,.............. │ │ │ │ - 0x0114ce10 e2cd1401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114ce20 602cf800 00000000 f0c91401 00000000 `,.............. │ │ │ │ - 0x0114ce30 02ce1401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114ce40 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114ce50 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114ce60 1b7dfd00 00000000 b812f800 00000000 .}.............. │ │ │ │ - 0x0114ce70 80ca1401 00000000 40ce1401 00000000 ........@....... │ │ │ │ - 0x0114ce80 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114ce90 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cea0 00000000 00000000 067dfd00 00000000 .........}...... │ │ │ │ - 0x0114ceb0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114cec0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114ced0 ba79fd00 00000000 b812f800 00000000 .y.............. │ │ │ │ - 0x0114cee0 88ce1401 00000000 b0ce1401 00000000 ................ │ │ │ │ - 0x0114cef0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114cf00 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cf10 00000000 00000000 ac79fd00 00000000 .........y...... │ │ │ │ - 0x0114cf20 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114cf30 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cf40 766cfd00 00000000 b812f800 00000000 vl.............. │ │ │ │ - 0x0114cf50 f8ce1401 00000000 20cf1401 00000000 ........ ....... │ │ │ │ - 0x0114cf60 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114cf70 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cf80 00000000 00000000 626cfd00 00000000 ........bl...... │ │ │ │ - 0x0114cf90 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114cfa0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cfb0 096bfd00 00000000 b812f800 00000000 .k.............. │ │ │ │ - 0x0114cfc0 68cf1401 00000000 90cf1401 00000000 h............... │ │ │ │ - 0x0114cfd0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114cfe0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114cff0 00000000 00000000 e36afd00 00000000 .........j...... │ │ │ │ - 0x0114d000 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d010 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d020 fb69fd00 00000000 b812f800 00000000 .i.............. │ │ │ │ - 0x0114d030 d8cf1401 00000000 00d01401 00000000 ................ │ │ │ │ - 0x0114d040 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d050 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d060 00000000 00000000 d769fd00 00000000 .........i...... │ │ │ │ - 0x0114d070 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d080 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d090 0369fd00 00000000 b812f800 00000000 .i.............. │ │ │ │ - 0x0114d0a0 48d01401 00000000 70d01401 00000000 H.......p....... │ │ │ │ - 0x0114d0b0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d0c0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d0d0 00000000 00000000 db68fd00 00000000 .........h...... │ │ │ │ - 0x0114d0e0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d0f0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d100 6167fd00 00000000 b812f800 00000000 ag.............. │ │ │ │ - 0x0114d110 b8d01401 00000000 e0d01401 00000000 ................ │ │ │ │ - 0x0114d120 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d130 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d140 00000000 00000000 3967fd00 00000000 ........9g...... │ │ │ │ - 0x0114d150 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d160 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d170 f666fd00 00000000 b812f800 00000000 .f.............. │ │ │ │ - 0x0114d180 28d11401 00000000 50d11401 00000000 (.......P....... │ │ │ │ - 0x0114d190 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d1a0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d1b0 00000000 00000000 d166fd00 00000000 .........f...... │ │ │ │ - 0x0114d1c0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114ce00 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114ce10 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114ce20 8c90fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114ce30 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114ce40 00000000 00000000 338ffd00 00000000 ........3....... │ │ │ │ + 0x0114ce50 b812f800 00000000 00ce1401 00000000 ................ │ │ │ │ + 0x0114ce60 28ce1401 00000000 00000000 00000000 (............... │ │ │ │ + 0x0114ce70 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114ce80 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114ce90 0a8ffd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114cea0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114ceb0 00000000 00000000 7f8efd00 00000000 ................ │ │ │ │ + 0x0114cec0 b812f800 00000000 70ce1401 00000000 ........p....... │ │ │ │ + 0x0114ced0 98ce1401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cee0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114cef0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cf00 578efd00 00000000 e852fb00 00000000 W........R...... │ │ │ │ + 0x0114cf10 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cf20 00000000 00000000 148efd00 00000000 ................ │ │ │ │ + 0x0114cf30 b812f800 00000000 e0ce1401 00000000 ................ │ │ │ │ + 0x0114cf40 08cf1401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cf50 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114cf60 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cf70 f08dfd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114cf80 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cf90 00000000 00000000 1c8dfd00 00000000 ................ │ │ │ │ + 0x0114cfa0 b812f800 00000000 50cf1401 00000000 ........P....... │ │ │ │ + 0x0114cfb0 78cf1401 00000000 00000000 00000000 x............... │ │ │ │ + 0x0114cfc0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114cfd0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114cfe0 f78cfd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114cff0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d000 00000000 00000000 b88cfd00 00000000 ................ │ │ │ │ + 0x0114d010 b812f800 00000000 c0cf1401 00000000 ................ │ │ │ │ + 0x0114d020 e8cf1401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d030 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d040 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d050 908cfd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114d060 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d070 00000000 00000000 168bfd00 00000000 ................ │ │ │ │ + 0x0114d080 b812f800 00000000 30d01401 00000000 ........0....... │ │ │ │ + 0x0114d090 58d01401 00000000 00000000 00000000 X............... │ │ │ │ + 0x0114d0a0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d0b0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d0c0 f08afd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114d0d0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d0e0 00000000 00000000 088afd00 00000000 ................ │ │ │ │ + 0x0114d0f0 b812f800 00000000 a0d01401 00000000 ................ │ │ │ │ + 0x0114d100 c8d01401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d110 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d120 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d130 e389fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114d140 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d150 00000000 00000000 2888fd00 00000000 ........(....... │ │ │ │ + 0x0114d160 b812f800 00000000 10d11401 00000000 ................ │ │ │ │ + 0x0114d170 38d11401 00000000 00000000 00000000 8............... │ │ │ │ + 0x0114d180 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d190 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d1a0 1680fd00 00000000 b812f800 00000000 ................ │ │ │ │ + 0x0114d1b0 80ca1401 00000000 80d11401 00000000 ................ │ │ │ │ + 0x0114d1c0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114d1d0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d1e0 9266fd00 00000000 b812f800 00000000 .f.............. │ │ │ │ - 0x0114d1f0 98d11401 00000000 c0d11401 00000000 ................ │ │ │ │ - 0x0114d200 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d210 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d220 00000000 00000000 6d66fd00 00000000 ........mf...... │ │ │ │ - 0x0114d230 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d1e0 00000000 00000000 0180fd00 00000000 ................ │ │ │ │ + 0x0114d1f0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d200 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d210 b57cfd00 00000000 b812f800 00000000 .|.............. │ │ │ │ + 0x0114d220 c8d11401 00000000 f0d11401 00000000 ................ │ │ │ │ + 0x0114d230 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114d240 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d250 b264fd00 00000000 b812f800 00000000 .d.............. │ │ │ │ - 0x0114d260 08d21401 00000000 30d21401 00000000 ........0....... │ │ │ │ - 0x0114d270 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d280 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d290 00000000 00000000 8964fd00 00000000 .........d...... │ │ │ │ - 0x0114d2a0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d250 00000000 00000000 a77cfd00 00000000 .........|...... │ │ │ │ + 0x0114d260 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d270 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d280 716ffd00 00000000 b812f800 00000000 qo.............. │ │ │ │ + 0x0114d290 38d21401 00000000 60d21401 00000000 8.......`....... │ │ │ │ + 0x0114d2a0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114d2b0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d2c0 fe63fd00 00000000 b812f800 00000000 .c.............. │ │ │ │ - 0x0114d2d0 78d21401 00000000 a0d21401 00000000 x............... │ │ │ │ - 0x0114d2e0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ - 0x0114d2f0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d300 00000000 00000000 ec5bfd00 00000000 .........[...... │ │ │ │ - 0x0114d310 b812f800 00000000 60cb1401 00000000 ........`....... │ │ │ │ - 0x0114d320 e8d21401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d330 602cf800 00000000 11d31401 00000000 `,.............. │ │ │ │ - 0x0114d340 42cc1401 00000000 00000000 00000000 B............... │ │ │ │ - 0x0114d350 602cf800 00000000 c9d21401 00000000 `,.............. │ │ │ │ + 0x0114d2c0 00000000 00000000 ec5bfd00 00000000 .........[...... │ │ │ │ + 0x0114d2d0 b812f800 00000000 d0cb1401 00000000 ................ │ │ │ │ + 0x0114d2e0 a8d21401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d2f0 602cf800 00000000 d1d21401 00000000 `,.............. │ │ │ │ + 0x0114d300 39142b01 00000000 00000000 00000000 9.+............. │ │ │ │ + 0x0114d310 602cf800 00000000 89d21401 00000000 `,.............. │ │ │ │ + 0x0114d320 f2d21401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d330 602cf800 00000000 19d21401 00000000 `,.............. │ │ │ │ + 0x0114d340 12d31401 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d350 602cf800 00000000 b1cb1401 00000000 `,.............. │ │ │ │ 0x0114d360 32d31401 00000000 00000000 00000000 2............... │ │ │ │ - 0x0114d370 602cf800 00000000 59d21401 00000000 `,......Y....... │ │ │ │ + 0x0114d370 602cf800 00000000 41cb1401 00000000 `,......A....... │ │ │ │ 0x0114d380 52d31401 00000000 00000000 00000000 R............... │ │ │ │ - 0x0114d390 602cf800 00000000 e9d11401 00000000 `,.............. │ │ │ │ + 0x0114d390 602cf800 00000000 a9d11401 00000000 `,.............. │ │ │ │ 0x0114d3a0 72d31401 00000000 00000000 00000000 r............... │ │ │ │ - 0x0114d3b0 602cf800 00000000 79d11401 00000000 `,......y....... │ │ │ │ + 0x0114d3b0 602cf800 00000000 61d11401 00000000 `,......a....... │ │ │ │ 0x0114d3c0 92d31401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d3d0 602cf800 00000000 09d11401 00000000 `,.............. │ │ │ │ + 0x0114d3d0 602cf800 00000000 f1d01401 00000000 `,.............. │ │ │ │ 0x0114d3e0 b2d31401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d3f0 602cf800 00000000 99d01401 00000000 `,.............. │ │ │ │ + 0x0114d3f0 602cf800 00000000 81d01401 00000000 `,.............. │ │ │ │ 0x0114d400 d2d31401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d410 602cf800 00000000 29d01401 00000000 `,......)....... │ │ │ │ + 0x0114d410 602cf800 00000000 11d01401 00000000 `,.............. │ │ │ │ 0x0114d420 f2d31401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d430 602cf800 00000000 b9cf1401 00000000 `,.............. │ │ │ │ + 0x0114d430 602cf800 00000000 a1cf1401 00000000 `,.............. │ │ │ │ 0x0114d440 12d41401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d450 602cf800 00000000 41cb1401 00000000 `,......A....... │ │ │ │ + 0x0114d450 602cf800 00000000 31cf1401 00000000 `,......1....... │ │ │ │ 0x0114d460 32d41401 00000000 00000000 00000000 2............... │ │ │ │ - 0x0114d470 602cf800 00000000 49cf1401 00000000 `,......I....... │ │ │ │ + 0x0114d470 602cf800 00000000 c1ce1401 00000000 `,.............. │ │ │ │ 0x0114d480 52d41401 00000000 00000000 00000000 R............... │ │ │ │ - 0x0114d490 602cf800 00000000 d9ce1401 00000000 `,.............. │ │ │ │ + 0x0114d490 602cf800 00000000 51ce1401 00000000 `,......Q....... │ │ │ │ 0x0114d4a0 72d41401 00000000 00000000 00000000 r............... │ │ │ │ - 0x0114d4b0 602cf800 00000000 69ce1401 00000000 `,......i....... │ │ │ │ + 0x0114d4b0 b812f800 00000000 e2cd1401 00000000 ................ │ │ │ │ 0x0114d4c0 92d41401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d4d0 b812f800 00000000 22ce1401 00000000 ........"....... │ │ │ │ - 0x0114d4e0 b2d41401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d4f0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d500 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d510 d95bfd00 00000000 e852fb00 00000000 .[.......R...... │ │ │ │ + 0x0114d4d0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d4e0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d4f0 8557fd00 00000000 b812f800 00000000 .W.............. │ │ │ │ + 0x0114d500 80ca1401 00000000 d0d41401 00000000 ................ │ │ │ │ + 0x0114d510 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114d520 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d530 00000000 00000000 aa18fd00 00000000 ................ │ │ │ │ - 0x0114d540 b812f800 00000000 f0d41401 00000000 ................ │ │ │ │ - 0x0114d550 18d51401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d560 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d570 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d580 9a18fd00 00000000 e852fb00 00000000 .........R...... │ │ │ │ + 0x0114d530 00000000 00000000 7557fd00 00000000 ........uW...... │ │ │ │ + 0x0114d540 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d550 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d560 0656fd00 00000000 b812f800 00000000 .V.............. │ │ │ │ + 0x0114d570 18d51401 00000000 40d51401 00000000 ........@....... │ │ │ │ + 0x0114d580 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114d590 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d5a0 00000000 00000000 2b17fd00 00000000 ........+....... │ │ │ │ - 0x0114d5b0 b812f800 00000000 60d51401 00000000 ........`....... │ │ │ │ - 0x0114d5c0 88d51401 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d5d0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ - 0x0114d5e0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114d5f0 c412fd00 00000000 b812f800 00000000 ................ │ │ │ │ - 0x0114d600 60cb1401 00000000 d0d51401 00000000 `............... │ │ │ │ + 0x0114d5a0 00000000 00000000 f355fd00 00000000 .........U...... │ │ │ │ + 0x0114d5b0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ + 0x0114d5c0 00000000 00000000 00000000 00000000 ................ │ │ │ │ + 0x0114d5d0 c412fd00 00000000 b812f800 00000000 ................ │ │ │ │ + 0x0114d5e0 88d51401 00000000 b0d51401 00000000 ................ │ │ │ │ + 0x0114d5f0 00000000 00000000 602cf800 00000000 ........`,...... │ │ │ │ + 0x0114d600 d9d51401 00000000 39142b01 00000000 ........9.+..... │ │ │ │ 0x0114d610 00000000 00000000 602cf800 00000000 ........`,...... │ │ │ │ - 0x0114d620 f9d51401 00000000 42cc1401 00000000 ........B....... │ │ │ │ + 0x0114d620 69d51401 00000000 fad51401 00000000 i............... │ │ │ │ 0x0114d630 00000000 00000000 602cf800 00000000 ........`,...... │ │ │ │ - 0x0114d640 41cb1401 00000000 1ad61401 00000000 A............... │ │ │ │ + 0x0114d640 b1cb1401 00000000 1ad61401 00000000 ................ │ │ │ │ 0x0114d650 00000000 00000000 602cf800 00000000 ........`,...... │ │ │ │ - 0x0114d660 b1d51401 00000000 3ad61401 00000000 ........:....... │ │ │ │ + 0x0114d660 41cb1401 00000000 3ad61401 00000000 A.......:....... │ │ │ │ 0x0114d670 00000000 00000000 602cf800 00000000 ........`,...... │ │ │ │ - 0x0114d680 41d51401 00000000 5ad61401 00000000 A.......Z....... │ │ │ │ + 0x0114d680 f9d41401 00000000 5ad61401 00000000 ........Z....... │ │ │ │ 0x0114d690 00000000 00000000 b812f800 00000000 ................ │ │ │ │ 0x0114d6a0 62ca1401 00000000 7ad61401 00000000 b.......z....... │ │ │ │ 0x0114d6b0 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114d6c0 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0114d6d0 00000000 00000000 a312fd00 00000000 ................ │ │ │ │ 0x0114d6e0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0114d6f0 00000000 00000000 00000000 00000000 ................ │ │ │ │ @@ -339,22 +339,22 @@ │ │ │ │ 0x0114de40 d8dd1401 00000000 e9f03301 00000000 ..........3..... │ │ │ │ 0x0114de50 99ed3301 00000000 e9f03301 00000000 ..3.......3..... │ │ │ │ 0x0114de60 29ee3301 00000000 00000000 00000000 ).3............. │ │ │ │ 0x0114de70 a8d2df00 00000000 00de1401 00000000 ................ │ │ │ │ 0x0114de80 29de1401 00000000 81472301 00000000 )........G#..... │ │ │ │ 0x0114de90 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114dea0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114deb0 00000000 00000000 dc94fd00 00000000 ................ │ │ │ │ + 0x0114deb0 00000000 00000000 4d97fd00 00000000 ........M....... │ │ │ │ 0x0114dec0 88af4000 00000000 00000000 00000000 ..@............. │ │ │ │ 0x0114ded0 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0114dee0 80b04000 00000000 98071701 00000000 ..@............. │ │ │ │ 0x0114def0 187e1901 00000000 403d1601 00000000 .~......@=...... │ │ │ │ 0x0114df00 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0114df10 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0114df20 00000000 00000000 df94fd00 00000000 ................ │ │ │ │ + 0x0114df20 00000000 00000000 5097fd00 00000000 ........P....... │ │ │ │ 0x0114df30 9039fb00 00000000 b8051501 00000000 .9.............. │ │ │ │ 0x0114df40 70de1401 00000000 00000000 00000000 p............... │ │ │ │ 0x0114df50 9039fb00 00000000 c0de1401 00000000 .9.............. │ │ │ │ 0x0114df60 30df1401 00000000 00000000 00000000 0............... │ │ │ │ 0x0114df70 003afb00 00000000 d8052201 00000000 .:........"..... │ │ │ │ 0x0114df80 c8e82101 00000000 98de1401 00000000 ..!............. │ │ │ │ 0x0114df90 50df1401 00000000 00000000 00000000 P............... │ │ │ │ @@ -431,15 +431,15 @@ │ │ │ │ 0x0114e400 602cf800 00000000 d1e31401 00000000 `,.............. │ │ │ │ 0x0114e410 39142b01 00000000 00000000 00000000 9.+............. │ │ │ │ 0x0114e420 9039fb00 00000000 10bf2301 00000000 .9........#..... │ │ │ │ 0x0114e430 58dc1401 00000000 00000000 00000000 X............... │ │ │ │ 0x0114e440 9039fb00 00000000 68f51601 00000000 .9......h....... │ │ │ │ 0x0114e450 48e21401 00000000 00000000 00000000 H............... │ │ │ │ 0x0114e460 703afb00 00000000 c8df1401 00000000 p:.............. │ │ │ │ - 0x0114e470 b0d41401 00000000 20ce1401 00000000 ........ ....... │ │ │ │ + 0x0114e470 90d41401 00000000 e0cd1401 00000000 ................ │ │ │ │ 0x0114e480 68e21401 00000000 98e21401 00000000 h............... │ │ │ │ 0x0114e490 40e41401 00000000 00000000 00000000 @............... │ │ │ │ 0x0114e4a0 383afb00 00000000 c8df1401 00000000 8:.............. │ │ │ │ 0x0114e4b0 60ca1401 00000000 78d61401 00000000 `.......x....... │ │ │ │ 0x0114e4c0 68e21401 00000000 40e41401 00000000 h.......@....... │ │ │ │ 0x0114e4d0 00000000 00000000 9039fb00 00000000 .........9...... │ │ │ │ 0x0114e4e0 60e41401 00000000 a0e41401 00000000 `............... │ │ │ │ @@ -47149,15 +47149,15 @@ │ │ │ │ 0x01204be0 a08ec400 00000000 088fc400 00000000 ................ │ │ │ │ 0x01204bf0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x01204c00 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x01204c10 c588fe00 00000000 5091c400 00000000 ........P....... │ │ │ │ 0x01204c20 f091c400 00000000 00000000 00000000 ................ │ │ │ │ 0x01204c30 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x01204c40 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x01204c50 047dfd00 00000000 9039fb00 00000000 .}.......9...... │ │ │ │ + 0x01204c50 ff7ffd00 00000000 9039fb00 00000000 .........9...... │ │ │ │ 0x01204c60 f04b2001 00000000 304c2001 00000000 .K .....0L ..... │ │ │ │ 0x01204c70 00000000 00000000 1893c400 00000000 ................ │ │ │ │ 0x01204c80 00000000 00000000 9039fb00 00000000 .........9...... │ │ │ │ 0x01204c90 304c2001 00000000 804a2001 00000000 0L ......J ..... │ │ │ │ 0x01204ca0 00000000 00000000 9039fb00 00000000 .........9...... │ │ │ │ 0x01204cb0 f04b2001 00000000 884c2001 00000000 .K ......L ..... │ │ │ │ 0x01204cc0 00000000 00000000 9039fb00 00000000 .........9...... │ │ │ │ @@ -52762,15 +52762,15 @@ │ │ │ │ 0x0121aab0 c084cf00 00000000 2885cf00 00000000 ........(....... │ │ │ │ 0x0121aac0 9085cf00 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0121aad0 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0121aae0 00000000 00000000 aba8fe00 00000000 ................ │ │ │ │ 0x0121aaf0 c02bf800 00000000 20000000 00000000 .+...... ....... │ │ │ │ 0x0121ab00 f885cf00 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0121ab10 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0121ab20 00000000 00000000 047dfd00 00000000 .........}...... │ │ │ │ + 0x0121ab20 00000000 00000000 ff7ffd00 00000000 ................ │ │ │ │ 0x0121ab30 6886cf00 00000000 00000000 00000000 h............... │ │ │ │ 0x0121ab40 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0121ab50 9039fb00 00000000 08ab2101 00000000 .9........!..... │ │ │ │ 0x0121ab60 30ab2101 00000000 00000000 00000000 0.!............. │ │ │ │ 0x0121ab70 8088cf00 00000000 00000000 00000000 ................ │ │ │ │ 0x0121ab80 a022f800 00000000 89092b01 00000000 ."........+..... │ │ │ │ 0x0121ab90 39142b01 00000000 03000000 00000000 9.+............. │ │ │ │ @@ -53895,15 +53895,15 @@ │ │ │ │ 0x0121f180 00000000 00000000 4835d100 00000000 ........H5...... │ │ │ │ 0x0121f190 00000000 00000000 c839fb00 00000000 .........9...... │ │ │ │ 0x0121f1a0 18192501 00000000 58952101 00000000 ..%.....X.!..... │ │ │ │ 0x0121f1b0 88f12101 00000000 00000000 00000000 ..!............. │ │ │ │ 0x0121f1c0 a035d100 00000000 00000000 00000000 .5.............. │ │ │ │ 0x0121f1d0 8836d100 00000000 e852fb00 00000000 .6.......R...... │ │ │ │ 0x0121f1e0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0121f1f0 00000000 00000000 047dfd00 00000000 .........}...... │ │ │ │ + 0x0121f1f0 00000000 00000000 ff7ffd00 00000000 ................ │ │ │ │ 0x0121f200 e037d100 00000000 90251f01 00000000 .7.......%...... │ │ │ │ 0x0121f210 d8f12101 00000000 00000000 00000000 ..!............. │ │ │ │ 0x0121f220 7038d100 00000000 00000000 00000000 p8.............. │ │ │ │ 0x0121f230 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0121f240 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0121f250 1bb3fe00 00000000 9039fb00 00000000 .........9...... │ │ │ │ 0x0121f260 c0462001 00000000 30f22101 00000000 .F .....0.!..... │ │ │ │ @@ -60995,15 +60995,15 @@ │ │ │ │ 0x0123ad40 00000000 00000000 4f48ff00 00000000 ........OH...... │ │ │ │ 0x0123ad50 182ee200 00000000 0839e200 00000000 .........9...... │ │ │ │ 0x0123ad60 00000000 00000000 9039fb00 00000000 .........9...... │ │ │ │ 0x0123ad70 08ad2301 00000000 58ad2301 00000000 ..#.....X.#..... │ │ │ │ 0x0123ad80 00000000 00000000 003de200 00000000 .........=...... │ │ │ │ 0x0123ad90 00000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ 0x0123ada0 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0123adb0 00000000 00000000 047dfd00 00000000 .........}...... │ │ │ │ + 0x0123adb0 00000000 00000000 ff7ffd00 00000000 ................ │ │ │ │ 0x0123adc0 a03ee200 00000000 00000000 00000000 .>.............. │ │ │ │ 0x0123add0 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0123ade0 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0123adf0 a55dff00 00000000 183fe200 00000000 .].......?...... │ │ │ │ 0x0123ae00 00000000 00000000 783fe200 00000000 ........x?...... │ │ │ │ 0x0123ae10 d077e200 00000000 39142b01 00000000 .w......9.+..... │ │ │ │ 0x0123ae20 03000000 00000000 e852fb00 00000000 .........R...... │ │ │ │ @@ -61628,15 +61628,15 @@ │ │ │ │ 0x0123d4d0 c00be300 00000000 20d22301 00000000 ........ .#..... │ │ │ │ 0x0123d4e0 e0d32301 00000000 00000000 00000000 ..#............. │ │ │ │ 0x0123d4f0 180ce300 00000000 00000000 00000000 ................ │ │ │ │ 0x0123d500 880ce300 00000000 00000000 00000000 ................ │ │ │ │ 0x0123d510 a80ce300 00000000 380de300 00000000 ........8....... │ │ │ │ 0x0123d520 e852fb00 00000000 00000000 00000000 .R.............. │ │ │ │ 0x0123d530 00000000 00000000 00000000 00000000 ................ │ │ │ │ - 0x0123d540 047dfd00 00000000 280ee300 00000000 .}......(....... │ │ │ │ + 0x0123d540 ff7ffd00 00000000 280ee300 00000000 ........(....... │ │ │ │ 0x0123d550 38231f01 00000000 20d52301 00000000 8#...... .#..... │ │ │ │ 0x0123d560 00000000 00000000 980ee300 00000000 ................ │ │ │ │ 0x0123d570 00000000 00000000 b00ee300 00000000 ................ │ │ │ │ 0x0123d580 00000000 00000000 00000000 00000000 ................ │ │ │ │ 0x0123d590 00000000 00000000 300fe300 00000000 ........0....... │ │ │ │ 0x0123d5a0 900fe300 00000000 b80fe300 00000000 ................ │ │ │ │ 0x0123d5b0 00000000 00000000 8013e300 00000000 ................