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

Snap Example App Login

\n+

\n+/login\n+Login\n+\n+

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

\n+./snaplets/heist/templates/_login.tpl\n+

Register a new user

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

\n

Congrats! You're logged in as ''

\n

Logout

\n
\n \n \n \n
\n ./snaplets/heist/templates/index.tpl\n-

Snap Example App Login

\n-

\n-/login\n-Login\n-\n-

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

\n-./snaplets/heist/templates/_login.tpl\n-\n- \n-\n-./snaplets/heist/templates/login.tpl\n-

Register a new user

\n-/new_user\n-Add User\n-\n-./snaplets/heist/templates/_new_user.tpl\n
\n \n \n \n \n \n \n \n \n \n \n \n
Login:
Password:
\n ./snaplets/heist/templates/userform.tpl\n- padding: 0;\n- margin: 0;\n- background-color: #ffffff;\n- font-family: Verdana, Helvetica, sans-serif;\n- padding: 0;\n- margin: 0;\n- text-decoration: underline;\n-a :hover {\n- cursor: pointer;\n- text-decoration: underline;\n- border: none;\n-#content {\n- padding-left: 1em;\n- font-size: 60%;\n-./static/screen.css\n+\n+ \n+\n+./snaplets/heist/templates/new_user.tpl\n Name: projname\n Version: 0.1\n Synopsis: Project Synopsis Here\n Description: Project Description Here\n License: AllRightsReserved\n Author: Author\n Maintainer: maintainer@example.com\n@@ -835,14 +820,29 @@\n ghc-options: -threaded -w\n if impl(ghc >= 6.12.0)\n ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2\n -fno-warn-orphans -fno-warn-unused-do-bind\n else\n ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2\n -fno-warn-orphans\n+ padding: 0;\n+ margin: 0;\n+ background-color: #ffffff;\n+ font-family: Verdana, Helvetica, sans-serif;\n+ padding: 0;\n+ margin: 0;\n+ text-decoration: underline;\n+a :hover {\n+ cursor: pointer;\n+ text-decoration: underline;\n+ border: none;\n+#content {\n+ padding-left: 1em;\n+ font-size: 60%;\n+./static/screen.css\n ./snaplets/heist/templates\n ./snaplets/heist\n ./snaplets\n ./static\n {-# LANGUAGE OverloadedStrings #-}\n module Main where\n import Control.Applicative\n@@ -861,18 +861,14 @@\n echoHandler = do\n param <- getParam \"echoparam\"\n maybe (writeBS \"must specify echo/param in URL\")\n writeBS param\n ./src/Main.hs\n placeholder\n ./log/placeholder\n-:set -isrc\n-:set -hide-package MonadCatchIO-mtl\n-:set -hide-package monads-fd\n-:set -XOverloadedStrings\n Name: projname\n Version: 0.1\n Synopsis: Project Synopsis Here\n Description: Project Description Here\n License: AllRightsReserved\n Author: Author\n Maintainer: maintainer@example.com\n@@ -890,14 +886,18 @@\n snap-core >= 1.0 && < 1.1,\n snap-server >= 1.0 && < 1.2\n if impl(ghc >= 6.12.0)\n ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2\n -fno-warn-unused-do-bind\n ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2\n ./foo.cabal\n+:set -isrc\n+:set -hide-package MonadCatchIO-mtl\n+:set -hide-package monads-fd\n+:set -XOverloadedStrings\n main:Main.Help\n libraries/base/Data/Data.hs\n Data.Data\n fromJust\n Data.Text.Text\n Internal error\n Negative index\n"}, {"source1": "readelf --wide --decompress --hex-dump=.rodata {}", "source2": "readelf --wide --decompress --hex-dump=.rodata {}", "unified_diff": "@@ -41,1115 +41,1115 @@\n 0x00bcb690 72756374 75726520 696e2074 68652063 ructure in the c\n 0x00bcb6a0 75727265 6e742064 69726563 746f7279 urrent directory\n 0x00bcb6b0 00202020 203c6163 74696f6e 3e206361 . ca\n 0x00bcb6c0 6e206265 206f6e65 206f663a 00202073 n be one of:. s\n 0x00bcb6d0 6e617020 3c616374 696f6e3e 00557361 nap .Usa\n 0x00bcb6e0 67653a00 536e6170 20312e30 2e302e30 ge:.Snap 1.0.0.0\n 0x00bcb6f0 2050726f 6a656374 204b6963 6b737461 Project Kicksta\n- 0x00bcb700 72746572 00576861 74204172 6520536e rter.What Are Sn\n- 0x00bcb710 61706c65 74733f0a 3d3d3d3d 3d3d3d3d aplets?.========\n- 0x00bcb720 3d3d3d3d 3d3d3d3d 3d3d0a0a 4120736e ==========..A sn\n- 0x00bcb730 61706c65 74206973 20612063 6f6d706f aplet is a compo\n- 0x00bcb740 7361626c 65207765 62206170 706c6963 sable web applic\n- 0x00bcb750 6174696f 6e2e2020 536e6170 6c657473 ation. Snaplets\n- 0x00bcb760 20616c6c 6f772079 6f752074 6f206275 allow you to bu\n- 0x00bcb770 696c640a 73656c66 2d636f6e 7461696e ild.self-contain\n- 0x00bcb780 65642070 69656365 73206f66 2066756e ed pieces of fun\n- 0x00bcb790 6374696f 6e616c69 74792061 6e642067 ctionality and g\n- 0x00bcb7a0 6c756520 7468656d 20746f67 65746865 lue them togethe\n- 0x00bcb7b0 7220746f 206d616b 65206c61 72676572 r to make larger\n- 0x00bcb7c0 0a617070 6c696361 74696f6e 732e2020 .applications. \n- 0x00bcb7d0 48657265 20617265 20736f6d 65206f66 Here are some of\n- 0x00bcb7e0 20746865 20746869 6e677320 70726f76 the things prov\n- 0x00bcb7f0 69646564 20627920 74686520 736e6170 ided by the snap\n- 0x00bcb800 6c657420 4150493a 0a0a2020 2d20496e let API:.. - In\n- 0x00bcb810 66726173 74727563 74757265 20666f72 frastructure for\n- 0x00bcb820 20617070 6c696361 74696f6e 20737461 application sta\n- 0x00bcb830 74652f65 6e766972 6f6e6d65 6e740a0a te/environment..\n- 0x00bcb840 20202d20 536e6170 6c657420 696e6974 - Snaplet init\n- 0x00bcb850 69616c69 7a617469 6f6e2c20 72656c6f ialization, relo\n- 0x00bcb860 61642c20 616e6420 636c6561 6e75700a ad, and cleanup.\n- 0x00bcb870 0a20202d 204d616e 6167656d 656e7420 . - Management \n- 0x00bcb880 6f662066 696c6573 79737465 6d206461 of filesystem da\n- 0x00bcb890 74612061 6e642061 75746f6d 61746963 ta and automatic\n- 0x00bcb8a0 20736e61 706c6574 20696e73 74616c6c snaplet install\n- 0x00bcb8b0 6174696f 6e0a0a20 202d2055 6e696669 ation.. - Unifi\n- 0x00bcb8c0 65642063 6f6e6669 67206669 6c652069 ed config file i\n- 0x00bcb8d0 6e667261 73747275 63747572 650a0a4f nfrastructure..O\n- 0x00bcb8e0 6e652065 78616d70 6c65206d 69676874 ne example might\n- 0x00bcb8f0 20626520 61207769 6b692073 6e61706c be a wiki snapl\n- 0x00bcb900 65742e20 20497420 776f756c 64206265 et. It would be\n- 0x00bcb910 20646973 74726962 75746564 20617320 distributed as \n- 0x00bcb920 61206861 736b656c 6c0a7061 636b6167 a haskell.packag\n- 0x00bcb930 65207468 61742077 6f756c64 20626520 e that would be \n- 0x00bcb940 696e7374 616c6c65 64207769 74682063 installed with c\n- 0x00bcb950 6162616c 20616e64 20776f75 6c642070 abal and would p\n- 0x00bcb960 726f6261 626c7920 696e636c 75646520 robably include \n- 0x00bcb970 636f6465 2c0a636f 6e666967 2066696c code,.config fil\n- 0x00bcb980 65732c20 48544d4c 2074656d 706c6174 es, HTML templat\n- 0x00bcb990 65732c20 7374796c 65736865 6574732c es, stylesheets,\n- 0x00bcb9a0 204a6176 61536372 6970742c 20696d61 JavaScript, ima\n- 0x00bcb9b0 6765732c 20657463 2e202054 68650a73 ges, etc. The.s\n- 0x00bcb9c0 6e61706c 65742773 20636f64 6520776f naplet's code wo\n- 0x00bcb9d0 756c6420 70726f76 69646520 74686520 uld provide the \n- 0x00bcb9e0 6e656365 73736172 79204150 4920746f necessary API to\n- 0x00bcb9f0 206c6574 20796f75 72206170 706c6963 let your applic\n- 0x00bcba00 6174696f 6e0a696e 74657261 63742073 ation.interact s\n- 0x00bcba10 65616d6c 6573736c 79207769 74682074 eamlessly with t\n- 0x00bcba20 68652077 696b6920 66756e63 74696f6e he wiki function\n- 0x00bcba30 616c6974 792e2020 5768656e 20796f75 ality. When you\n- 0x00bcba40 2072756e 20796f75 720a6170 706c6963 run your.applic\n- 0x00bcba50 6174696f 6e20666f 72207468 65206669 ation for the fi\n- 0x00bcba60 72737420 74696d65 2c20616c 6c206f66 rst time, all of\n- 0x00bcba70 20746865 2077696b 6920736e 61706c65 the wiki snaple\n- 0x00bcba80 74277320 66696c65 73797374 656d2072 t's filesystem r\n- 0x00bcba90 65736f75 72636573 0a77696c 6c206175 esources.will au\n- 0x00bcbaa0 746f6d61 74696361 6c6c7920 62652063 tomatically be c\n- 0x00bcbab0 6f706965 6420696e 746f2074 68652061 opied into the a\n- 0x00bcbac0 7070726f 70726961 74652070 6c616365 ppropriate place\n- 0x00bcbad0 732e2020 5468656e 20796f75 2077696c s. Then you wil\n- 0x00bcbae0 6c0a696d 6d656469 6174656c 79206265 l.immediately be\n- 0x00bcbaf0 2061626c 6520746f 20637573 746f6d69 able to customi\n- 0x00bcbb00 7a652074 68652077 696b6920 746f2066 ze the wiki to f\n- 0x00bcbb10 69742079 6f757220 6e656564 73206279 it your needs by\n- 0x00bcbb20 20656469 74696e67 20636f6e 6669670a editing config.\n- 0x00bcbb30 66696c65 732c2070 726f7669 64696e67 files, providing\n- 0x00bcbb40 20796f75 72206f77 6e207374 796c6573 your own styles\n- 0x00bcbb50 68656574 732c2065 74632e20 20576520 heets, etc. We \n- 0x00bcbb60 77696c6c 20646973 63757373 20746869 will discuss thi\n- 0x00bcbb70 7320696e 206d6f72 650a6465 7461696c s in more.detail\n- 0x00bcbb80 206c6174 65722e0a 0a412073 6e61706c later...A snapl\n- 0x00bcbb90 65742063 616e2072 65707265 73656e74 et can represent\n- 0x00bcbba0 20616e79 7468696e 67206672 6f6d2062 anything from b\n- 0x00bcbbb0 61636b65 6e642048 61736b65 6c6c2069 ackend Haskell i\n- 0x00bcbbc0 6e667261 73747275 63747572 65207769 nfrastructure wi\n- 0x00bcbbd0 7468206e 6f0a7573 65722066 6163696e th no.user facin\n- 0x00bcbbe0 67206675 6e637469 6f6e616c 69747920 g functionality \n- 0x00bcbbf0 746f2061 20736d61 6c6c2077 69646765 to a small widge\n- 0x00bcbc00 74206c69 6b652061 20636861 7420626f t like a chat bo\n- 0x00bcbc10 78207468 61742067 6f657320 696e2074 x that goes in t\n- 0x00bcbc20 68650a63 6f726e65 72206f66 20612077 he.corner of a w\n- 0x00bcbc30 65622070 61676520 746f2061 6e20656e eb page to an en\n- 0x00bcbc40 74697265 20737461 6e64616c 6f6e6520 tire standalone \n- 0x00bcbc50 77656273 69746520 6c696b65 20612062 website like a b\n- 0x00bcbc60 6c6f6720 6f722066 6f72756d 2e0a5468 log or forum..Th\n- 0x00bcbc70 6520706f 73736962 696c6974 69657320 e possibilities \n- 0x00bcbc80 61726520 656e646c 6573732e 20204120 are endless. A \n- 0x00bcbc90 736e6170 6c657420 69732061 20776562 snaplet is a web\n- 0x00bcbca0 20617070 6c696361 74696f6e 2c20616e application, an\n- 0x00bcbcb0 64207765 620a6170 706c6963 6174696f d web.applicatio\n- 0x00bcbcc0 6e732061 72652073 6e61706c 6574732e ns are snaplets.\n- 0x00bcbcd0 20205468 6973206d 65616e73 20746861 This means tha\n- 0x00bcbce0 74207573 696e6720 736e6170 6c657473 t using snaplets\n- 0x00bcbcf0 20616e64 20777269 74696e67 0a736e61 and writing.sna\n- 0x00bcbd00 706c6574 73206172 6520616c 6d6f7374 plets are almost\n- 0x00bcbd10 20746865 2073616d 65207468 696e672c the same thing,\n- 0x00bcbd20 20616e64 20697427 73207472 69766961 and it's trivia\n- 0x00bcbd30 6c20746f 2064726f 70206120 77686f6c l to drop a whol\n- 0x00bcbd40 65207765 62736974 650a696e 746f2061 e website.into a\n- 0x00bcbd50 6e6f7468 6572206f 6e652e0a 0a576527 nother one...We'\n- 0x00bcbd60 72652072 65616c6c 79206578 63697465 re really excite\n- 0x00bcbd70 64206162 6f757420 74686520 706f7373 d about the poss\n- 0x00bcbd80 6962696c 69746965 73206176 61696c61 ibilities availa\n- 0x00bcbd90 626c6520 77697468 20736e61 706c6574 ble with snaplet\n- 0x00bcbda0 732e2020 496e0a66 6163742c 20536e61 s. In.fact, Sna\n- 0x00bcbdb0 7020616c 72656164 79207368 69707320 p already ships \n- 0x00bcbdc0 77697468 20736e61 706c6574 7320666f with snaplets fo\n- 0x00bcbdd0 72207365 7373696f 6e732c20 61757468 r sessions, auth\n- 0x00bcbde0 656e7469 63617469 6f6e2c20 616e640a entication, and.\n- 0x00bcbdf0 74656d70 6c617469 6e672028 77697468 templating (with\n- 0x00bcbe00 20486569 7374292c 20205468 69732067 Heist), This g\n- 0x00bcbe10 69766573 20796f75 20757365 66756c20 ives you useful \n- 0x00bcbe20 66756e63 74696f6e 616c6974 79206f75 functionality ou\n- 0x00bcbe30 74206f66 20746865 20626f78 2c0a616e t of the box,.an\n- 0x00bcbe40 64206a75 6d702073 74617274 7320796f d jump starts yo\n- 0x00bcbe50 7572206f 776e2073 6e61706c 65742064 ur own snaplet d\n- 0x00bcbe60 6576656c 6f706d65 6e742062 79206465 evelopment by de\n- 0x00bcbe70 6d6f6e73 74726174 696e6720 736f6d65 monstrating some\n- 0x00bcbe80 20757365 66756c0a 64657369 676e2070 useful.design p\n- 0x00bcbe90 61747465 726e732e 2020536f 20776974 atterns. So wit\n- 0x00bcbea0 686f7574 20667572 74686572 2061646f hout further ado\n- 0x00bcbeb0 2c206c65 74277320 67657420 73746172 , let's get star\n- 0x00bcbec0 7465642e 0a0a536e 61706c65 74204f76 ted...Snaplet Ov\n- 0x00bcbed0 65727669 65770a3d 3d3d3d3d 3d3d3d3d erview.=========\n- 0x00bcbee0 3d3d3d3d 3d3d3d0a 0a546865 20686561 =======..The hea\n- 0x00bcbef0 7274206f 66207468 6520736e 61706c65 rt of the snaple\n- 0x00bcbf00 74732069 6e667261 73747275 63747572 ts infrastructur\n- 0x00bcbf10 65206973 20737461 7465206d 616e6167 e is state manag\n- 0x00bcbf20 656d656e 742e2020 4d6f7374 206e6f6e ement. Most non\n- 0x00bcbf30 74726976 69616c0a 70696563 6573206f trivial.pieces o\n- 0x00bcbf40 66206120 77656220 61707020 6e656564 f a web app need\n- 0x00bcbf50 20736f6d 65206b69 6e64206f 66207374 some kind of st\n- 0x00bcbf60 61746520 6f722065 6e766972 6f6e6d65 ate or environme\n- 0x00bcbf70 6e742064 6174612e 2020436f 6d706f6e nt data. Compon\n- 0x00bcbf80 656e7473 0a746861 7420646f 206e6f74 ents.that do not\n- 0x00bcbf90 206e6565 6420616e 79206b69 6e64206f need any kind o\n- 0x00bcbfa0 66207374 61746520 6f722065 6e766972 f state or envir\n- 0x00bcbfb0 6f6e6d65 6e742061 72652070 726f6261 onment are proba\n- 0x00bcbfc0 626c7920 6d6f7265 0a617070 726f7072 bly more.appropr\n- 0x00bcbfd0 69617465 20617320 61207374 616e6461 iate as a standa\n- 0x00bcbfe0 6c6f6e65 206c6962 72617279 20746861 lone library tha\n- 0x00bcbff0 6e206173 20612073 6e61706c 65742e0a n as a snaplet..\n- 0x00bcc000 0a426566 6f726520 77652063 6f6e7469 .Before we conti\n- 0x00bcc010 6e75652c 20776520 6d757374 20636c61 nue, we must cla\n- 0x00bcc020 72696679 20616e20 696d706f 7274616e rify an importan\n- 0x00bcc030 7420706f 696e742e 20205468 6520536e t point. The Sn\n- 0x00bcc040 61702077 65622073 65727665 720a7072 ap web server.pr\n- 0x00bcc050 6f636573 73657320 65616368 20726571 ocesses each req\n- 0x00bcc060 75657374 20696e20 69747320 6f776e20 uest in its own \n- 0x00bcc070 67726565 6e207468 72656164 2e202054 green thread. T\n- 0x00bcc080 68697320 6d65616e 73207468 61742065 his means that e\n- 0x00bcc090 61636820 72657175 6573740a 77696c6c ach request.will\n- 0x00bcc0a0 20726563 65697665 20612073 65706172 receive a separ\n- 0x00bcc0b0 61746520 636f7079 206f6620 74686520 ate copy of the \n- 0x00bcc0c0 73746174 65206465 66696e65 64206279 state defined by\n- 0x00bcc0d0 20796f75 72206170 706c6963 6174696f your applicatio\n- 0x00bcc0e0 6e20616e 640a736e 61706c65 74732c20 n and.snaplets, \n- 0x00bcc0f0 616e6420 6d6f6469 66696361 74696f6e and modification\n- 0x00bcc100 7320746f 20746861 74207374 61746520 s to that state \n- 0x00bcc110 6f6e6c79 20616666 65637420 74686520 only affect the \n- 0x00bcc120 6c6f6361 6c207468 72656164 20746861 local thread tha\n- 0x00bcc130 740a6765 6e657261 74657320 61207369 t.generates a si\n- 0x00bcc140 6e676c65 20726573 706f6e73 652e2020 ngle response. \n- 0x00bcc150 46726f6d 206e6f77 206f6e2c 20776865 From now on, whe\n- 0x00bcc160 6e207765 2074616c 6b206162 6f757420 n we talk about \n- 0x00bcc170 73746174 65207468 69732069 730a7768 state this is.wh\n- 0x00bcc180 61742077 65206172 65207461 6c6b696e at we are talkin\n- 0x00bcc190 67206162 6f75742e 20204966 20796f75 g about. If you\n- 0x00bcc1a0 206e6565 6420676c 6f62616c 20617070 need global app\n- 0x00bcc1b0 6c696361 74696f6e 20737461 74652c20 lication state, \n- 0x00bcc1c0 796f7520 68617665 20746f0a 75736520 you have to.use \n- 0x00bcc1d0 61207468 72656164 2d736166 6520636f a thread-safe co\n- 0x00bcc1e0 6e737472 75637420 73756368 20617320 nstruct such as \n- 0x00bcc1f0 616e204d 56617220 6f722049 4f526566 an MVar or IORef\n- 0x00bcc200 2e0a0a54 68697320 706f7374 20697320 ...This post is \n- 0x00bcc210 77726974 74656e20 696e206c 69746572 written in liter\n- 0x00bcc220 61746520 4861736b 656c6c2e 20204974 ate Haskell. It\n- 0x00bcc230 20757365 73206120 736d616c 6c206578 uses a small ex\n- 0x00bcc240 7465726e 616c206d 6f64756c 650a6361 ternal module.ca\n- 0x00bcc250 6c6c6564 20506172 74322074 68617420 lled Part2 that \n- 0x00bcc260 6973205b 61766169 6c61626c 650a6865 is [available.he\n- 0x00bcc270 72655d28 68747470 733a2f2f 67697468 re](https://gith\n- 0x00bcc280 75622e63 6f6d2f73 6e617066 72616d65 ub.com/snapframe\n- 0x00bcc290 776f726b 2f736e61 702d7465 6d706c61 work/snap-templa\n- 0x00bcc2a0 7465732f 626c6f62 2f6d6173 7465722f tes/blob/master/\n- 0x00bcc2b0 70726f6a 6563745f 74656d70 6c617465 project_template\n- 0x00bcc2c0 2f747574 6f726961 6c2f7372 632f5061 /tutorial/src/Pa\n- 0x00bcc2d0 7274322e 6c687329 2e0a596f 75206361 rt2.lhs)..You ca\n- 0x00bcc2e0 6e20616c 736f2069 6e737461 6c6c2074 n also install t\n- 0x00bcc2f0 68652066 756c6c20 636f6465 20696e20 he full code in \n- 0x00bcc300 74686520 63757272 656e7420 64697265 the current dire\n- 0x00bcc310 63746f72 79207769 74682074 68652063 ctory with the c\n- 0x00bcc320 6f6d6d61 6e640a60 736e6170 20696e69 ommand.`snap ini\n- 0x00bcc330 74207475 746f7269 616c602e 20204669 t tutorial`. Fi\n- 0x00bcc340 72737420 7765206e 65656420 746f2067 rst we need to g\n- 0x00bcc350 65742069 6d706f72 7473206f 7574206f et imports out o\n- 0x00bcc360 66207468 65207761 792e0a0a 3e207b2d f the way...> {-\n- 0x00bcc370 23204c41 4e475541 47452054 656d706c # LANGUAGE Templ\n- 0x00bcc380 61746548 61736b65 6c6c2023 2d7d0a3e ateHaskell #-}.>\n- 0x00bcc390 207b2d23 204c414e 47554147 45204f76 {-# LANGUAGE Ov\n- 0x00bcc3a0 65726c6f 61646564 53747269 6e677320 erloadedStrings \n- 0x00bcc3b0 232d7d0a 3e0a3e20 6d6f6475 6c65204d #-}.>.> module M\n- 0x00bcc3c0 61696e20 77686572 650a3e0a 3e20696d ain where.>.> im\n- 0x00bcc3d0 706f7274 20202020 20202020 20202043 port C\n- 0x00bcc3e0 6f6e7472 6f6c2e41 70706c69 63617469 ontrol.Applicati\n- 0x00bcc3f0 76652028 283c7c3e 29290a3e 20696d70 ve ((<|>)).> imp\n- 0x00bcc400 6f727420 20202020 20202020 2020436f ort Co\n- 0x00bcc410 6e74726f 6c2e4c65 6e732e54 480a3e20 ntrol.Lens.TH.> \n- 0x00bcc420 696d706f 72742020 20202020 20202020 import \n- 0x00bcc430 20436f6e 74726f6c 2e4d6f6e 61642e49 Control.Monad.I\n- 0x00bcc440 4f2e436c 61737320 286c6966 74494f29 O.Class (liftIO)\n- 0x00bcc450 0a3e2069 6d706f72 74202020 20202020 .> import \n- 0x00bcc460 20202020 436f6e74 726f6c2e 4d6f6e61 Control.Mona\n- 0x00bcc470 642e5374 6174652e 436c6173 73202867 d.State.Class (g\n- 0x00bcc480 65747329 0a3e2069 6d706f72 74202020 ets).> import \n- 0x00bcc490 20202020 20202020 44617461 2e494f52 Data.IOR\n- 0x00bcc4a0 65660a3e 20696d70 6f727420 7175616c ef.> import qual\n- 0x00bcc4b0 69666965 64204461 74612e42 79746553 ified Data.ByteS\n- 0x00bcc4c0 7472696e 672e4368 61723820 61732042 tring.Char8 as B\n- 0x00bcc4d0 0a3e2069 6d706f72 74202020 20202020 .> import \n- 0x00bcc4e0 20202020 44617461 2e4d6179 62650a3e Data.Maybe.>\n- 0x00bcc4f0 20696d70 6f727420 20202020 20202020 import \n- 0x00bcc500 2020536e 61700a3e 20696d70 6f727420 Snap.> import \n- 0x00bcc510 20202020 20202020 2020536e 61702e53 Snap.S\n- 0x00bcc520 6e61706c 65742e48 65697374 0a3e2069 naplet.Heist.> i\n- 0x00bcc530 6d706f72 74202020 20202020 20202020 mport \n- 0x00bcc540 50617274 320a0a57 65207374 61727420 Part2..We start \n- 0x00bcc550 6f757220 6170706c 69636174 696f6e20 our application \n- 0x00bcc560 62792064 6566696e 696e6720 61206461 by defining a da\n- 0x00bcc570 74612073 74727563 74757265 20746f20 ta structure to \n- 0x00bcc580 686f6c64 20746865 20737461 74652e20 hold the state. \n- 0x00bcc590 20546869 730a6461 74612073 74727563 This.data struc\n- 0x00bcc5a0 74757265 20696e63 6c756465 73207468 ture includes th\n- 0x00bcc5b0 65207374 61746520 6f662061 6c6c2073 e state of all s\n- 0x00bcc5c0 6e61706c 65747320 28777261 70706564 naplets (wrapped\n- 0x00bcc5d0 20696e20 6120536e 61706c65 74292075 in a Snaplet) u\n- 0x00bcc5e0 7365640a 6279206f 75722061 70706c69 sed.by our appli\n- 0x00bcc5f0 63617469 6f6e2061 73207765 6c6c2061 cation as well a\n- 0x00bcc600 7320616e 79206f74 68657220 73746174 s any other stat\n- 0x00bcc610 65207765 206d6967 68742077 616e742e e we might want.\n- 0x00bcc620 0a0a3e20 64617461 20417070 203d2041 ..> data App = A\n- 0x00bcc630 70700a3e 20202020 207b205f 68656973 pp.> { _heis\n- 0x00bcc640 74202020 20202020 3a3a2053 6e61706c t :: Snapl\n- 0x00bcc650 65742028 48656973 74204170 70290a3e et (Heist App).>\n- 0x00bcc660 20202020 202c205f 666f6f20 20202020 , _foo \n- 0x00bcc670 20202020 3a3a2053 6e61706c 65742046 :: Snaplet F\n- 0x00bcc680 6f6f0a3e 20202020 202c205f 62617220 oo.> , _bar \n- 0x00bcc690 20202020 20202020 3a3a2053 6e61706c :: Snapl\n- 0x00bcc6a0 65742042 61720a3e 20202020 202c205f et Bar.> , _\n- 0x00bcc6b0 636f6d70 616e794e 616d6520 3a3a2049 companyName :: I\n- 0x00bcc6c0 4f526566 20422e42 79746553 7472696e ORef B.ByteStrin\n- 0x00bcc6d0 670a3e20 20202020 7d0a3e0a 3e206d61 g.> }.>.> ma\n- 0x00bcc6e0 6b654c65 6e736573 20272741 70700a0a keLenses ''App..\n- 0x00bcc6f0 54686520 6669656c 64206e61 6d657320 The field names \n- 0x00bcc700 62656769 6e207769 74682061 6e20756e begin with an un\n- 0x00bcc710 64657273 636f7265 20626563 61757365 derscore because\n- 0x00bcc720 206f6620 736f6d65 206d6f72 6520636f of some more co\n- 0x00bcc730 6d706c69 63617465 640a7468 696e6773 mplicated.things\n- 0x00bcc740 20676f69 6e67206f 6e20756e 64657220 going on under \n- 0x00bcc750 74686520 686f6f64 2e202048 6f776576 the hood. Howev\n- 0x00bcc760 65722c20 616c6c20 796f7520 6e656564 er, all you need\n- 0x00bcc770 20746f20 6b6e6f77 20726967 6874206e to know right n\n- 0x00bcc780 6f772069 730a7468 61742079 6f752073 ow is.that you s\n- 0x00bcc790 686f756c 64207072 65666978 20746869 hould prefix thi\n- 0x00bcc7a0 6e677320 77697468 20616e20 756e6465 ngs with an unde\n- 0x00bcc7b0 7273636f 72652061 6e642074 68656e20 rscore and then \n- 0x00bcc7c0 63616c6c 20606d61 6b654c65 6e736573 call `makeLenses\n- 0x00bcc7d0 602e0a54 68697320 6c657473 20796f75 `..This lets you\n- 0x00bcc7e0 20757365 20746865 206e616d 65732077 use the names w\n- 0x00bcc7f0 6974686f 75742061 6e20756e 64657273 ithout an unders\n- 0x00bcc800 636f7265 20696e20 74686520 72657374 core in the rest\n- 0x00bcc810 206f6620 796f7572 0a617070 6c696361 of your.applica\n- 0x00bcc820 74696f6e 2e0a0a54 6865206e 65787420 tion...The next \n- 0x00bcc830 7468696e 67207765 206e6565 6420746f thing we need to\n- 0x00bcc840 20646f20 69732064 6566696e 6520616e do is define an\n- 0x00bcc850 20696e69 7469616c 697a6572 2e0a0a3e initializer...>\n- 0x00bcc860 20617070 496e6974 203a3a20 536e6170 appInit :: Snap\n- 0x00bcc870 6c657449 6e697420 41707020 4170700a letInit App App.\n- 0x00bcc880 3e206170 70496e69 74203d20 6d616b65 > appInit = make\n- 0x00bcc890 536e6170 6c657420 226d7961 70702220 Snaplet \"myapp\" \n- 0x00bcc8a0 224d7920 6578616d 706c6520 6170706c \"My example appl\n- 0x00bcc8b0 69636174 696f6e22 204e6f74 68696e67 ication\" Nothing\n- 0x00bcc8c0 20242064 6f0a3e20 20202020 6873203c $ do.> hs <\n- 0x00bcc8d0 2d206e65 7374536e 61706c65 74202268 - nestSnaplet \"h\n- 0x00bcc8e0 65697374 22206865 69737420 24206865 eist\" heist $ he\n- 0x00bcc8f0 69737449 6e697420 2274656d 706c6174 istInit \"templat\n- 0x00bcc900 6573220a 3e202020 20206673 203c2d20 es\".> fs <- \n- 0x00bcc910 6e657374 536e6170 6c657420 22666f6f nestSnaplet \"foo\n- 0x00bcc920 2220666f 6f202420 666f6f49 6e69740a \" foo $ fooInit.\n- 0x00bcc930 3e202020 20206273 203c2d20 6e657374 > bs <- nest\n- 0x00bcc940 536e6170 6c657420 22222062 61722024 Snaplet \"\" bar $\n- 0x00bcc950 206e616d 65536e61 706c6574 20226e65 nameSnaplet \"ne\n- 0x00bcc960 776e616d 65222024 20626172 496e6974 wname\" $ barInit\n- 0x00bcc970 20666f6f 0a3e2020 20202061 6464526f foo.> addRo\n- 0x00bcc980 75746573 205b2028 2268656c 6c6f222c utes [ (\"hello\",\n- 0x00bcc990 20777269 74655465 78742022 68656c6c writeText \"hell\n- 0x00bcc9a0 6f20776f 726c6422 290a3e20 20202020 o world\").> \n- 0x00bcc9b0 20202020 20202020 20202c20 2822666f , (\"fo\n- 0x00bcc9c0 6f6e616d 65222c20 77697468 20666f6f oname\", with foo\n- 0x00bcc9d0 206e616d 65506167 65290a3e 20202020 namePage).> \n- 0x00bcc9e0 20202020 20202020 2020202c 20282262 , (\"b\n- 0x00bcc9f0 61726e61 6d65222c 20776974 68206261 arname\", with ba\n- 0x00bcca00 72206e61 6d655061 6765290a 3e202020 r namePage).> \n- 0x00bcca10 20202020 20202020 20202020 2c202822 , (\"\n- 0x00bcca20 636f6d70 616e7922 2c20636f 6d70616e company\", compan\n- 0x00bcca30 7948616e 646c6572 290a3e20 20202020 yHandler).> \n- 0x00bcca40 20202020 20202020 20205d0a 3e202020 ].> \n- 0x00bcca50 20207772 61705369 74652028 3c7c3e20 wrapSite (<|> \n- 0x00bcca60 68656973 74536572 7665290a 3e202020 heistServe).> \n- 0x00bcca70 20207265 66203c2d 206c6966 74494f20 ref <- liftIO \n- 0x00bcca80 24206e65 77494f52 65662022 666f6f43 $ newIORef \"fooC\n- 0x00bcca90 6f727022 0a3e2020 20202072 65747572 orp\".> retur\n- 0x00bccaa0 6e202420 41707020 68732066 73206273 n $ App hs fs bs\n- 0x00bccab0 20726566 0a0a466f 72206e6f 7720646f ref..For now do\n- 0x00bccac0 6e277420 776f7272 79206162 6f757420 n't worry about \n- 0x00bccad0 616c6c20 74686520 64657461 696c7320 all the details \n- 0x00bccae0 6f662074 68697320 636f6465 2e202057 of this code. W\n- 0x00bccaf0 65276c6c 20776f72 6b207468 726f7567 e'll work throug\n- 0x00bccb00 68207468 650a696e 64697669 6475616c h the.individual\n- 0x00bccb10 20706965 63657320 6f6e6520 61742061 pieces one at a\n- 0x00bccb20 2074696d 652e2020 54686520 62617369 time. The basi\n- 0x00bccb30 63206964 65612068 65726520 69732074 c idea here is t\n- 0x00bccb40 68617420 746f2069 6e697469 616c697a hat to initializ\n- 0x00bccb50 6520616e 0a617070 6c696361 74696f6e e an.application\n- 0x00bccb60 2c207765 20666972 73742069 6e697469 , we first initi\n- 0x00bccb70 616c697a 65206561 6368206f 66207468 alize each of th\n- 0x00bccb80 6520736e 61706c65 74732c20 61646420 e snaplets, add \n- 0x00bccb90 736f6d65 20726f75 7465732c 2072756e some routes, run\n- 0x00bccba0 20610a66 756e6374 696f6e20 77726170 a.function wrap\n- 0x00bccbb0 70696e67 20616c6c 20746865 20726f75 ping all the rou\n- 0x00bccbc0 7465732c 20616e64 20726574 75726e20 tes, and return \n- 0x00bccbd0 74686520 72657375 6c74696e 67207374 the resulting st\n- 0x00bccbe0 61746520 64617461 0a737472 75637475 ate data.structu\n- 0x00bccbf0 72652e20 20546869 73206578 616d706c re. This exampl\n- 0x00bccc00 65206465 6d6f6e73 74726174 65732074 e demonstrates t\n- 0x00bccc10 68652075 7365206f 66206120 66657720 he use of a few \n- 0x00bccc20 6f662074 6865206d 6f737420 636f6d6d of the most comm\n- 0x00bccc30 6f6e0a73 6e61706c 65742066 756e6374 on.snaplet funct\n- 0x00bccc40 696f6e73 2e0a0a6e 65737453 6e61706c ions...nestSnapl\n- 0x00bccc50 65740a2d 2d2d2d2d 2d2d2d2d 2d2d0a0a et.-----------..\n- 0x00bccc60 416c6c20 63616c6c 7320746f 20636869 All calls to chi\n- 0x00bccc70 6c642073 6e61706c 65742069 6e697469 ld snaplet initi\n- 0x00bccc80 616c697a 65722066 756e6374 696f6e73 alizer functions\n- 0x00bccc90 206d7573 74206265 20777261 70706564 must be wrapped\n- 0x00bccca0 20696e20 61206361 6c6c2074 6f0a6e65 in a call to.ne\n- 0x00bcccb0 7374536e 61706c65 742e2020 54686520 stSnaplet. The \n- 0x00bcccc0 66697273 74207061 72616d65 74657220 first parameter \n- 0x00bcccd0 69732061 2055524c 20706174 68207365 is a URL path se\n- 0x00bccce0 676d656e 74207468 61742069 73207573 gment that is us\n- 0x00bcccf0 65642074 6f207072 65666978 0a616c6c ed to prefix.all\n- 0x00bccd00 20726f75 74657320 64656669 6e656420 routes defined \n- 0x00bccd10 62792074 68652073 6e61706c 65742e20 by the snaplet. \n- 0x00bccd20 20546869 73206c65 74732079 6f752065 This lets you e\n- 0x00bccd30 6e737572 65207468 61742074 68657265 nsure that there\n- 0x00bccd40 2077696c 6c206265 206e6f0a 70726f62 will be no.prob\n- 0x00bccd50 6c656d73 20776974 68206475 706c6963 lems with duplic\n- 0x00bccd60 61746520 726f7574 65732064 6566696e ate routes defin\n- 0x00bccd70 65642069 6e206469 66666572 656e7420 ed in different \n- 0x00bccd80 736e6170 6c657473 2e202049 66207468 snaplets. If th\n- 0x00bccd90 6520666f 6f0a736e 61706c65 74206465 e foo.snaplet de\n- 0x00bccda0 66696e65 73206120 726f7574 6520602f fines a route `/\n- 0x00bccdb0 666f6f70 61676560 2c207468 656e2069 foopage`, then i\n- 0x00bccdc0 6e207468 65206162 6f766520 6578616d n the above exam\n- 0x00bccdd0 706c652c 20746861 74207061 67652077 ple, that page w\n- 0x00bccde0 696c6c0a 62652061 7661696c 61626c65 ill.be available\n- 0x00bccdf0 20617420 602f666f 6f2f666f 6f706167 at `/foo/foopag\n- 0x00bcce00 65602e20 20536f6d 6574696d 65732074 e`. Sometimes t\n- 0x00bcce10 686f7567 682c2079 6f75206d 69676874 hough, you might\n- 0x00bcce20 2077616e 74206120 736e6170 6c657427 want a snaplet'\n- 0x00bcce30 730a726f 75746573 20746f20 62652061 s.routes to be a\n- 0x00bcce40 7661696c 61626c65 20617420 74686520 vailable at the \n- 0x00bcce50 746f7020 6c657665 6c2e2020 546f2064 top level. To d\n- 0x00bcce60 6f207468 61742c20 6a757374 20706173 o that, just pas\n- 0x00bcce70 7320616e 20656d70 74792073 7472696e s an empty strin\n- 0x00bcce80 670a746f 206e6573 74536e61 706c6574 g.to nestSnaplet\n- 0x00bcce90 20617320 73686f77 6e206162 6f766520 as shown above \n- 0x00bccea0 77697468 20746865 20626172 20736e61 with the bar sna\n- 0x00bcceb0 706c6574 2e0a0a49 6e206f75 72206578 plet...In our ex\n- 0x00bccec0 616d706c 65206162 6f76652c 20746865 ample above, the\n- 0x00bcced0 20626172 20736e61 706c6574 20646f65 bar snaplet doe\n- 0x00bccee0 7320736f 6d657468 696e6720 74686174 s something that\n- 0x00bccef0 206e6565 64732074 6f206b6e 6f772061 needs to know a\n- 0x00bccf00 626f7574 0a746865 20666f6f 20736e61 bout.the foo sna\n- 0x00bccf10 706c6574 2e20204d 61796265 20666f6f plet. Maybe foo\n- 0x00bccf20 20697320 61206461 74616261 73652073 is a database s\n- 0x00bccf30 6e61706c 65742061 6e642062 61722077 naplet and bar w\n- 0x00bccf40 616e7473 20746f20 73746f72 65206f72 ants to store or\n- 0x00bccf50 0a726561 6420736f 6d657468 696e672e .read something.\n- 0x00bccf60 2020496e 206f7264 65722074 6f206d61 In order to ma\n- 0x00bccf70 6b652074 68617420 68617070 656e2c20 ke that happen, \n- 0x00bccf80 6974206e 65656473 20746f20 68617665 it needs to have\n- 0x00bccf90 20612022 68616e64 6c652220 746f0a74 a \"handle\" to.t\n- 0x00bccfa0 68652073 6e61706c 65742e20 204f7572 he snaplet. Our\n- 0x00bccfb0 2068616e 646c6573 20617265 20776861 handles are wha\n- 0x00bccfc0 74657665 72206669 656c6420 6e616d65 tever field name\n- 0x00bccfd0 73207765 20757365 6420696e 20746865 s we used in the\n- 0x00bccfe0 20417070 20646174 610a7374 72756374 App data.struct\n- 0x00bccff0 75726520 6d696e75 73207468 6520696e ure minus the in\n- 0x00bcd000 69746961 6c20756e 64657273 636f7265 itial underscore\n- 0x00bcd010 20636861 72616374 65722e20 20546865 character. The\n- 0x00bcd020 79206172 65206175 746f6d61 74696361 y are automatica\n- 0x00bcd030 6c6c790a 67656e65 72617465 64206279 lly.generated by\n- 0x00bcd040 20746865 20606d61 6b654c65 6e736573 the `makeLenses\n- 0x00bcd050 60206675 6e637469 6f6e2e20 20466f72 ` function. For\n- 0x00bcd060 206e6f77 20697427 73207375 66666963 now it's suffic\n- 0x00bcd070 69656e74 20746f20 7468696e 6b206f66 ient to think of\n- 0x00bcd080 0a746865 6d206173 20612067 65747465 .them as a gette\n- 0x00bcd090 7220616e 64206120 73657474 65722063 r and a setter c\n- 0x00bcd0a0 6f6d6269 6e656420 28746f20 75736520 ombined (to use \n- 0x00bcd0b0 616e204f 4f206d65 74617068 6f72292e an OO metaphor).\n- 0x00bcd0c0 0a0a5468 65207365 636f6e64 20706172 ..The second par\n- 0x00bcd0d0 616d6574 65722074 6f206e65 7374536e ameter to nestSn\n- 0x00bcd0e0 61706c65 74206973 20746865 206c656e aplet is the len\n- 0x00bcd0f0 7320746f 20746865 20736e61 706c6574 s to the snaplet\n- 0x00bcd100 20796f75 27726520 6e657374 696e672e you're nesting.\n- 0x00bcd110 0a496e20 6f726465 7220746f 20706c61 .In order to pla\n- 0x00bcd120 63652061 20706965 63652069 6e746f20 ce a piece into \n- 0x00bcd130 74686520 70757a7a 6c652c20 796f7520 the puzzle, you \n- 0x00bcd140 6e656564 20746f20 6b6e6f77 20776865 need to know whe\n- 0x00bcd150 72652069 7420676f 65732e0a 0a6e616d re it goes...nam\n- 0x00bcd160 65536e61 706c6574 0a2d2d2d 2d2d2d2d eSnaplet.-------\n- 0x00bcd170 2d2d2d2d 0a0a5468 65206175 74686f72 ----..The author\n- 0x00bcd180 206f6620 6120736e 61706c65 74206465 of a snaplet de\n- 0x00bcd190 66696e65 73206120 64656661 756c7420 fines a default \n- 0x00bcd1a0 6e616d65 20666f72 20746865 20736e61 name for the sna\n- 0x00bcd1b0 706c6574 20696e20 74686520 66697273 plet in the firs\n- 0x00bcd1c0 740a6172 67756d65 6e742074 6f207468 t.argument to th\n- 0x00bcd1d0 65206d61 6b65536e 61706c65 74206675 e makeSnaplet fu\n- 0x00bcd1e0 6e637469 6f6e2e20 20546869 73206e61 nction. This na\n- 0x00bcd1f0 6d652069 73207573 65642066 6f722074 me is used for t\n- 0x00bcd200 68652073 6e61706c 65742773 0a646972 he snaplet's.dir\n- 0x00bcd210 6563746f 72792069 6e207468 65206669 ectory in the fi\n- 0x00bcd220 6c657379 7374656d 2e202049 6620796f lesystem. If yo\n- 0x00bcd230 7520646f 6e277420 77616e74 20746f20 u don't want to \n- 0x00bcd240 75736520 74686520 64656661 756c7420 use the default \n- 0x00bcd250 6e616d65 2c20796f 750a6361 6e206f76 name, you.can ov\n- 0x00bcd260 65727269 64652069 74207769 74682074 erride it with t\n- 0x00bcd270 68652060 6e616d65 536e6170 6c657460 he `nameSnaplet`\n- 0x00bcd280 2066756e 6374696f 6e2e2020 416c736f function. Also\n- 0x00bcd290 2c206966 20796f75 2077616e 7420746f , if you want to\n- 0x00bcd2a0 20686176 65207477 6f0a696e 7374616e have two.instan\n- 0x00bcd2b0 63657320 6f662074 68652073 616d6520 ces of the same \n- 0x00bcd2c0 736e6170 6c65742c 20746865 6e20796f snaplet, then yo\n- 0x00bcd2d0 75207769 6c6c206e 65656420 746f2075 u will need to u\n- 0x00bcd2e0 73652060 6e616d65 536e6170 6c657460 se `nameSnaplet`\n- 0x00bcd2f0 20746f20 67697665 0a617420 6c656173 to give.at leas\n- 0x00bcd300 74206f6e 65206f66 20746865 6d206120 t one of them a \n- 0x00bcd310 756e6971 7565206e 616d652e 0a0a6164 unique name...ad\n- 0x00bcd320 64526f75 7465730a 2d2d2d2d 2d2d2d2d dRoutes.--------\n- 0x00bcd330 2d0a0a54 68652060 61646452 6f757465 -..The `addRoute\n- 0x00bcd340 73602066 756e6374 696f6e20 69732068 s` function is h\n- 0x00bcd350 6f772061 6e206170 706c6963 6174696f ow an applicatio\n- 0x00bcd360 6e20286f 7220736e 61706c65 74292064 n (or snaplet) d\n- 0x00bcd370 6566696e 65732069 74730a72 6f757465 efines its.route\n- 0x00bcd380 732e2020 556e6465 72207468 6520686f s. Under the ho\n- 0x00bcd390 6f642074 68652073 6e61706c 65742069 od the snaplet i\n- 0x00bcd3a0 6e667261 73747275 63747572 65206d65 nfrastructure me\n- 0x00bcd3b0 72676573 20616c6c 20746865 20726f75 rges all the rou\n- 0x00bcd3c0 74657320 66726f6d 0a616c6c 20736e61 tes from.all sna\n- 0x00bcd3d0 706c6574 732c2070 72657065 6e647320 plets, prepends \n- 0x00bcd3e0 70726566 69786573 2066726f 6d20606e prefixes from `n\n- 0x00bcd3f0 65737453 6e61706c 65746020 63616c6c estSnaplet` call\n- 0x00bcd400 732c2061 6e642070 61737365 73207468 s, and passes th\n- 0x00bcd410 65206c69 73740a74 6f20536e 61702773 e list.to Snap's\n- 0x00bcd420 0a5b726f 7574655d 28687474 703a2f2f .[route](http://\n- 0x00bcd430 6861636b 6167652e 6861736b 656c6c2e hackage.haskell.\n- 0x00bcd440 6f72672f 7061636b 61676573 2f617263 org/packages/arc\n- 0x00bcd450 68697665 2f736e61 702d636f 72652f30 hive/snap-core/0\n- 0x00bcd460 2e352e31 2e342f64 6f632f68 746d6c2f .5.1.4/doc/html/\n- 0x00bcd470 536e6170 2d547970 65732e68 746d6c23 Snap-Types.html#\n- 0x00bcd480 763a726f 75746529 0a66756e 6374696f v:route).functio\n- 0x00bcd490 6e2e0a0a 4120726f 75746520 69732061 n...A route is a\n- 0x00bcd4a0 20747570 6c65206f 66206120 55524c20 tuple of a URL \n- 0x00bcd4b0 616e6420 61206861 6e646c65 72206675 and a handler fu\n- 0x00bcd4c0 6e637469 6f6e2074 68617420 77696c6c nction that will\n- 0x00bcd4d0 20626520 63616c6c 65642077 68656e0a be called when.\n- 0x00bcd4e0 74686520 55524c20 69732072 65717565 the URL is reque\n- 0x00bcd4f0 73746564 2e202048 616e646c 65722069 sted. Handler i\n- 0x00bcd500 73206120 77726170 70657220 61726f75 s a wrapper arou\n- 0x00bcd510 6e642074 68652053 6e617020 6d6f6e61 nd the Snap mona\n- 0x00bcd520 64207468 61742068 616e646c 65730a74 d that handles.t\n- 0x00bcd530 68652073 6e61706c 65742773 20696e66 he snaplet's inf\n- 0x00bcd540 72617374 72756374 7572652e 20204475 rastructure. Du\n- 0x00bcd550 72696e67 20696e69 7469616c 697a6174 ring initializat\n- 0x00bcd560 696f6e2c 20736e61 706c6574 73207573 ion, snaplets us\n- 0x00bcd570 65207468 650a6049 6e697469 616c697a e the.`Initializ\n- 0x00bcd580 65726020 6d6f6e61 642e2020 44757269 er` monad. Duri\n- 0x00bcd590 6e672072 756e7469 6d652c20 74686579 ng runtime, they\n- 0x00bcd5a0 20757365 20746865 20604861 6e646c65 use the `Handle\n- 0x00bcd5b0 7260206d 6f6e6164 2e202057 65276c6c r` monad. We'll\n- 0x00bcd5c0 0a646973 63757373 20604861 6e646c65 .discuss `Handle\n- 0x00bcd5d0 72602069 6e206d6f 72652064 65746169 r` in more detai\n- 0x00bcd5e0 6c206c61 7465722e 20204966 20796f75 l later. If you\n- 0x00bcd5f0 27726520 66616d69 6c696172 20776974 're familiar wit\n- 0x00bcd600 6820536e 61702773 206f6c64 0a657874 h Snap's old.ext\n- 0x00bcd610 656e7369 6f6e2073 79737465 6d2c2079 ension system, y\n- 0x00bcd620 6f752063 616e2074 68696e6b 206f6620 ou can think of \n- 0x00bcd630 69742061 7320726f 7567686c 79206571 it as roughly eq\n- 0x00bcd640 75697661 6c656e74 20746f20 74686520 uivalent to the \n- 0x00bcd650 4170706c 69636174 696f6e0a 6d6f6e61 Application.mona\n- 0x00bcd660 642e2020 49742068 61732061 20604d6f d. It has a `Mo\n- 0x00bcd670 6e616453 74617465 6020696e 7374616e nadState` instan\n- 0x00bcd680 63652074 68617420 6c657473 20796f75 ce that lets you\n- 0x00bcd690 20616363 65737320 616e6420 6d6f6469 access and modi\n- 0x00bcd6a0 66792074 68650a63 75727265 6e742073 fy the.current s\n- 0x00bcd6b0 6e61706c 65742773 20737461 74652c20 naplet's state, \n- 0x00bcd6c0 616e6420 6120604d 6f6e6164 536e6170 and a `MonadSnap\n- 0x00bcd6d0 6020696e 7374616e 63652070 726f7669 ` instance provi\n- 0x00bcd6e0 64696e67 20746865 0a726571 75657374 ding the.request\n- 0x00bcd6f0 2d70726f 63657373 696e6720 66756e63 -processing func\n- 0x00bcd700 74696f6e 73206465 66696e65 6420696e tions defined in\n- 0x00bcd710 20536e61 702e5479 7065732e 0a0a7772 Snap.Types...wr\n- 0x00bcd720 61705369 74650a2d 2d2d2d2d 2d2d2d2d apSite.---------\n- 0x00bcd730 2d2d2d0a 0a607772 61705369 74656020 ---..`wrapSite` \n- 0x00bcd740 616c6c6f 77732079 6f752074 6f206170 allows you to ap\n- 0x00bcd750 706c7920 616e2061 72626974 72617279 ply an arbitrary\n- 0x00bcd760 20604861 6e646c65 72602074 72616e73 `Handler` trans\n- 0x00bcd770 666f726d 6174696f 6e20746f 0a746865 formation to.the\n- 0x00bcd780 20746f70 2d6c6576 656c2068 616e646c top-level handl\n- 0x00bcd790 65722e20 20546869 73206973 20757365 er. This is use\n- 0x00bcd7a0 66756c20 69662079 6f752077 616e7420 ful if you want \n- 0x00bcd7b0 746f2064 6f20736f 6d652067 656e6572 to do some gener\n- 0x00bcd7c0 69630a70 726f6365 7373696e 67206174 ic.processing at\n- 0x00bcd7d0 20746865 20626567 696e6e69 6e67206f the beginning o\n- 0x00bcd7e0 7220656e 64206f66 20657665 72792072 r end of every r\n- 0x00bcd7f0 65717565 73742e20 20466f72 20696e73 equest. For ins\n- 0x00bcd800 74616e63 652c2061 20736573 73696f6e tance, a session\n- 0x00bcd810 0a736e61 706c6574 206d6967 68742075 .snaplet might u\n- 0x00bcd820 73652069 7420746f 20746f75 63682061 se it to touch a\n- 0x00bcd830 20736573 73696f6e 20616374 69766974 session activit\n- 0x00bcd840 7920746f 6b656e20 6265666f 72652072 y token before r\n- 0x00bcd850 6f757469 6e672068 61707065 6e732e0a outing happens..\n- 0x00bcd860 49742063 6f756c64 20616c73 6f206265 It could also be\n- 0x00bcd870 20757365 6420746f 20696d70 6c656d65 used to impleme\n- 0x00bcd880 6e742063 7573746f 6d206c6f 6767696e nt custom loggin\n- 0x00bcd890 672e2020 54686520 6578616d 706c6520 g. The example \n- 0x00bcd8a0 61626f76 65207573 65732069 740a746f above uses it.to\n- 0x00bcd8b0 20646566 696e6520 68656973 74536572 define heistSer\n- 0x00bcd8c0 76652028 70726f76 69646564 20627920 ve (provided by \n- 0x00bcd8d0 74686520 48656973 7420736e 61706c65 the Heist snaple\n- 0x00bcd8e0 74292061 73207468 65206465 6661756c t) as the defaul\n- 0x00bcd8f0 74206861 6e646c65 7220746f 0a626520 t handler to.be \n- 0x00bcd900 74726965 64206966 206e6f20 6f746865 tried if no othe\n- 0x00bcd910 72206861 6e646c65 72206d61 74636865 r handler matche\n- 0x00bcd920 642e2020 54686973 206d6179 20736565 d. This may see\n- 0x00bcd930 6d206c69 6b652061 6e206561 73792077 m like an easy w\n- 0x00bcd940 61792074 6f206465 66696e65 0a726f75 ay to define.rou\n- 0x00bcd950 7465732c 20627574 20696620 796f7520 tes, but if you \n- 0x00bcd960 73747269 6e672074 68656d20 616c6c20 string them all \n- 0x00bcd970 746f6765 74686572 20696e20 74686973 together in this\n- 0x00bcd980 20776179 20656163 68206861 6e646c65 way each handle\n- 0x00bcd990 72207769 6c6c2062 650a6576 616c7561 r will be.evalua\n- 0x00bcd9a0 74656420 73657175 656e7469 616c6c79 ted sequentially\n- 0x00bcd9b0 20616e64 20796f75 276c6c20 67657420 and you'll get \n- 0x00bcd9c0 4f286e29 2074696d 6520636f 6d706c65 O(n) time comple\n- 0x00bcd9d0 78697479 2c207768 65726561 7320726f xity, whereas ro\n- 0x00bcd9e0 75746573 0a646566 696e6564 20776974 utes.defined wit\n- 0x00bcd9f0 68206061 6464526f 75746573 60206861 h `addRoutes` ha\n- 0x00bcda00 7665204f 286c6f67 206e2920 74696d65 ve O(log n) time\n- 0x00bcda10 20636f6d 706c6578 6974792e 20205468 complexity. Th\n- 0x00bcda20 65726566 6f72652c 20696e20 610a7265 erefore, in a.re\n- 0x00bcda30 616c2d77 6f726c64 20617070 6c696361 al-world applica\n- 0x00bcda40 74696f6e 20796f75 20776f75 6c642070 tion you would p\n- 0x00bcda50 726f6261 626c7920 77616e74 20746f20 robably want to \n- 0x00bcda60 68617665 20602822 222c2068 65697374 have `(\"\", heist\n- 0x00bcda70 53657276 65296020 696e0a74 6865206c Serve)` in.the l\n- 0x00bcda80 69737420 70617373 65642074 6f206061 ist passed to `a\n- 0x00bcda90 6464526f 75746573 602e0a0a 77697468 ddRoutes`...with\n- 0x00bcdaa0 0a2d2d2d 2d0a0a54 6865206c 61737420 .----..The last \n- 0x00bcdab0 756e6661 6d696c69 61722066 756e6374 unfamiliar funct\n- 0x00bcdac0 696f6e20 696e2074 68652065 78616d70 ion in the examp\n- 0x00bcdad0 6c652069 73206077 69746860 2e202048 le is `with`. H\n- 0x00bcdae0 65726520 69742061 63636f6d 70616e69 ere it accompani\n- 0x00bcdaf0 65732061 0a63616c 6c20746f 20746865 es a.call to the\n- 0x00bcdb00 2066756e 6374696f 6e20606e 616d6550 function `nameP\n- 0x00bcdb10 61676560 2e202060 6e616d65 50616765 age`. `namePage\n- 0x00bcdb20 60206973 20612073 696d706c 65206578 ` is a simple ex\n- 0x00bcdb30 616d706c 65206861 6e646c65 7220616e ample handler an\n- 0x00bcdb40 640a6c6f 6f6b7320 6c696b65 20746869 d.looks like thi\n- 0x00bcdb50 732e0a0a 3e206e61 6d655061 6765203a s...> namePage :\n- 0x00bcdb60 3a204861 6e646c65 72206220 76202829 : Handler b v ()\n- 0x00bcdb70 0a3e206e 616d6550 61676520 3d20646f .> namePage = do\n- 0x00bcdb80 0a3e2020 2020206d 6e616d65 203c2d20 .> mname <- \n- 0x00bcdb90 67657453 6e61706c 65744e61 6d650a3e getSnapletName.>\n- 0x00bcdba0 20202020 20777269 74655465 78742024 writeText $\n- 0x00bcdbb0 2066726f 6d4d6179 62652022 54686973 fromMaybe \"This\n- 0x00bcdbc0 2073686f 756c646e 27742068 61707065 shouldn't happe\n- 0x00bcdbd0 6e22206d 6e616d65 0a0a5468 69732066 n\" mname..This f\n- 0x00bcdbe0 756e6374 696f6e20 69732061 2067656e unction is a gen\n- 0x00bcdbf0 65726963 2068616e 646c6572 20746861 eric handler tha\n- 0x00bcdc00 74206765 74732074 6865206e 616d6520 t gets the name \n- 0x00bcdc10 6f662074 68652063 75727265 6e742073 of the current s\n- 0x00bcdc20 6e61706c 65740a61 6e642077 72697465 naplet.and write\n- 0x00bcdc30 73206974 20696e74 6f207468 65207265 s it into the re\n- 0x00bcdc40 73706f6e 73652077 69746820 74686520 sponse with the \n- 0x00bcdc50 60777269 74655465 78746020 66756e63 `writeText` func\n- 0x00bcdc60 74696f6e 20646566 696e6564 20627920 tion defined by \n- 0x00bcdc70 7468650a 736e6170 2d636f72 65207072 the.snap-core pr\n- 0x00bcdc80 6f6a6563 742e2020 54686520 74797065 oject. The type\n- 0x00bcdc90 20766172 6961626c 65732027 62272061 variables 'b' a\n- 0x00bcdca0 6e642027 76272069 6e646963 61746520 nd 'v' indicate \n- 0x00bcdcb0 74686174 20746869 73206675 6e637469 that this functi\n- 0x00bcdcc0 6f6e0a77 696c6c20 776f726b 20696e20 on.will work in \n- 0x00bcdcd0 616e7920 736e6170 6c657420 77697468 any snaplet with\n- 0x00bcdce0 20616e79 20626173 65206170 706c6963 any base applic\n- 0x00bcdcf0 6174696f 6e2e2020 54686520 27776974 ation. The 'wit\n- 0x00bcdd00 68272066 756e6374 696f6e20 69730a75 h' function is.u\n- 0x00bcdd10 73656420 746f2072 756e2060 6e616d65 sed to run `name\n- 0x00bcdd20 50616765 6020696e 20746865 20636f6e Page` in the con\n- 0x00bcdd30 74657874 206f6620 74686520 736e6170 text of the snap\n- 0x00bcdd40 6c657473 20666f6f 20616e64 20626172 lets foo and bar\n- 0x00bcdd50 20666f72 20746865 0a636f72 72657370 for the.corresp\n- 0x00bcdd60 6f6e6469 6e672072 6f757465 732e0a0a onding routes...\n- 0x00bcdd70 53697465 2052656c 6f616469 6e670a2d Site Reloading.-\n- 0x00bcdd80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d0a0a53 -------------..S\n- 0x00bcdd90 6e61706c 65742049 6e697469 616c697a naplet Initializ\n- 0x00bcdda0 65727320 73657276 65206475 616c2070 ers serve dual p\n- 0x00bcddb0 7572706f 73652061 7320626f 74682069 urpose as both i\n- 0x00bcddc0 6e697469 616c697a 65727320 616e6420 nitializers and \n- 0x00bcddd0 72656c6f 61646572 732e0a52 656c6f61 reloaders..Reloa\n- 0x00bcdde0 64732061 72652074 72696767 65726564 ds are triggered\n- 0x00bcddf0 20627920 61207370 65636961 6c206861 by a special ha\n- 0x00bcde00 6e646c65 72207468 61742069 7320626f ndler that is bo\n- 0x00bcde10 756e6420 746f2074 68650a60 2f61646d und to the.`/adm\n- 0x00bcde20 696e2f72 656c6f61 64602072 6f757465 in/reload` route\n- 0x00bcde30 2e202054 68697320 68616e64 6c657220 . This handler \n- 0x00bcde40 72652d72 756e7320 74686520 73697465 re-runs the site\n- 0x00bcde50 20696e69 7469616c 697a6572 20616e64 initializer and\n- 0x00bcde60 20696620 69742069 730a7375 63636573 if it is.succes\n- 0x00bcde70 7366756c 2c206c6f 61647320 74686520 sful, loads the \n- 0x00bcde80 6e65776c 79206765 6e657261 74656420 newly generated \n- 0x00bcde90 696e2d6d 656d6f72 79207374 6174652e in-memory state.\n- 0x00bcdea0 2020546f 20707265 76656e74 2064656e To prevent den\n- 0x00bcdeb0 69616c20 6f660a73 65727669 63652061 ial of.service a\n- 0x00bcdec0 74746163 6b732c20 74686520 72656c6f ttacks, the relo\n- 0x00bcded0 61642072 6f757465 20697320 6f6e6c79 ad route is only\n- 0x00bcdee0 20616363 65737369 626c6520 66726f6d accessible from\n- 0x00bcdef0 206c6f63 616c686f 73742e0a 0a496620 localhost...If \n- 0x00bcdf00 74686572 65206172 6520616e 79206572 there are any er\n- 0x00bcdf10 726f7273 20647572 696e6720 72656c6f rors during relo\n- 0x00bcdf20 61642c20 796f7520 776f756c 64206e61 ad, you would na\n- 0x00bcdf30 74757261 6c6c7920 77616e74 20746f20 turally want to \n- 0x00bcdf40 73656520 7468656d 20696e0a 74686520 see them in.the \n- 0x00bcdf50 48545450 20726573 706f6e73 65207265 HTTP response re\n- 0x00bcdf60 7475726e 65642062 79207468 65207365 turned by the se\n- 0x00bcdf70 72766572 2e202048 6f776576 65722c20 rver. However, \n- 0x00bcdf80 7768656e 20746865 73652073 616d650a when these same.\n- 0x00bcdf90 696e6974 69616c69 7a657273 20617265 initializers are\n- 0x00bcdfa0 2072756e 20776865 6e20796f 75206669 run when you fi\n- 0x00bcdfb0 72737420 73746172 7420796f 75722061 rst start your a\n- 0x00bcdfc0 70702c20 796f7520 77696c6c 2077616e pp, you will wan\n- 0x00bcdfd0 7420746f 20736565 0a737461 74757320 t to see.status \n- 0x00bcdfe0 6d657373 61676573 20707269 6e746564 messages printed\n- 0x00bcdff0 20746f20 74686520 636f6e73 6f6c652e to the console.\n- 0x00bce000 2020546f 206d616b 65207468 69732070 To make this p\n- 0x00bce010 6f737369 626c6520 77652070 726f7669 ossible we provi\n- 0x00bce020 64652074 68650a60 7072696e 74496e66 de the.`printInf\n- 0x00bce030 6f602066 756e6374 696f6e2e 2020596f o` function. Yo\n- 0x00bce040 75207368 6f756c64 20757365 20697420 u should use it \n- 0x00bce050 746f206f 75747075 7420616e 7920696e to output any in\n- 0x00bce060 666f726d 6174696f 6e616c20 6d657373 formational mess\n- 0x00bce070 61676573 0a67656e 65726174 65642062 ages.generated b\n- 0x00bce080 7920796f 75722069 6e697469 616c697a y your initializ\n- 0x00bce090 6572732e 20204966 20796f75 20707269 ers. If you pri\n- 0x00bce0a0 6e742064 69726563 746c7920 746f2073 nt directly to s\n- 0x00bce0b0 74616e64 61726420 6f757470 7574206f tandard output o\n- 0x00bce0c0 720a7374 616e6461 72642065 72726f72 r.standard error\n- 0x00bce0d0 2c207468 656e2074 686f7365 206d6573 , then those mes\n- 0x00bce0e0 73616765 73207769 6c6c206e 6f742062 sages will not b\n- 0x00bce0f0 65206176 61696c61 626c6520 696e2079 e available in y\n- 0x00bce100 6f757220 62726f77 73657220 7768656e our browser when\n- 0x00bce110 0a796f75 2072656c 6f616420 74686520 .you reload the \n- 0x00bce120 73697465 2e0a0a57 6f726b69 6e672077 site...Working w\n- 0x00bce130 69746820 73746174 650a2d2d 2d2d2d2d ith state.------\n- 0x00bce140 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a0a6048 ------------..`H\n- 0x00bce150 616e646c 65722062 20766020 68617320 andler b v` has \n- 0x00bce160 6120604d 6f6e6164 53746174 65207660 a `MonadState v`\n- 0x00bce170 20696e73 74616e63 652e2020 54686973 instance. This\n- 0x00bce180 206d6561 6e732074 68617420 796f7520 means that you \n- 0x00bce190 63616e20 61636365 73730a61 6c6c2079 can access.all y\n- 0x00bce1a0 6f757220 736e6170 6c657420 73746174 our snaplet stat\n- 0x00bce1b0 65207468 726f7567 68207468 65206765 e through the ge\n- 0x00bce1c0 742c2070 75742c20 67657473 2c20616e t, put, gets, an\n- 0x00bce1d0 64206d6f 64696679 2066756e 6374696f d modify functio\n- 0x00bce1e0 6e732074 6861740a 61726520 70726f62 ns that.are prob\n- 0x00bce1f0 61626c79 2066616d 696c6961 72206672 ably familiar fr\n- 0x00bce200 6f6d2074 68652073 74617465 206d6f6e om the state mon\n- 0x00bce210 61642e20 20496e20 6f757220 6578616d ad. In our exam\n- 0x00bce220 706c6520 6170706c 69636174 696f6e20 ple application \n- 0x00bce230 77650a64 656d6f6e 73747261 74652074 we.demonstrate t\n- 0x00bce240 68697320 77697468 2060636f 6d70616e his with `compan\n- 0x00bce250 7948616e 646c6572 602e0a0a 3e20636f yHandler`...> co\n- 0x00bce260 6d70616e 7948616e 646c6572 203a3a20 mpanyHandler :: \n- 0x00bce270 48616e64 6c657220 41707020 41707020 Handler App App \n- 0x00bce280 28290a3e 20636f6d 70616e79 48616e64 ().> companyHand\n- 0x00bce290 6c657220 3d206d65 74686f64 20474554 ler = method GET\n- 0x00bce2a0 20676574 74657220 3c7c3e20 6d657468 getter <|> meth\n- 0x00bce2b0 6f642050 4f535420 73657474 65720a3e od POST setter.>\n- 0x00bce2c0 20202077 68657265 0a3e2020 20202067 where.> g\n- 0x00bce2d0 65747465 72203d20 646f0a3e 20202020 etter = do.> \n- 0x00bce2e0 20202020 206e616d 65526566 203c2d20 nameRef <- \n- 0x00bce2f0 67657473 205f636f 6d70616e 794e616d gets _companyNam\n- 0x00bce300 650a3e20 20202020 20202020 6e616d65 e.> name\n- 0x00bce310 203c2d20 6c696674 494f2024 20726561 <- liftIO $ rea\n- 0x00bce320 64494f52 6566206e 616d6552 65660a3e dIORef nameRef.>\n- 0x00bce330 20202020 20202020 20777269 74654253 writeBS\n- 0x00bce340 206e616d 650a3e20 20202020 73657474 name.> sett\n- 0x00bce350 6572203d 20646f0a 3e202020 20202020 er = do.> \n- 0x00bce360 20206d6e 616d6520 3c2d2067 65745061 mname <- getPa\n- 0x00bce370 72616d20 226e616d 65220a3e 20202020 ram \"name\".> \n- 0x00bce380 20202020 206e616d 65526566 203c2d20 nameRef <- \n- 0x00bce390 67657473 205f636f 6d70616e 794e616d gets _companyNam\n- 0x00bce3a0 650a3e20 20202020 20202020 6c696674 e.> lift\n- 0x00bce3b0 494f2024 206d6179 62652028 72657475 IO $ maybe (retu\n- 0x00bce3c0 726e2028 29292028 77726974 65494f52 rn ()) (writeIOR\n- 0x00bce3d0 6566206e 616d6552 65662920 6d6e616d ef nameRef) mnam\n- 0x00bce3e0 650a3e20 20202020 20202020 67657474 e.> gett\n- 0x00bce3f0 65720a0a 49662079 6f752073 65742061 er..If you set a\n- 0x00bce400 20474554 20726571 75657374 20746f20 GET request to \n- 0x00bce410 602f636f 6d70616e 79602c20 796f7527 `/company`, you'\n- 0x00bce420 6c6c2067 65742074 68652073 7472696e ll get the strin\n- 0x00bce430 67202266 6f6f436f 72702220 6261636b g \"fooCorp\" back\n- 0x00bce440 2e0a4966 20796f75 2073656e 64206120 ..If you send a \n- 0x00bce450 504f5354 20726571 75657374 2c206974 POST request, it\n- 0x00bce460 2077696c 6c207365 74207468 6520494f will set the IO\n- 0x00bce470 52656620 68656c64 20696e20 74686520 Ref held in the \n- 0x00bce480 605f636f 6d70616e 794e616d 65600a66 `_companyName`.f\n- 0x00bce490 69656c64 20696e20 74686520 60417070 ield in the `App\n- 0x00bce4a0 60206461 74612073 74727563 74757265 ` data structure\n- 0x00bce4b0 20746f20 74686520 76616c75 65206f66 to the value of\n- 0x00bce4c0 20746865 20606e61 6d656020 6669656c the `name` fiel\n- 0x00bce4d0 642e2020 5468656e 2069740a 63616c6c d. Then it.call\n- 0x00bce4e0 73207468 65206765 74746572 20746f20 s the getter to \n- 0x00bce4f0 72657475 726e2074 68617420 76616c75 return that valu\n- 0x00bce500 65206261 636b2074 6f20796f 7520736f e back to you so\n- 0x00bce510 20796f75 2063616e 20736565 20697420 you can see it \n- 0x00bce520 7761730a 61637475 616c6c79 20636861 was.actually cha\n- 0x00bce530 6e676564 2e202041 6761696e 2c207265 nged. Again, re\n- 0x00bce540 6d656d62 65722074 68617420 74686973 member that this\n- 0x00bce550 20636861 6e676520 6f6e6c79 20706572 change only per\n- 0x00bce560 73697374 73206163 726f7373 0a726571 sists across.req\n- 0x00bce570 75657374 73206265 63617573 65207765 uests because we\n- 0x00bce580 20757365 6420616e 20494f52 65662e20 used an IORef. \n- 0x00bce590 20496620 605f636f 6d70616e 794e616d If `_companyNam\n- 0x00bce5a0 65602077 6173206a 75737420 6120706c e` was just a pl\n- 0x00bce5b0 61696e20 73747269 6e670a61 6e642077 ain string.and w\n- 0x00bce5c0 65206861 64207573 6564206d 6f646966 e had used modif\n- 0x00bce5d0 792c2074 68652063 68616e67 65642072 y, the changed r\n- 0x00bce5e0 6573756c 7420776f 756c6420 6f6e6c79 esult would only\n- 0x00bce5f0 20626520 76697369 626c6520 696e2074 be visible in t\n- 0x00bce600 68652072 6573740a 6f662074 68652070 he rest.of the p\n- 0x00bce610 726f6365 7373696e 6720666f 72207468 rocessing for th\n- 0x00bce620 61742072 65717565 73742e0a 0a546865 at request...The\n- 0x00bce630 20486569 73742053 6e61706c 65740a3d Heist Snaplet.=\n- 0x00bce640 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================\n- 0x00bce650 0a0a5468 65206173 74757465 20726561 ..The astute rea\n- 0x00bce660 64657220 6d696768 74206173 6b207768 der might ask wh\n- 0x00bce670 79207468 65726520 6973206e 6f206077 y there is no `w\n- 0x00bce680 69746820 68656973 74602069 6e206672 ith heist` in fr\n- 0x00bce690 6f6e7420 6f662074 68652063 616c6c0a ont of the call.\n- 0x00bce6a0 746f2060 68656973 74536572 7665602e to `heistServe`.\n- 0x00bce6b0 2020416e 6420696e 64656564 2c207468 And indeed, th\n- 0x00bce6c0 61742077 6f756c64 206e6f72 6d616c6c at would normall\n- 0x00bce6d0 79206265 20746865 20636173 652e2020 y be the case. \n- 0x00bce6e0 42757420 77652064 65636964 65640a74 But we decided.t\n- 0x00bce6f0 68617420 616e2061 70706c69 63617469 hat an applicati\n- 0x00bce700 6f6e2077 696c6c20 6e657665 72206e65 on will never ne\n- 0x00bce710 6564206d 6f726520 7468616e 206f6e65 ed more than one\n- 0x00bce720 20696e73 74616e63 65206f66 20612048 instance of a H\n- 0x00bce730 65697374 20736e61 706c6574 2e0a536f eist snaplet..So\n- 0x00bce740 20776520 70726f76 69646564 20612074 we provided a t\n- 0x00bce750 79706520 636c6173 73206361 6c6c6564 ype class called\n- 0x00bce760 20604861 73486569 73746020 74686174 `HasHeist` that\n- 0x00bce770 20616c6c 6f777320 616e2061 70706c69 allows an appli\n- 0x00bce780 63617469 6f6e2074 6f0a6465 66696e65 cation to.define\n- 0x00bce790 20746865 20676c6f 62616c20 72656665 the global refe\n- 0x00bce7a0 72656e63 6520746f 20697473 20486569 rence to its Hei\n- 0x00bce7b0 73742073 6e61706c 65742062 79207772 st snaplet by wr\n- 0x00bce7c0 6974696e 67206120 60486173 48656973 iting a `HasHeis\n- 0x00bce7d0 74600a69 6e737461 6e63652e 2020496e t`.instance. In\n- 0x00bce7e0 20746869 73206578 616d706c 65207765 this example we\n- 0x00bce7f0 20646566 696e6520 74686520 696e7374 define the inst\n- 0x00bce800 616e6365 20617320 666f6c6c 6f77733a ance as follows:\n- 0x00bce810 0a0a3e20 696e7374 616e6365 20486173 ..> instance Has\n- 0x00bce820 48656973 74204170 70207768 65726520 Heist App where \n- 0x00bce830 68656973 744c656e 73203d20 73756253 heistLens = subS\n- 0x00bce840 6e61706c 65742068 65697374 0a0a4e6f naplet heist..No\n- 0x00bce850 7720616c 6c207765 206e6565 64206973 w all we need is\n- 0x00bce860 20612073 696d706c 65206d61 696e2066 a simple main f\n- 0x00bce870 756e6374 696f6e20 746f2073 65727665 unction to serve\n- 0x00bce880 206f7572 20617070 6c696361 74696f6e our application\n- 0x00bce890 2e0a0a3e 206d6169 6e203a3a 20494f20 ...> main :: IO \n- 0x00bce8a0 28290a3e 206d6169 6e203d20 73657276 ().> main = serv\n- 0x00bce8b0 65536e61 706c6574 20646566 61756c74 eSnaplet default\n- 0x00bce8c0 436f6e66 69672061 7070496e 69740a0a Config appInit..\n- 0x00bce8d0 54686973 20636f6d 706c6574 65732061 This completes a\n- 0x00bce8e0 2066756c 6c20776f 726b696e 67206170 full working ap\n- 0x00bce8f0 706c6963 6174696f 6e2e2020 57652064 plication. We d\n- 0x00bce900 6964206c 65617665 206f7574 2061206c id leave out a l\n- 0x00bce910 6974746c 65206475 6d6d790a 636f6465 ittle dummy.code\n- 0x00bce920 20666f72 20746865 20466f6f 20616e64 for the Foo and\n- 0x00bce930 20426172 20736e61 706c6574 732e2020 Bar snaplets. \n- 0x00bce940 54686973 20636f64 65206973 20696e63 This code is inc\n- 0x00bce950 6c756465 6420696e 20506172 74322e68 luded in Part2.h\n- 0x00bce960 732e2020 466f720a 6d6f7265 20696e66 s. For.more inf\n- 0x00bce970 6f726d61 74696f6e 206c6f6f 6b20696e ormation look in\n- 0x00bce980 206f7572 205b4150 490a646f 63756d65 our [API.docume\n- 0x00bce990 6e746174 696f6e5d 28687474 703a2f2f ntation](http://\n- 0x00bce9a0 6861636b 6167652e 6861736b 656c6c2e hackage.haskell.\n- 0x00bce9b0 6f72672f 7061636b 6167652f 736e6170 org/package/snap\n- 0x00bce9c0 292c2073 70656369 66696361 6c6c7920 ), specifically \n- 0x00bce9d0 7468650a 536e6170 2e536e61 706c6574 the.Snap.Snaplet\n- 0x00bce9e0 206d6f64 756c652e 20204e6f 20726561 module. No rea\n- 0x00bce9f0 6c6c792c 20746861 74207761 736e2774 lly, that wasn't\n- 0x00bcea00 2061206a 6f6b652e 20205468 65204150 a joke. The AP\n- 0x00bcea10 4920646f 63732061 72652077 72697474 I docs are writt\n- 0x00bcea20 656e0a61 73207072 6f73652e 20205468 en.as prose. Th\n- 0x00bcea30 65792073 686f756c 64206265 20766572 ey should be ver\n- 0x00bcea40 79206561 73792074 6f207265 61642c20 y easy to read, \n- 0x00bcea50 7768696c 65206861 76696e67 20746865 while having the\n- 0x00bcea60 2062656e 65666974 206f660a 696e636c benefit of.incl\n- 0x00bcea70 7564696e 6720616c 6c207468 65206163 uding all the ac\n- 0x00bcea80 7475616c 20747970 65207369 676e6174 tual type signat\n- 0x00bcea90 75726573 2e0a0a46 696c6573 79737465 ures...Filesyste\n- 0x00bceaa0 6d204461 74612061 6e642041 75746f6d m Data and Autom\n- 0x00bceab0 61746963 20496e73 74616c6c 6174696f atic Installatio\n- 0x00bceac0 6e0a3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d n.==============\n- 0x00bcead0 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================\n- 0x00bceae0 3d3d3d3d 3d3d3d3d 3d3d3d3d 0a0a536f ============..So\n- 0x00bceaf0 6d652073 6e61706c 65747320 77696c6c me snaplets will\n- 0x00bceb00 20686176 65206461 74612073 746f7265 have data store\n- 0x00bceb10 6420696e 20746865 2066696c 65737973 d in the filesys\n- 0x00bceb20 74656d20 74686174 2073686f 756c6420 tem that should \n- 0x00bceb30 62652069 6e737461 6c6c6564 0a696e74 be installed.int\n- 0x00bceb40 6f207468 65206469 72656374 6f727920 o the directory \n- 0x00bceb50 6f662061 6e792070 726f6a65 63742074 of any project t\n- 0x00bceb60 68617420 75736573 2069742e 20204865 hat uses it. He\n- 0x00bceb70 72652773 20616e20 6578616d 706c6520 re's an example \n- 0x00bceb80 6f662077 68617420 610a736e 61706c65 of what a.snaple\n- 0x00bceb90 74206669 6c657379 7374656d 206c6179 t filesystem lay\n- 0x00bceba0 6f757420 6d696768 74206c6f 6f6b206c out might look l\n- 0x00bcebb0 696b653a 0a0a2020 2020666f 6f736e61 ike:.. foosna\n- 0x00bcebc0 706c6574 2f0a2020 20202020 7c2d2d20 plet/. |-- \n- 0x00bcebd0 2a646576 656c2e63 66672a0a 20202020 *devel.cfg*. \n- 0x00bcebe0 20207c2d 2d206462 2e636667 0a202020 |-- db.cfg. \n- 0x00bcebf0 2020207c 2d2d2070 75626c69 632f0a20 |-- public/. \n- 0x00bcec00 20202020 20202020 207c2d2d 20737479 |-- sty\n- 0x00bcec10 6c657368 65657473 2f0a2020 20202020 lesheets/. \n- 0x00bcec20 20202020 7c2d2d20 696d6167 65732f0a |-- images/.\n- 0x00bcec30 20202020 20202020 20207c2d 2d206a73 |-- js\n- 0x00bcec40 2f0a2020 20202020 7c2d2d20 2a736e61 /. |-- *sna\n- 0x00bcec50 706c6574 732f2a0a 20202020 20202020 plets/*. \n- 0x00bcec60 20207c2d 2d202a68 65697374 2f2a0a20 |-- *heist/*. \n- 0x00bcec70 20202020 20202020 20202020 207c2d2d |--\n- 0x00bcec80 2074656d 706c6174 65732f0a 20202020 templates/. \n- 0x00bcec90 20202020 20207c2d 2d207375 62736e61 |-- subsna\n- 0x00bceca0 706c6574 312f0a20 20202020 20202020 plet1/. \n- 0x00bcecb0 207c2d2d 20737562 736e6170 6c657432 |-- subsnaplet2\n- 0x00bcecc0 2f0a0a4f 6e6c7920 74686520 73746172 /..Only the star\n- 0x00bcecd0 72656420 6974656d 73206172 65206163 red items are ac\n- 0x00bcece0 7475616c 6c792065 6e666f72 63656420 tually enforced \n- 0x00bcecf0 62792063 75727265 6e742063 6f64652c by current code,\n- 0x00bced00 20627574 20776520 77616e74 20746f0a but we want to.\n- 0x00bced10 65737461 626c6973 68207468 65206f74 establish the ot\n- 0x00bced20 68657273 20617320 6120636f 6e76656e hers as a conven\n- 0x00bced30 74696f6e 2e202054 68652066 696c6520 tion. The file \n- 0x00bced40 64657665 6c2e6366 67206973 20617574 devel.cfg is aut\n- 0x00bced50 6f6d6174 6963616c 6c790a72 65616420 omatically.read \n- 0x00bced60 62792074 68652073 6e61706c 65742069 by the snaplet i\n- 0x00bced70 6e667261 73747275 63747572 652e2020 nfrastructure. \n- 0x00bced80 49742069 73206176 61696c61 626c6520 It is available \n- 0x00bced90 746f2079 6f752076 69612074 68650a60 to you via the.`\n- 0x00bceda0 67657453 6e61706c 65745573 6572436f getSnapletUserCo\n- 0x00bcedb0 6e666967 60206675 6e637469 6f6e2e20 nfig` function. \n- 0x00bcedc0 20436f6e 66696720 66696c65 73207573 Config files us\n- 0x00bcedd0 65207468 6520666f 726d6174 20646566 e the format def\n- 0x00bcede0 696e6564 20627920 42727961 6e0a4f27 ined by Bryan.O'\n- 0x00bcedf0 53756c6c 6976616e 27732065 7863656c Sullivan's excel\n- 0x00bcee00 6c656e74 205b636f 6e666967 75726174 lent [configurat\n- 0x00bcee10 6f720a70 61636b61 67655d28 68747470 or.package](http\n- 0x00bcee20 3a2f2f68 61636b61 67652e68 61736b65 ://hackage.haske\n- 0x00bcee30 6c6c2e6f 72672f70 61636b61 67652f63 ll.org/package/c\n- 0x00bcee40 6f6e6669 67757261 746f7229 2e202049 onfigurator). I\n- 0x00bcee50 6e207468 69732065 78616d70 6c652c0a n this example,.\n- 0x00bcee60 74686520 75736572 20686173 2063686f the user has cho\n- 0x00bcee70 73656e20 746f2070 75742064 6220636f sen to put db co\n- 0x00bcee80 6e666967 20697465 6d732069 6e206120 nfig items in a \n- 0x00bcee90 73657061 72617465 2066696c 6520616e separate file an\n- 0x00bceea0 64207573 650a636f 6e666967 75726174 d use.configurat\n- 0x00bceeb0 6f722773 20696d70 6f727420 66756e63 or's import func\n- 0x00bceec0 74696f6e 616c6974 7920746f 20696e63 tionality to inc\n- 0x00bceed0 6c756465 20697420 696e2064 6576656c lude it in devel\n- 0x00bceee0 2e636667 2e202049 660a666f 6f736e61 .cfg. If.foosna\n- 0x00bceef0 706c6574 20757365 7320606e 65737453 plet uses `nestS\n- 0x00bcef00 6e61706c 65746020 6f722060 656d6265 naplet` or `embe\n- 0x00bcef10 64536e61 706c6574 6020746f 20696e63 dSnaplet` to inc\n- 0x00bcef20 6c756465 20616e79 206f7468 65722073 lude any other s\n- 0x00bcef30 6e61706c 6574732c 0a746865 6e206669 naplets,.then fi\n- 0x00bcef40 6c657379 7374656d 20646174 61206465 lesystem data de\n- 0x00bcef50 66696e65 64206279 2074686f 73652073 fined by those s\n- 0x00bcef60 6e61706c 65747320 77696c6c 20626520 naplets will be \n- 0x00bcef70 696e636c 75646564 20696e0a 73756264 included in.subd\n- 0x00bcef80 69726563 746f7269 65732075 6e646572 irectories under\n- 0x00bcef90 20746865 2060736e 61706c65 74732f60 the `snaplets/`\n- 0x00bcefa0 20646972 6563746f 72792e0a 0a536f20 directory...So \n- 0x00bcefb0 686f7720 646f2079 6f752074 656c6c20 how do you tell \n- 0x00bcefc0 74686520 736e6170 6c657420 696e6672 the snaplet infr\n- 0x00bcefd0 61737472 75637475 72652074 68617420 astructure that \n- 0x00bcefe0 796f7572 20736e61 706c6574 20686173 your snaplet has\n- 0x00bceff0 2066696c 65737973 74656d0a 64617461 filesystem.data\n- 0x00bcf000 20746861 74207368 6f756c64 20626520 that should be \n- 0x00bcf010 696e7374 616c6c65 643f2020 4c6f6f6b installed? Look\n- 0x00bcf020 20617420 74686520 64656669 6e697469 at the definiti\n- 0x00bcf030 6f6e206f 66206170 70496e69 74206162 on of appInit ab\n- 0x00bcf040 6f76652e 20205468 650a7468 69726420 ove. The.third \n- 0x00bcf050 61726775 6d656e74 20746f20 74686520 argument to the \n- 0x00bcf060 6d616b65 536e6170 6c657420 66756e63 makeSnaplet func\n- 0x00bcf070 74696f6e 20697320 77686572 65207765 tion is where we\n- 0x00bcf080 20737065 63696679 20746865 2066696c specify the fil\n- 0x00bcf090 65737973 74656d0a 64697265 63746f72 esystem.director\n- 0x00bcf0a0 79207468 61742073 686f756c 64206265 y that should be\n- 0x00bcf0b0 20696e73 74616c6c 65642e20 20546861 installed. Tha\n- 0x00bcf0c0 74206172 67756d65 6e742068 61732074 t argument has t\n- 0x00bcf0d0 68652074 79706520 604d6179 62652028 he type `Maybe (\n- 0x00bcf0e0 494f0a46 696c6550 61746829 602e2020 IO.FilePath)`. \n- 0x00bcf0f0 496e2074 68697320 63617365 20776520 In this case we \n- 0x00bcf100 75736564 20604e6f 7468696e 67602062 used `Nothing` b\n- 0x00bcf110 65636175 7365206f 75722073 696d706c ecause our simpl\n- 0x00bcf120 65206578 616d706c 6520646f 65736e27 e example doesn'\n- 0x00bcf130 740a6861 76652061 6e792066 696c6573 t.have any files\n- 0x00bcf140 79737465 6d206461 74612e20 20417320 ystem data. As \n- 0x00bcf150 616e2065 78616d70 6c652c20 6c657427 an example, let'\n- 0x00bcf160 73207361 7920796f 75206172 65206372 s say you are cr\n- 0x00bcf170 65617469 6e672061 20736e61 706c6574 eating a snaplet\n- 0x00bcf180 0a63616c 6c656420 6b696c6c 65726170 .called killerap\n- 0x00bcf190 70207468 61742077 696c6c20 62652064 p that will be d\n- 0x00bcf1a0 69737472 69627574 65642061 73206120 istributed as a \n- 0x00bcf1b0 6861636b 61676520 70726f6a 65637420 hackage project \n- 0x00bcf1c0 63616c6c 65640a73 6e61706c 65742d6b called.snaplet-k\n- 0x00bcf1d0 696c6c65 72617070 2e202059 6f757220 illerapp. Your \n- 0x00bcf1e0 70726f6a 65637420 64697265 63746f72 project director\n- 0x00bcf1f0 79207374 72756374 75726520 77696c6c y structure will\n- 0x00bcf200 206c6f6f 6b20736f 6d657468 696e6720 look something \n- 0x00bcf210 6c696b65 0a746869 733a0a0a 20202020 like.this:.. \n- 0x00bcf220 736e6170 6c65742d 6b696c6c 65726170 snaplet-killerap\n- 0x00bcf230 702f0a20 20202020 207c2d2d 20726573 p/. |-- res\n- 0x00bcf240 6f757263 65732f0a 20202020 20207c2d ources/. |-\n- 0x00bcf250 2d20736e 61706c65 742d6b69 6c6c6572 - snaplet-killer\n- 0x00bcf260 6170702e 63616261 6c0a2020 20202020 app.cabal. \n- 0x00bcf270 7c2d2d20 7372632f 0a0a416c 6c206f66 |-- src/..All of\n- 0x00bcf280 20746865 2066696c 65732061 6e642064 the files and d\n- 0x00bcf290 69726563 746f7269 6573206c 69737465 irectories liste\n- 0x00bcf2a0 64206162 6f766520 756e6465 7220666f d above under fo\n- 0x00bcf2b0 6f736e61 706c6574 2f207769 6c6c2062 osnaplet/ will b\n- 0x00bcf2c0 6520696e 0a726573 6f757263 65732f2e e in.resources/.\n- 0x00bcf2d0 2020536f 6d657768 65726520 696e2074 Somewhere in t\n- 0x00bcf2e0 68652063 6f646520 796f7520 77696c6c he code you will\n- 0x00bcf2f0 20646566 696e6520 616e2069 6e697469 define an initi\n- 0x00bcf300 616c697a 65722066 6f722074 68650a73 alizer for the.s\n- 0x00bcf310 6e61706c 65742074 68617420 77696c6c naplet that will\n- 0x00bcf320 206c6f6f 6b206c69 6b652074 6869733a look like this:\n- 0x00bcf330 0a0a2020 20206b69 6c6c6572 496e6974 .. killerInit\n- 0x00bcf340 203d206d 616b6553 6e61706c 65742022 = makeSnaplet \"\n- 0x00bcf350 6b696c6c 65726170 70222022 34322220 killerapp\" \"42\" \n- 0x00bcf360 284a7573 74206461 74614469 72292024 (Just dataDir) $\n- 0x00bcf370 20646f0a 0a546865 20707269 6d617279 do..The primary\n- 0x00bcf380 2066756e 6374696f 6e206f66 20436162 function of Cab\n- 0x00bcf390 616c2069 7320746f 20696e73 74616c6c al is to install\n- 0x00bcf3a0 20636f64 652e2020 42757420 69742068 code. But it h\n- 0x00bcf3b0 61732074 68652061 62696c69 74792074 as the ability t\n- 0x00bcf3c0 6f0a696e 7374616c 6c206461 74612066 o.install data f\n- 0x00bcf3d0 696c6573 20616e64 2070726f 76696465 iles and provide\n- 0x00bcf3e0 73206120 66756e63 74696f6e 2063616c s a function cal\n- 0x00bcf3f0 6c656420 60676574 44617461 44697260 led `getDataDir`\n- 0x00bcf400 20666f72 20726574 72696576 696e670a for retrieving.\n- 0x00bcf410 74686520 6c6f6361 74696f6e 206f6620 the location of \n- 0x00bcf420 74686573 65206669 6c65732e 20205369 these files. Si\n- 0x00bcf430 6e636520 69742072 65747572 6e732061 nce it returns a\n- 0x00bcf440 20646966 66657265 6e742072 6573756c different resul\n- 0x00bcf450 74206465 70656e64 696e6720 6f6e0a77 t depending on.w\n- 0x00bcf460 68617420 6d616368 696e6520 796f7527 hat machine you'\n- 0x00bcf470 72652075 73696e67 2c207468 65207468 re using, the th\n- 0x00bcf480 69726420 61726775 6d656e74 20746f20 ird argument to \n- 0x00bcf490 606d616b 65536e61 706c6574 60206861 `makeSnaplet` ha\n- 0x00bcf4a0 7320746f 20626520 604d6179 62650a28 s to be `Maybe.(\n- 0x00bcf4b0 494f2046 696c6550 61746829 6020696e IO FilePath)` in\n- 0x00bcf4c0 73746561 64206f66 20746865 206d6f72 stead of the mor\n- 0x00bcf4d0 65206e61 74757261 6c207075 72652076 e natural pure v\n- 0x00bcf4e0 65727369 6f6e2e20 20546f20 6d616b65 ersion. To make\n- 0x00bcf4f0 20746869 6e677320 6d6f7265 0a6f7267 things more.org\n- 0x00bcf500 616e697a 65642c20 77652075 73652074 anized, we use t\n- 0x00bcf510 68652063 6f6e7665 6e74696f 6e206f66 he convention of\n- 0x00bcf520 20707574 74696e67 20616c6c 20796f75 putting all you\n- 0x00bcf530 7220736e 61706c65 74277320 64617461 r snaplet's data\n- 0x00bcf540 2066696c 65732069 6e20610a 73756264 files in a.subd\n- 0x00bcf550 69726563 746f7279 2063616c 6c656420 irectory called \n- 0x00bcf560 7265736f 75726365 732e2020 536f2077 resources. So w\n- 0x00bcf570 65206e65 65642074 6f206372 65617465 e need to create\n- 0x00bcf580 20612073 6d616c6c 2066756e 6374696f a small functio\n- 0x00bcf590 6e207468 61740a61 7070656e 64732060 n that.appends `\n- 0x00bcf5a0 2f726573 6f757263 65736020 746f2074 /resources` to t\n- 0x00bcf5b0 68652072 6573756c 74206f66 20606765 he result of `ge\n- 0x00bcf5c0 74446174 61446972 602e0a0a 20202020 tDataDir`... \n- 0x00bcf5d0 696d706f 72742050 61746873 5f736e61 import Paths_sna\n- 0x00bcf5e0 706c6574 5f6b696c 6c657261 70700a20 plet_killerapp. \n- 0x00bcf5f0 20202064 61746144 6972203d 206c6966 dataDir = lif\n- 0x00bcf600 744d2028 2b2b222f 7265736f 75726365 tM (++\"/resource\n- 0x00bcf610 73222920 67657444 61746144 69720a0a s\") getDataDir..\n- 0x00bcf620 4966206f 75722070 726f6a65 63742069 If our project i\n- 0x00bcf630 73206e61 6d656420 736e6170 6c65742d s named snaplet-\n- 0x00bcf640 6b696c6c 65726170 702c2074 68652060 killerapp, the `\n- 0x00bcf650 67657444 61746144 69726020 66756e63 getDataDir` func\n- 0x00bcf660 74696f6e 2069730a 64656669 6e656420 tion is.defined \n- 0x00bcf670 696e2074 6865206d 6f64756c 65205061 in the module Pa\n- 0x00bcf680 7468735f 736e6170 6c65745f 6b696c6c ths_snaplet_kill\n- 0x00bcf690 65726170 702c2077 68696368 20776520 erapp, which we \n- 0x00bcf6a0 68617665 20746f20 696d706f 72742e20 have to import. \n- 0x00bcf6b0 20546f0a 6d616b65 20657665 72797468 To.make everyth\n- 0x00bcf6c0 696e6720 776f726b 2c20796f 75206861 ing work, you ha\n- 0x00bcf6d0 76652074 6f207465 6c6c2043 6162616c ve to tell Cabal\n- 0x00bcf6e0 2061626f 75742079 6f757220 64617461 about your data\n- 0x00bcf6f0 2066696c 65732062 790a696e 636c7564 files by.includ\n- 0x00bcf700 696e6720 61207365 6374696f 6e206c69 ing a section li\n- 0x00bcf710 6b652074 68652066 6f6c6c6f 77696e67 ke the following\n- 0x00bcf720 20696e20 736e6170 6c65742d 6b696c6c in snaplet-kill\n- 0x00bcf730 65726170 702e6361 62616c3a 0a0a2020 erapp.cabal:.. \n- 0x00bcf740 20206461 74612d66 696c6573 3a0a2020 data-files:. \n- 0x00bcf750 20202020 7265736f 75726365 732f6465 resources/de\n- 0x00bcf760 76656c2e 6366672c 0a202020 20202072 vel.cfg,. r\n- 0x00bcf770 65736f75 72636573 2f707562 6c69632f esources/public/\n- 0x00bcf780 7374796c 65736865 6574732f 7374796c stylesheets/styl\n- 0x00bcf790 652e6373 732c0a20 20202020 20726573 e.css,. res\n- 0x00bcf7a0 6f757263 65732f73 6e61706c 6574732f ources/snaplets/\n- 0x00bcf7b0 68656973 742f7465 6d706c61 7465732f heist/templates/\n- 0x00bcf7c0 70616765 2e74706c 0a0a4e6f 77207768 page.tpl..Now wh\n- 0x00bcf7d0 656e6576 65722079 6f757220 736e6170 enever your snap\n- 0x00bcf7e0 6c657420 69732075 7365642c 20697473 let is used, its\n- 0x00bcf7f0 2066696c 65737973 74656d20 64617461 filesystem data\n- 0x00bcf800 2077696c 6c206265 20617574 6f6d6167 will be automag\n- 0x00bcf810 6963616c 6c790a63 6f706965 6420696e ically.copied in\n- 0x00bcf820 746f2074 6865206c 6f63616c 2070726f to the local pro\n- 0x00bcf830 6a656374 20746861 74206973 20757369 ject that is usi\n- 0x00bcf840 6e672069 742c2077 68656e65 76657220 ng it, whenever \n- 0x00bcf850 74686520 6170706c 69636174 696f6e20 the application \n- 0x00bcf860 69730a72 756e2061 6e642069 74207365 is.run and it se\n- 0x00bcf870 65732074 68617420 74686520 736e6170 es that the snap\n- 0x00bcf880 6c657427 73206469 72656374 6f727920 let's directory \n- 0x00bcf890 646f6573 206e6f74 20616c72 65616479 does not already\n- 0x00bcf8a0 20657869 73742e20 20496620 7468650a exist. If the.\n- 0x00bcf8b0 75736572 20757067 72616465 7320746f user upgrades to\n- 0x00bcf8c0 2061206e 65772076 65727369 6f6e206f a new version o\n- 0x00bcf8d0 66207468 6520736e 61706c65 7420616e f the snaplet an\n- 0x00bcf8e0 64207468 65206e65 77207665 7273696f d the new versio\n- 0x00bcf8f0 6e206d61 64652063 68616e67 65730a74 n made changes.t\n- 0x00bcf900 6f207468 65206669 6c657379 7374656d o the filesystem\n- 0x00bcf910 20726573 6f757263 65732c20 74686f73 resources, thos\n- 0x00bcf920 65207265 736f7572 63657320 77696c6c e resources will\n- 0x00bcf930 204e4f54 20626520 6175746f 6d617469 NOT be automati\n- 0x00bcf940 63616c6c 7920636f 70696564 0a696e20 cally copied.in \n- 0x00bcf950 62792064 65666175 6c742e20 20526573 by default. Res\n- 0x00bcf960 6f757263 6520696e 7374616c 6c617469 ource installati\n- 0x00bcf970 6f6e202a 6f6e6c79 2a206861 7070656e on *only* happen\n- 0x00bcf980 73207768 656e2074 68652060 736e6170 s when the `snap\n- 0x00bcf990 6c657473 2f666f6f 600a6469 72656374 lets/foo`.direct\n- 0x00bcf9a0 6f727920 646f6573 206e6f74 20657869 ory does not exi\n- 0x00bcf9b0 73742e20 20496620 796f7520 77616e74 st. If you want\n- 0x00bcf9c0 20746f20 67657420 74686520 6c617465 to get the late\n- 0x00bcf9d0 73742076 65727369 6f6e206f 66207468 st version of th\n- 0x00bcf9e0 650a6669 6c657379 7374656d 20726573 e.filesystem res\n- 0x00bcf9f0 6f757263 65732c20 72656d6f 76652074 ources, remove t\n- 0x00bcfa00 68652060 736e6170 6c657473 2f666f6f he `snaplets/foo\n- 0x00bcfa10 60206469 72656374 6f72792c 20616e64 ` directory, and\n- 0x00bcfa20 20726573 74617274 20796f75 720a6170 restart your.ap\n- 0x00bcfa30 702e0a00 2e2f7372 632f5475 746f7269 p..../src/Tutori\n- 0x00bcfa40 616c2e6c 6873003e 207b2d23 204c414e al.lhs.> {-# LAN\n- 0x00bcfa50 47554147 45204f76 65726c6f 61646564 GUAGE Overloaded\n- 0x00bcfa60 53747269 6e677320 232d7d0a 3e206d6f Strings #-}.> mo\n- 0x00bcfa70 64756c65 20506172 74322077 68657265 dule Part2 where\n- 0x00bcfa80 0a0a3e20 696d706f 72742020 20202020 ..> import \n- 0x00bcfa90 20202020 20536e61 702e536e 61706c65 Snap.Snaple\n- 0x00bcfaa0 740a0a3e 20646174 6120466f 6f203d20 t..> data Foo = \n- 0x00bcfab0 466f6f0a 3e0a3e20 64617461 20426172 Foo.>.> data Bar\n- 0x00bcfac0 203d2042 61720a3e 0a3e2066 6f6f496e = Bar.>.> fooIn\n- 0x00bcfad0 6974203a 3a20536e 61706c65 74496e69 it :: SnapletIni\n- 0x00bcfae0 74206220 466f6f0a 3e20666f 6f496e69 t b Foo.> fooIni\n- 0x00bcfaf0 74203d20 6d616b65 536e6170 6c657420 t = makeSnaplet \n- 0x00bcfb00 22666f6f 22202246 6f6f2073 6e61706c \"foo\" \"Foo snapl\n- 0x00bcfb10 65742220 4e6f7468 696e6720 2420646f et\" Nothing $ do\n- 0x00bcfb20 0a3e2020 20202072 65747572 6e20466f .> return Fo\n- 0x00bcfb30 6f0a3e0a 3e206261 72496e69 74203a3a o.>.> barInit ::\n- 0x00bcfb40 20536e61 706c6574 4c656e73 20622046 SnapletLens b F\n- 0x00bcfb50 6f6f202d 3e20536e 61706c65 74496e69 oo -> SnapletIni\n- 0x00bcfb60 74206220 4261720a 3e206261 72496e69 t b Bar.> barIni\n- 0x00bcfb70 74205f68 203d206d 616b6553 6e61706c t _h = makeSnapl\n- 0x00bcfb80 65742022 62617222 20224261 7220736e et \"bar\" \"Bar sn\n- 0x00bcfb90 61706c65 7422204e 6f746869 6e672024 aplet\" Nothing $\n- 0x00bcfba0 20646f0a 3e202020 20207265 7475726e do.> return\n- 0x00bcfbb0 20426172 0a002e2f 7372632f 50617274 Bar.../src/Part\n- 0x00bcfbc0 322e6c68 73004e61 6d653a20 20202020 2.lhs.Name: \n+ 0x00bcb700 72746572 003e207b 2d23204c 414e4755 rter.> {-# LANGU\n+ 0x00bcb710 41474520 4f766572 6c6f6164 65645374 AGE OverloadedSt\n+ 0x00bcb720 72696e67 7320232d 7d0a3e20 6d6f6475 rings #-}.> modu\n+ 0x00bcb730 6c652050 61727432 20776865 72650a0a le Part2 where..\n+ 0x00bcb740 3e20696d 706f7274 20202020 20202020 > import \n+ 0x00bcb750 20202053 6e61702e 536e6170 6c65740a Snap.Snaplet.\n+ 0x00bcb760 0a3e2064 61746120 466f6f20 3d20466f .> data Foo = Fo\n+ 0x00bcb770 6f0a3e0a 3e206461 74612042 6172203d o.>.> data Bar =\n+ 0x00bcb780 20426172 0a3e0a3e 20666f6f 496e6974 Bar.>.> fooInit\n+ 0x00bcb790 203a3a20 536e6170 6c657449 6e697420 :: SnapletInit \n+ 0x00bcb7a0 6220466f 6f0a3e20 666f6f49 6e697420 b Foo.> fooInit \n+ 0x00bcb7b0 3d206d61 6b65536e 61706c65 74202266 = makeSnaplet \"f\n+ 0x00bcb7c0 6f6f2220 22466f6f 20736e61 706c6574 oo\" \"Foo snaplet\n+ 0x00bcb7d0 22204e6f 7468696e 67202420 646f0a3e \" Nothing $ do.>\n+ 0x00bcb7e0 20202020 20726574 75726e20 466f6f0a return Foo.\n+ 0x00bcb7f0 3e0a3e20 62617249 6e697420 3a3a2053 >.> barInit :: S\n+ 0x00bcb800 6e61706c 65744c65 6e732062 20466f6f napletLens b Foo\n+ 0x00bcb810 202d3e20 536e6170 6c657449 6e697420 -> SnapletInit \n+ 0x00bcb820 62204261 720a3e20 62617249 6e697420 b Bar.> barInit \n+ 0x00bcb830 5f68203d 206d616b 65536e61 706c6574 _h = makeSnaplet\n+ 0x00bcb840 20226261 72222022 42617220 736e6170 \"bar\" \"Bar snap\n+ 0x00bcb850 6c657422 204e6f74 68696e67 20242064 let\" Nothing $ d\n+ 0x00bcb860 6f0a3e20 20202020 72657475 726e2042 o.> return B\n+ 0x00bcb870 61720a00 2e2f7372 632f5061 7274322e ar.../src/Part2.\n+ 0x00bcb880 6c687300 57686174 20417265 20536e61 lhs.What Are Sna\n+ 0x00bcb890 706c6574 733f0a3d 3d3d3d3d 3d3d3d3d plets?.=========\n+ 0x00bcb8a0 3d3d3d3d 3d3d3d3d 3d0a0a41 20736e61 =========..A sna\n+ 0x00bcb8b0 706c6574 20697320 6120636f 6d706f73 plet is a compos\n+ 0x00bcb8c0 61626c65 20776562 20617070 6c696361 able web applica\n+ 0x00bcb8d0 74696f6e 2e202053 6e61706c 65747320 tion. Snaplets \n+ 0x00bcb8e0 616c6c6f 7720796f 7520746f 20627569 allow you to bui\n+ 0x00bcb8f0 6c640a73 656c662d 636f6e74 61696e65 ld.self-containe\n+ 0x00bcb900 64207069 65636573 206f6620 66756e63 d pieces of func\n+ 0x00bcb910 74696f6e 616c6974 7920616e 6420676c tionality and gl\n+ 0x00bcb920 75652074 68656d20 746f6765 74686572 ue them together\n+ 0x00bcb930 20746f20 6d616b65 206c6172 6765720a to make larger.\n+ 0x00bcb940 6170706c 69636174 696f6e73 2e202048 applications. H\n+ 0x00bcb950 65726520 61726520 736f6d65 206f6620 ere are some of \n+ 0x00bcb960 74686520 7468696e 67732070 726f7669 the things provi\n+ 0x00bcb970 64656420 62792074 68652073 6e61706c ded by the snapl\n+ 0x00bcb980 65742041 50493a0a 0a20202d 20496e66 et API:.. - Inf\n+ 0x00bcb990 72617374 72756374 75726520 666f7220 rastructure for \n+ 0x00bcb9a0 6170706c 69636174 696f6e20 73746174 application stat\n+ 0x00bcb9b0 652f656e 7669726f 6e6d656e 740a0a20 e/environment.. \n+ 0x00bcb9c0 202d2053 6e61706c 65742069 6e697469 - Snaplet initi\n+ 0x00bcb9d0 616c697a 6174696f 6e2c2072 656c6f61 alization, reloa\n+ 0x00bcb9e0 642c2061 6e642063 6c65616e 75700a0a d, and cleanup..\n+ 0x00bcb9f0 20202d20 4d616e61 67656d65 6e74206f - Management o\n+ 0x00bcba00 66206669 6c657379 7374656d 20646174 f filesystem dat\n+ 0x00bcba10 6120616e 64206175 746f6d61 74696320 a and automatic \n+ 0x00bcba20 736e6170 6c657420 696e7374 616c6c61 snaplet installa\n+ 0x00bcba30 74696f6e 0a0a2020 2d20556e 69666965 tion.. - Unifie\n+ 0x00bcba40 6420636f 6e666967 2066696c 6520696e d config file in\n+ 0x00bcba50 66726173 74727563 74757265 0a0a4f6e frastructure..On\n+ 0x00bcba60 65206578 616d706c 65206d69 67687420 e example might \n+ 0x00bcba70 62652061 2077696b 6920736e 61706c65 be a wiki snaple\n+ 0x00bcba80 742e2020 49742077 6f756c64 20626520 t. It would be \n+ 0x00bcba90 64697374 72696275 74656420 61732061 distributed as a\n+ 0x00bcbaa0 20686173 6b656c6c 0a706163 6b616765 haskell.package\n+ 0x00bcbab0 20746861 7420776f 756c6420 62652069 that would be i\n+ 0x00bcbac0 6e737461 6c6c6564 20776974 68206361 nstalled with ca\n+ 0x00bcbad0 62616c20 616e6420 776f756c 64207072 bal and would pr\n+ 0x00bcbae0 6f626162 6c792069 6e636c75 64652063 obably include c\n+ 0x00bcbaf0 6f64652c 0a636f6e 66696720 66696c65 ode,.config file\n+ 0x00bcbb00 732c2048 544d4c20 74656d70 6c617465 s, HTML template\n+ 0x00bcbb10 732c2073 74796c65 73686565 74732c20 s, stylesheets, \n+ 0x00bcbb20 4a617661 53637269 70742c20 696d6167 JavaScript, imag\n+ 0x00bcbb30 65732c20 6574632e 20205468 650a736e es, etc. The.sn\n+ 0x00bcbb40 61706c65 74277320 636f6465 20776f75 aplet's code wou\n+ 0x00bcbb50 6c642070 726f7669 64652074 6865206e ld provide the n\n+ 0x00bcbb60 65636573 73617279 20415049 20746f20 ecessary API to \n+ 0x00bcbb70 6c657420 796f7572 20617070 6c696361 let your applica\n+ 0x00bcbb80 74696f6e 0a696e74 65726163 74207365 tion.interact se\n+ 0x00bcbb90 616d6c65 73736c79 20776974 68207468 amlessly with th\n+ 0x00bcbba0 65207769 6b692066 756e6374 696f6e61 e wiki functiona\n+ 0x00bcbbb0 6c697479 2e202057 68656e20 796f7520 lity. When you \n+ 0x00bcbbc0 72756e20 796f7572 0a617070 6c696361 run your.applica\n+ 0x00bcbbd0 74696f6e 20666f72 20746865 20666972 tion for the fir\n+ 0x00bcbbe0 73742074 696d652c 20616c6c 206f6620 st time, all of \n+ 0x00bcbbf0 74686520 77696b69 20736e61 706c6574 the wiki snaplet\n+ 0x00bcbc00 27732066 696c6573 79737465 6d207265 's filesystem re\n+ 0x00bcbc10 736f7572 6365730a 77696c6c 20617574 sources.will aut\n+ 0x00bcbc20 6f6d6174 6963616c 6c792062 6520636f omatically be co\n+ 0x00bcbc30 70696564 20696e74 6f207468 65206170 pied into the ap\n+ 0x00bcbc40 70726f70 72696174 6520706c 61636573 propriate places\n+ 0x00bcbc50 2e202054 68656e20 796f7520 77696c6c . Then you will\n+ 0x00bcbc60 0a696d6d 65646961 74656c79 20626520 .immediately be \n+ 0x00bcbc70 61626c65 20746f20 63757374 6f6d697a able to customiz\n+ 0x00bcbc80 65207468 65207769 6b692074 6f206669 e the wiki to fi\n+ 0x00bcbc90 7420796f 7572206e 65656473 20627920 t your needs by \n+ 0x00bcbca0 65646974 696e6720 636f6e66 69670a66 editing config.f\n+ 0x00bcbcb0 696c6573 2c207072 6f766964 696e6720 iles, providing \n+ 0x00bcbcc0 796f7572 206f776e 20737479 6c657368 your own stylesh\n+ 0x00bcbcd0 65657473 2c206574 632e2020 57652077 eets, etc. We w\n+ 0x00bcbce0 696c6c20 64697363 75737320 74686973 ill discuss this\n+ 0x00bcbcf0 20696e20 6d6f7265 0a646574 61696c20 in more.detail \n+ 0x00bcbd00 6c617465 722e0a0a 4120736e 61706c65 later...A snaple\n+ 0x00bcbd10 74206361 6e207265 70726573 656e7420 t can represent \n+ 0x00bcbd20 616e7974 68696e67 2066726f 6d206261 anything from ba\n+ 0x00bcbd30 636b656e 64204861 736b656c 6c20696e ckend Haskell in\n+ 0x00bcbd40 66726173 74727563 74757265 20776974 frastructure wit\n+ 0x00bcbd50 68206e6f 0a757365 72206661 63696e67 h no.user facing\n+ 0x00bcbd60 2066756e 6374696f 6e616c69 74792074 functionality t\n+ 0x00bcbd70 6f206120 736d616c 6c207769 64676574 o a small widget\n+ 0x00bcbd80 206c696b 65206120 63686174 20626f78 like a chat box\n+ 0x00bcbd90 20746861 7420676f 65732069 6e207468 that goes in th\n+ 0x00bcbda0 650a636f 726e6572 206f6620 61207765 e.corner of a we\n+ 0x00bcbdb0 62207061 67652074 6f20616e 20656e74 b page to an ent\n+ 0x00bcbdc0 69726520 7374616e 64616c6f 6e652077 ire standalone w\n+ 0x00bcbdd0 65627369 7465206c 696b6520 6120626c ebsite like a bl\n+ 0x00bcbde0 6f67206f 7220666f 72756d2e 0a546865 og or forum..The\n+ 0x00bcbdf0 20706f73 73696269 6c697469 65732061 possibilities a\n+ 0x00bcbe00 72652065 6e646c65 73732e20 20412073 re endless. A s\n+ 0x00bcbe10 6e61706c 65742069 73206120 77656220 naplet is a web \n+ 0x00bcbe20 6170706c 69636174 696f6e2c 20616e64 application, and\n+ 0x00bcbe30 20776562 0a617070 6c696361 74696f6e web.application\n+ 0x00bcbe40 73206172 6520736e 61706c65 74732e20 s are snaplets. \n+ 0x00bcbe50 20546869 73206d65 616e7320 74686174 This means that\n+ 0x00bcbe60 20757369 6e672073 6e61706c 65747320 using snaplets \n+ 0x00bcbe70 616e6420 77726974 696e670a 736e6170 and writing.snap\n+ 0x00bcbe80 6c657473 20617265 20616c6d 6f737420 lets are almost \n+ 0x00bcbe90 74686520 73616d65 20746869 6e672c20 the same thing, \n+ 0x00bcbea0 616e6420 69742773 20747269 7669616c and it's trivial\n+ 0x00bcbeb0 20746f20 64726f70 20612077 686f6c65 to drop a whole\n+ 0x00bcbec0 20776562 73697465 0a696e74 6f20616e website.into an\n+ 0x00bcbed0 6f746865 72206f6e 652e0a0a 57652772 other one...We'r\n+ 0x00bcbee0 65207265 616c6c79 20657863 69746564 e really excited\n+ 0x00bcbef0 2061626f 75742074 68652070 6f737369 about the possi\n+ 0x00bcbf00 62696c69 74696573 20617661 696c6162 bilities availab\n+ 0x00bcbf10 6c652077 69746820 736e6170 6c657473 le with snaplets\n+ 0x00bcbf20 2e202049 6e0a6661 63742c20 536e6170 . In.fact, Snap\n+ 0x00bcbf30 20616c72 65616479 20736869 70732077 already ships w\n+ 0x00bcbf40 69746820 736e6170 6c657473 20666f72 ith snaplets for\n+ 0x00bcbf50 20736573 73696f6e 732c2061 75746865 sessions, authe\n+ 0x00bcbf60 6e746963 6174696f 6e2c2061 6e640a74 ntication, and.t\n+ 0x00bcbf70 656d706c 6174696e 67202877 69746820 emplating (with \n+ 0x00bcbf80 48656973 74292c20 20546869 73206769 Heist), This gi\n+ 0x00bcbf90 76657320 796f7520 75736566 756c2066 ves you useful f\n+ 0x00bcbfa0 756e6374 696f6e61 6c697479 206f7574 unctionality out\n+ 0x00bcbfb0 206f6620 74686520 626f782c 0a616e64 of the box,.and\n+ 0x00bcbfc0 206a756d 70207374 61727473 20796f75 jump starts you\n+ 0x00bcbfd0 72206f77 6e20736e 61706c65 74206465 r own snaplet de\n+ 0x00bcbfe0 76656c6f 706d656e 74206279 2064656d velopment by dem\n+ 0x00bcbff0 6f6e7374 72617469 6e672073 6f6d6520 onstrating some \n+ 0x00bcc000 75736566 756c0a64 65736967 6e207061 useful.design pa\n+ 0x00bcc010 74746572 6e732e20 20536f20 77697468 tterns. So with\n+ 0x00bcc020 6f757420 66757274 68657220 61646f2c out further ado,\n+ 0x00bcc030 206c6574 27732067 65742073 74617274 let's get start\n+ 0x00bcc040 65642e0a 0a536e61 706c6574 204f7665 ed...Snaplet Ove\n+ 0x00bcc050 72766965 770a3d3d 3d3d3d3d 3d3d3d3d rview.==========\n+ 0x00bcc060 3d3d3d3d 3d3d0a0a 54686520 68656172 ======..The hear\n+ 0x00bcc070 74206f66 20746865 20736e61 706c6574 t of the snaplet\n+ 0x00bcc080 7320696e 66726173 74727563 74757265 s infrastructure\n+ 0x00bcc090 20697320 73746174 65206d61 6e616765 is state manage\n+ 0x00bcc0a0 6d656e74 2e20204d 6f737420 6e6f6e74 ment. Most nont\n+ 0x00bcc0b0 72697669 616c0a70 69656365 73206f66 rivial.pieces of\n+ 0x00bcc0c0 20612077 65622061 7070206e 65656420 a web app need \n+ 0x00bcc0d0 736f6d65 206b696e 64206f66 20737461 some kind of sta\n+ 0x00bcc0e0 7465206f 7220656e 7669726f 6e6d656e te or environmen\n+ 0x00bcc0f0 74206461 74612e20 20436f6d 706f6e65 t data. Compone\n+ 0x00bcc100 6e74730a 74686174 20646f20 6e6f7420 nts.that do not \n+ 0x00bcc110 6e656564 20616e79 206b696e 64206f66 need any kind of\n+ 0x00bcc120 20737461 7465206f 7220656e 7669726f state or enviro\n+ 0x00bcc130 6e6d656e 74206172 65207072 6f626162 nment are probab\n+ 0x00bcc140 6c79206d 6f72650a 61707072 6f707269 ly more.appropri\n+ 0x00bcc150 61746520 61732061 20737461 6e64616c ate as a standal\n+ 0x00bcc160 6f6e6520 6c696272 61727920 7468616e one library than\n+ 0x00bcc170 20617320 6120736e 61706c65 742e0a0a as a snaplet...\n+ 0x00bcc180 4265666f 72652077 6520636f 6e74696e Before we contin\n+ 0x00bcc190 75652c20 7765206d 75737420 636c6172 ue, we must clar\n+ 0x00bcc1a0 69667920 616e2069 6d706f72 74616e74 ify an important\n+ 0x00bcc1b0 20706f69 6e742e20 20546865 20536e61 point. The Sna\n+ 0x00bcc1c0 70207765 62207365 72766572 0a70726f p web server.pro\n+ 0x00bcc1d0 63657373 65732065 61636820 72657175 cesses each requ\n+ 0x00bcc1e0 65737420 696e2069 7473206f 776e2067 est in its own g\n+ 0x00bcc1f0 7265656e 20746872 6561642e 20205468 reen thread. Th\n+ 0x00bcc200 6973206d 65616e73 20746861 74206561 is means that ea\n+ 0x00bcc210 63682072 65717565 73740a77 696c6c20 ch request.will \n+ 0x00bcc220 72656365 69766520 61207365 70617261 receive a separa\n+ 0x00bcc230 74652063 6f707920 6f662074 68652073 te copy of the s\n+ 0x00bcc240 74617465 20646566 696e6564 20627920 tate defined by \n+ 0x00bcc250 796f7572 20617070 6c696361 74696f6e your application\n+ 0x00bcc260 20616e64 0a736e61 706c6574 732c2061 and.snaplets, a\n+ 0x00bcc270 6e64206d 6f646966 69636174 696f6e73 nd modifications\n+ 0x00bcc280 20746f20 74686174 20737461 7465206f to that state o\n+ 0x00bcc290 6e6c7920 61666665 63742074 6865206c nly affect the l\n+ 0x00bcc2a0 6f63616c 20746872 65616420 74686174 ocal thread that\n+ 0x00bcc2b0 0a67656e 65726174 65732061 2073696e .generates a sin\n+ 0x00bcc2c0 676c6520 72657370 6f6e7365 2e202046 gle response. F\n+ 0x00bcc2d0 726f6d20 6e6f7720 6f6e2c20 7768656e rom now on, when\n+ 0x00bcc2e0 20776520 74616c6b 2061626f 75742073 we talk about s\n+ 0x00bcc2f0 74617465 20746869 73206973 0a776861 tate this is.wha\n+ 0x00bcc300 74207765 20617265 2074616c 6b696e67 t we are talking\n+ 0x00bcc310 2061626f 75742e20 20496620 796f7520 about. If you \n+ 0x00bcc320 6e656564 20676c6f 62616c20 6170706c need global appl\n+ 0x00bcc330 69636174 696f6e20 73746174 652c2079 ication state, y\n+ 0x00bcc340 6f752068 61766520 746f0a75 73652061 ou have to.use a\n+ 0x00bcc350 20746872 6561642d 73616665 20636f6e thread-safe con\n+ 0x00bcc360 73747275 63742073 75636820 61732061 struct such as a\n+ 0x00bcc370 6e204d56 6172206f 7220494f 5265662e n MVar or IORef.\n+ 0x00bcc380 0a0a5468 69732070 6f737420 69732077 ..This post is w\n+ 0x00bcc390 72697474 656e2069 6e206c69 74657261 ritten in litera\n+ 0x00bcc3a0 74652048 61736b65 6c6c2e20 20497420 te Haskell. It \n+ 0x00bcc3b0 75736573 20612073 6d616c6c 20657874 uses a small ext\n+ 0x00bcc3c0 65726e61 6c206d6f 64756c65 0a63616c ernal module.cal\n+ 0x00bcc3d0 6c656420 50617274 32207468 61742069 led Part2 that i\n+ 0x00bcc3e0 73205b61 7661696c 61626c65 0a686572 s [available.her\n+ 0x00bcc3f0 655d2868 74747073 3a2f2f67 69746875 e](https://githu\n+ 0x00bcc400 622e636f 6d2f736e 61706672 616d6577 b.com/snapframew\n+ 0x00bcc410 6f726b2f 736e6170 2d74656d 706c6174 ork/snap-templat\n+ 0x00bcc420 65732f62 6c6f622f 6d617374 65722f70 es/blob/master/p\n+ 0x00bcc430 726f6a65 63745f74 656d706c 6174652f roject_template/\n+ 0x00bcc440 7475746f 7269616c 2f737263 2f506172 tutorial/src/Par\n+ 0x00bcc450 74322e6c 6873292e 0a596f75 2063616e t2.lhs)..You can\n+ 0x00bcc460 20616c73 6f20696e 7374616c 6c207468 also install th\n+ 0x00bcc470 65206675 6c6c2063 6f646520 696e2074 e full code in t\n+ 0x00bcc480 68652063 75727265 6e742064 69726563 he current direc\n+ 0x00bcc490 746f7279 20776974 68207468 6520636f tory with the co\n+ 0x00bcc4a0 6d6d616e 640a6073 6e617020 696e6974 mmand.`snap init\n+ 0x00bcc4b0 20747574 6f726961 6c602e20 20466972 tutorial`. Fir\n+ 0x00bcc4c0 73742077 65206e65 65642074 6f206765 st we need to ge\n+ 0x00bcc4d0 7420696d 706f7274 73206f75 74206f66 t imports out of\n+ 0x00bcc4e0 20746865 20776179 2e0a0a3e 207b2d23 the way...> {-#\n+ 0x00bcc4f0 204c414e 47554147 45205465 6d706c61 LANGUAGE Templa\n+ 0x00bcc500 74654861 736b656c 6c20232d 7d0a3e20 teHaskell #-}.> \n+ 0x00bcc510 7b2d2320 4c414e47 55414745 204f7665 {-# LANGUAGE Ove\n+ 0x00bcc520 726c6f61 64656453 7472696e 67732023 rloadedStrings #\n+ 0x00bcc530 2d7d0a3e 0a3e206d 6f64756c 65204d61 -}.>.> module Ma\n+ 0x00bcc540 696e2077 68657265 0a3e0a3e 20696d70 in where.>.> imp\n+ 0x00bcc550 6f727420 20202020 20202020 2020436f ort Co\n+ 0x00bcc560 6e74726f 6c2e4170 706c6963 61746976 ntrol.Applicativ\n+ 0x00bcc570 65202828 3c7c3e29 290a3e20 696d706f e ((<|>)).> impo\n+ 0x00bcc580 72742020 20202020 20202020 20436f6e rt Con\n+ 0x00bcc590 74726f6c 2e4c656e 732e5448 0a3e2069 trol.Lens.TH.> i\n+ 0x00bcc5a0 6d706f72 74202020 20202020 20202020 mport \n+ 0x00bcc5b0 436f6e74 726f6c2e 4d6f6e61 642e494f Control.Monad.IO\n+ 0x00bcc5c0 2e436c61 73732028 6c696674 494f290a .Class (liftIO).\n+ 0x00bcc5d0 3e20696d 706f7274 20202020 20202020 > import \n+ 0x00bcc5e0 20202043 6f6e7472 6f6c2e4d 6f6e6164 Control.Monad\n+ 0x00bcc5f0 2e537461 74652e43 6c617373 20286765 .State.Class (ge\n+ 0x00bcc600 7473290a 3e20696d 706f7274 20202020 ts).> import \n+ 0x00bcc610 20202020 20202044 6174612e 494f5265 Data.IORe\n+ 0x00bcc620 660a3e20 696d706f 72742071 75616c69 f.> import quali\n+ 0x00bcc630 66696564 20446174 612e4279 74655374 fied Data.ByteSt\n+ 0x00bcc640 72696e67 2e436861 72382061 7320420a ring.Char8 as B.\n+ 0x00bcc650 3e20696d 706f7274 20202020 20202020 > import \n+ 0x00bcc660 20202044 6174612e 4d617962 650a3e20 Data.Maybe.> \n+ 0x00bcc670 696d706f 72742020 20202020 20202020 import \n+ 0x00bcc680 20536e61 700a3e20 696d706f 72742020 Snap.> import \n+ 0x00bcc690 20202020 20202020 20536e61 702e536e Snap.Sn\n+ 0x00bcc6a0 61706c65 742e4865 6973740a 3e20696d aplet.Heist.> im\n+ 0x00bcc6b0 706f7274 20202020 20202020 20202050 port P\n+ 0x00bcc6c0 61727432 0a0a5765 20737461 7274206f art2..We start o\n+ 0x00bcc6d0 75722061 70706c69 63617469 6f6e2062 ur application b\n+ 0x00bcc6e0 79206465 66696e69 6e672061 20646174 y defining a dat\n+ 0x00bcc6f0 61207374 72756374 75726520 746f2068 a structure to h\n+ 0x00bcc700 6f6c6420 74686520 73746174 652e2020 old the state. \n+ 0x00bcc710 54686973 0a646174 61207374 72756374 This.data struct\n+ 0x00bcc720 75726520 696e636c 75646573 20746865 ure includes the\n+ 0x00bcc730 20737461 7465206f 6620616c 6c20736e state of all sn\n+ 0x00bcc740 61706c65 74732028 77726170 70656420 aplets (wrapped \n+ 0x00bcc750 696e2061 20536e61 706c6574 29207573 in a Snaplet) us\n+ 0x00bcc760 65640a62 79206f75 72206170 706c6963 ed.by our applic\n+ 0x00bcc770 6174696f 6e206173 2077656c 6c206173 ation as well as\n+ 0x00bcc780 20616e79 206f7468 65722073 74617465 any other state\n+ 0x00bcc790 20776520 6d696768 74207761 6e742e0a we might want..\n+ 0x00bcc7a0 0a3e2064 61746120 41707020 3d204170 .> data App = Ap\n+ 0x00bcc7b0 700a3e20 20202020 7b205f68 65697374 p.> { _heist\n+ 0x00bcc7c0 20202020 2020203a 3a20536e 61706c65 :: Snaple\n+ 0x00bcc7d0 74202848 65697374 20417070 290a3e20 t (Heist App).> \n+ 0x00bcc7e0 20202020 2c205f66 6f6f2020 20202020 , _foo \n+ 0x00bcc7f0 2020203a 3a20536e 61706c65 7420466f :: Snaplet Fo\n+ 0x00bcc800 6f0a3e20 20202020 2c205f62 61722020 o.> , _bar \n+ 0x00bcc810 20202020 2020203a 3a20536e 61706c65 :: Snaple\n+ 0x00bcc820 74204261 720a3e20 20202020 2c205f63 t Bar.> , _c\n+ 0x00bcc830 6f6d7061 6e794e61 6d65203a 3a20494f ompanyName :: IO\n+ 0x00bcc840 52656620 422e4279 74655374 72696e67 Ref B.ByteString\n+ 0x00bcc850 0a3e2020 2020207d 0a3e0a3e 206d616b .> }.>.> mak\n+ 0x00bcc860 654c656e 73657320 27274170 700a0a54 eLenses ''App..T\n+ 0x00bcc870 68652066 69656c64 206e616d 65732062 he field names b\n+ 0x00bcc880 6567696e 20776974 6820616e 20756e64 egin with an und\n+ 0x00bcc890 65727363 6f726520 62656361 75736520 erscore because \n+ 0x00bcc8a0 6f662073 6f6d6520 6d6f7265 20636f6d of some more com\n+ 0x00bcc8b0 706c6963 61746564 0a746869 6e677320 plicated.things \n+ 0x00bcc8c0 676f696e 67206f6e 20756e64 65722074 going on under t\n+ 0x00bcc8d0 68652068 6f6f642e 2020486f 77657665 he hood. Howeve\n+ 0x00bcc8e0 722c2061 6c6c2079 6f75206e 65656420 r, all you need \n+ 0x00bcc8f0 746f206b 6e6f7720 72696768 74206e6f to know right no\n+ 0x00bcc900 77206973 0a746861 7420796f 75207368 w is.that you sh\n+ 0x00bcc910 6f756c64 20707265 66697820 7468696e ould prefix thin\n+ 0x00bcc920 67732077 69746820 616e2075 6e646572 gs with an under\n+ 0x00bcc930 73636f72 6520616e 64207468 656e2063 score and then c\n+ 0x00bcc940 616c6c20 606d616b 654c656e 73657360 all `makeLenses`\n+ 0x00bcc950 2e0a5468 6973206c 65747320 796f7520 ..This lets you \n+ 0x00bcc960 75736520 74686520 6e616d65 73207769 use the names wi\n+ 0x00bcc970 74686f75 7420616e 20756e64 65727363 thout an undersc\n+ 0x00bcc980 6f726520 696e2074 68652072 65737420 ore in the rest \n+ 0x00bcc990 6f662079 6f75720a 6170706c 69636174 of your.applicat\n+ 0x00bcc9a0 696f6e2e 0a0a5468 65206e65 78742074 ion...The next t\n+ 0x00bcc9b0 68696e67 20776520 6e656564 20746f20 hing we need to \n+ 0x00bcc9c0 646f2069 73206465 66696e65 20616e20 do is define an \n+ 0x00bcc9d0 696e6974 69616c69 7a65722e 0a0a3e20 initializer...> \n+ 0x00bcc9e0 61707049 6e697420 3a3a2053 6e61706c appInit :: Snapl\n+ 0x00bcc9f0 6574496e 69742041 70702041 70700a3e etInit App App.>\n+ 0x00bcca00 20617070 496e6974 203d206d 616b6553 appInit = makeS\n+ 0x00bcca10 6e61706c 65742022 6d796170 70222022 naplet \"myapp\" \"\n+ 0x00bcca20 4d792065 78616d70 6c652061 70706c69 My example appli\n+ 0x00bcca30 63617469 6f6e2220 4e6f7468 696e6720 cation\" Nothing \n+ 0x00bcca40 2420646f 0a3e2020 20202068 73203c2d $ do.> hs <-\n+ 0x00bcca50 206e6573 74536e61 706c6574 20226865 nestSnaplet \"he\n+ 0x00bcca60 69737422 20686569 73742024 20686569 ist\" heist $ hei\n+ 0x00bcca70 7374496e 69742022 74656d70 6c617465 stInit \"template\n+ 0x00bcca80 73220a3e 20202020 20667320 3c2d206e s\".> fs <- n\n+ 0x00bcca90 65737453 6e61706c 65742022 666f6f22 estSnaplet \"foo\"\n+ 0x00bccaa0 20666f6f 20242066 6f6f496e 69740a3e foo $ fooInit.>\n+ 0x00bccab0 20202020 20627320 3c2d206e 65737453 bs <- nestS\n+ 0x00bccac0 6e61706c 65742022 22206261 72202420 naplet \"\" bar $ \n+ 0x00bccad0 6e616d65 536e6170 6c657420 226e6577 nameSnaplet \"new\n+ 0x00bccae0 6e616d65 22202420 62617249 6e697420 name\" $ barInit \n+ 0x00bccaf0 666f6f0a 3e202020 20206164 64526f75 foo.> addRou\n+ 0x00bccb00 74657320 5b202822 68656c6c 6f222c20 tes [ (\"hello\", \n+ 0x00bccb10 77726974 65546578 74202268 656c6c6f writeText \"hello\n+ 0x00bccb20 20776f72 6c642229 0a3e2020 20202020 world\").> \n+ 0x00bccb30 20202020 20202020 202c2028 22666f6f , (\"foo\n+ 0x00bccb40 6e616d65 222c2077 69746820 666f6f20 name\", with foo \n+ 0x00bccb50 6e616d65 50616765 290a3e20 20202020 namePage).> \n+ 0x00bccb60 20202020 20202020 20202c20 28226261 , (\"ba\n+ 0x00bccb70 726e616d 65222c20 77697468 20626172 rname\", with bar\n+ 0x00bccb80 206e616d 65506167 65290a3e 20202020 namePage).> \n+ 0x00bccb90 20202020 20202020 2020202c 20282263 , (\"c\n+ 0x00bccba0 6f6d7061 6e79222c 20636f6d 70616e79 ompany\", company\n+ 0x00bccbb0 48616e64 6c657229 0a3e2020 20202020 Handler).> \n+ 0x00bccbc0 20202020 20202020 205d0a3e 20202020 ].> \n+ 0x00bccbd0 20777261 70536974 6520283c 7c3e2068 wrapSite (<|> h\n+ 0x00bccbe0 65697374 53657276 65290a3e 20202020 eistServe).> \n+ 0x00bccbf0 20726566 203c2d20 6c696674 494f2024 ref <- liftIO $\n+ 0x00bccc00 206e6577 494f5265 66202266 6f6f436f newIORef \"fooCo\n+ 0x00bccc10 7270220a 3e202020 20207265 7475726e rp\".> return\n+ 0x00bccc20 20242041 70702068 73206673 20627320 $ App hs fs bs \n+ 0x00bccc30 7265660a 0a466f72 206e6f77 20646f6e ref..For now don\n+ 0x00bccc40 27742077 6f727279 2061626f 75742061 't worry about a\n+ 0x00bccc50 6c6c2074 68652064 65746169 6c73206f ll the details o\n+ 0x00bccc60 66207468 69732063 6f64652e 20205765 f this code. We\n+ 0x00bccc70 276c6c20 776f726b 20746872 6f756768 'll work through\n+ 0x00bccc80 20746865 0a696e64 69766964 75616c20 the.individual \n+ 0x00bccc90 70696563 6573206f 6e652061 74206120 pieces one at a \n+ 0x00bccca0 74696d65 2e202054 68652062 61736963 time. The basic\n+ 0x00bcccb0 20696465 61206865 72652069 73207468 idea here is th\n+ 0x00bcccc0 61742074 6f20696e 69746961 6c697a65 at to initialize\n+ 0x00bcccd0 20616e0a 6170706c 69636174 696f6e2c an.application,\n+ 0x00bccce0 20776520 66697273 7420696e 69746961 we first initia\n+ 0x00bcccf0 6c697a65 20656163 68206f66 20746865 lize each of the\n+ 0x00bccd00 20736e61 706c6574 732c2061 64642073 snaplets, add s\n+ 0x00bccd10 6f6d6520 726f7574 65732c20 72756e20 ome routes, run \n+ 0x00bccd20 610a6675 6e637469 6f6e2077 72617070 a.function wrapp\n+ 0x00bccd30 696e6720 616c6c20 74686520 726f7574 ing all the rout\n+ 0x00bccd40 65732c20 616e6420 72657475 726e2074 es, and return t\n+ 0x00bccd50 68652072 6573756c 74696e67 20737461 he resulting sta\n+ 0x00bccd60 74652064 6174610a 73747275 63747572 te data.structur\n+ 0x00bccd70 652e2020 54686973 20657861 6d706c65 e. This example\n+ 0x00bccd80 2064656d 6f6e7374 72617465 73207468 demonstrates th\n+ 0x00bccd90 65207573 65206f66 20612066 6577206f e use of a few o\n+ 0x00bccda0 66207468 65206d6f 73742063 6f6d6d6f f the most commo\n+ 0x00bccdb0 6e0a736e 61706c65 74206675 6e637469 n.snaplet functi\n+ 0x00bccdc0 6f6e732e 0a0a6e65 7374536e 61706c65 ons...nestSnaple\n+ 0x00bccdd0 740a2d2d 2d2d2d2d 2d2d2d2d 2d0a0a41 t.-----------..A\n+ 0x00bccde0 6c6c2063 616c6c73 20746f20 6368696c ll calls to chil\n+ 0x00bccdf0 6420736e 61706c65 7420696e 69746961 d snaplet initia\n+ 0x00bcce00 6c697a65 72206675 6e637469 6f6e7320 lizer functions \n+ 0x00bcce10 6d757374 20626520 77726170 70656420 must be wrapped \n+ 0x00bcce20 696e2061 2063616c 6c20746f 0a6e6573 in a call to.nes\n+ 0x00bcce30 74536e61 706c6574 2e202054 68652066 tSnaplet. The f\n+ 0x00bcce40 69727374 20706172 616d6574 65722069 irst parameter i\n+ 0x00bcce50 73206120 55524c20 70617468 20736567 s a URL path seg\n+ 0x00bcce60 6d656e74 20746861 74206973 20757365 ment that is use\n+ 0x00bcce70 6420746f 20707265 6669780a 616c6c20 d to prefix.all \n+ 0x00bcce80 726f7574 65732064 6566696e 65642062 routes defined b\n+ 0x00bcce90 79207468 6520736e 61706c65 742e2020 y the snaplet. \n+ 0x00bccea0 54686973 206c6574 7320796f 7520656e This lets you en\n+ 0x00bcceb0 73757265 20746861 74207468 65726520 sure that there \n+ 0x00bccec0 77696c6c 20626520 6e6f0a70 726f626c will be no.probl\n+ 0x00bcced0 656d7320 77697468 20647570 6c696361 ems with duplica\n+ 0x00bccee0 74652072 6f757465 73206465 66696e65 te routes define\n+ 0x00bccef0 6420696e 20646966 66657265 6e742073 d in different s\n+ 0x00bccf00 6e61706c 6574732e 20204966 20746865 naplets. If the\n+ 0x00bccf10 20666f6f 0a736e61 706c6574 20646566 foo.snaplet def\n+ 0x00bccf20 696e6573 20612072 6f757465 20602f66 ines a route `/f\n+ 0x00bccf30 6f6f7061 6765602c 20746865 6e20696e oopage`, then in\n+ 0x00bccf40 20746865 2061626f 76652065 78616d70 the above examp\n+ 0x00bccf50 6c652c20 74686174 20706167 65207769 le, that page wi\n+ 0x00bccf60 6c6c0a62 65206176 61696c61 626c6520 ll.be available \n+ 0x00bccf70 61742060 2f666f6f 2f666f6f 70616765 at `/foo/foopage\n+ 0x00bccf80 602e2020 536f6d65 74696d65 73207468 `. Sometimes th\n+ 0x00bccf90 6f756768 2c20796f 75206d69 67687420 ough, you might \n+ 0x00bccfa0 77616e74 20612073 6e61706c 65742773 want a snaplet's\n+ 0x00bccfb0 0a726f75 74657320 746f2062 65206176 .routes to be av\n+ 0x00bccfc0 61696c61 626c6520 61742074 68652074 ailable at the t\n+ 0x00bccfd0 6f70206c 6576656c 2e202054 6f20646f op level. To do\n+ 0x00bccfe0 20746861 742c206a 75737420 70617373 that, just pass\n+ 0x00bccff0 20616e20 656d7074 79207374 72696e67 an empty string\n+ 0x00bcd000 0a746f20 6e657374 536e6170 6c657420 .to nestSnaplet \n+ 0x00bcd010 61732073 686f776e 2061626f 76652077 as shown above w\n+ 0x00bcd020 69746820 74686520 62617220 736e6170 ith the bar snap\n+ 0x00bcd030 6c65742e 0a0a496e 206f7572 20657861 let...In our exa\n+ 0x00bcd040 6d706c65 2061626f 76652c20 74686520 mple above, the \n+ 0x00bcd050 62617220 736e6170 6c657420 646f6573 bar snaplet does\n+ 0x00bcd060 20736f6d 65746869 6e672074 68617420 something that \n+ 0x00bcd070 6e656564 7320746f 206b6e6f 77206162 needs to know ab\n+ 0x00bcd080 6f75740a 74686520 666f6f20 736e6170 out.the foo snap\n+ 0x00bcd090 6c65742e 20204d61 79626520 666f6f20 let. Maybe foo \n+ 0x00bcd0a0 69732061 20646174 61626173 6520736e is a database sn\n+ 0x00bcd0b0 61706c65 7420616e 64206261 72207761 aplet and bar wa\n+ 0x00bcd0c0 6e747320 746f2073 746f7265 206f720a nts to store or.\n+ 0x00bcd0d0 72656164 20736f6d 65746869 6e672e20 read something. \n+ 0x00bcd0e0 20496e20 6f726465 7220746f 206d616b In order to mak\n+ 0x00bcd0f0 65207468 61742068 61707065 6e2c2069 e that happen, i\n+ 0x00bcd100 74206e65 65647320 746f2068 61766520 t needs to have \n+ 0x00bcd110 61202268 616e646c 65222074 6f0a7468 a \"handle\" to.th\n+ 0x00bcd120 6520736e 61706c65 742e2020 4f757220 e snaplet. Our \n+ 0x00bcd130 68616e64 6c657320 61726520 77686174 handles are what\n+ 0x00bcd140 65766572 20666965 6c64206e 616d6573 ever field names\n+ 0x00bcd150 20776520 75736564 20696e20 74686520 we used in the \n+ 0x00bcd160 41707020 64617461 0a737472 75637475 App data.structu\n+ 0x00bcd170 7265206d 696e7573 20746865 20696e69 re minus the ini\n+ 0x00bcd180 7469616c 20756e64 65727363 6f726520 tial underscore \n+ 0x00bcd190 63686172 61637465 722e2020 54686579 character. They\n+ 0x00bcd1a0 20617265 20617574 6f6d6174 6963616c are automatical\n+ 0x00bcd1b0 6c790a67 656e6572 61746564 20627920 ly.generated by \n+ 0x00bcd1c0 74686520 606d616b 654c656e 73657360 the `makeLenses`\n+ 0x00bcd1d0 2066756e 6374696f 6e2e2020 466f7220 function. For \n+ 0x00bcd1e0 6e6f7720 69742773 20737566 66696369 now it's suffici\n+ 0x00bcd1f0 656e7420 746f2074 68696e6b 206f660a ent to think of.\n+ 0x00bcd200 7468656d 20617320 61206765 74746572 them as a getter\n+ 0x00bcd210 20616e64 20612073 65747465 7220636f and a setter co\n+ 0x00bcd220 6d62696e 65642028 746f2075 73652061 mbined (to use a\n+ 0x00bcd230 6e204f4f 206d6574 6170686f 72292e0a n OO metaphor)..\n+ 0x00bcd240 0a546865 20736563 6f6e6420 70617261 .The second para\n+ 0x00bcd250 6d657465 7220746f 206e6573 74536e61 meter to nestSna\n+ 0x00bcd260 706c6574 20697320 74686520 6c656e73 plet is the lens\n+ 0x00bcd270 20746f20 74686520 736e6170 6c657420 to the snaplet \n+ 0x00bcd280 796f7527 7265206e 65737469 6e672e0a you're nesting..\n+ 0x00bcd290 496e206f 72646572 20746f20 706c6163 In order to plac\n+ 0x00bcd2a0 65206120 70696563 6520696e 746f2074 e a piece into t\n+ 0x00bcd2b0 68652070 757a7a6c 652c2079 6f75206e he puzzle, you n\n+ 0x00bcd2c0 65656420 746f206b 6e6f7720 77686572 eed to know wher\n+ 0x00bcd2d0 65206974 20676f65 732e0a0a 6e616d65 e it goes...name\n+ 0x00bcd2e0 536e6170 6c65740a 2d2d2d2d 2d2d2d2d Snaplet.--------\n+ 0x00bcd2f0 2d2d2d0a 0a546865 20617574 686f7220 ---..The author \n+ 0x00bcd300 6f662061 20736e61 706c6574 20646566 of a snaplet def\n+ 0x00bcd310 696e6573 20612064 65666175 6c74206e ines a default n\n+ 0x00bcd320 616d6520 666f7220 74686520 736e6170 ame for the snap\n+ 0x00bcd330 6c657420 696e2074 68652066 69727374 let in the first\n+ 0x00bcd340 0a617267 756d656e 7420746f 20746865 .argument to the\n+ 0x00bcd350 206d616b 65536e61 706c6574 2066756e makeSnaplet fun\n+ 0x00bcd360 6374696f 6e2e2020 54686973 206e616d ction. This nam\n+ 0x00bcd370 65206973 20757365 6420666f 72207468 e is used for th\n+ 0x00bcd380 6520736e 61706c65 7427730a 64697265 e snaplet's.dire\n+ 0x00bcd390 63746f72 7920696e 20746865 2066696c ctory in the fil\n+ 0x00bcd3a0 65737973 74656d2e 20204966 20796f75 esystem. If you\n+ 0x00bcd3b0 20646f6e 27742077 616e7420 746f2075 don't want to u\n+ 0x00bcd3c0 73652074 68652064 65666175 6c74206e se the default n\n+ 0x00bcd3d0 616d652c 20796f75 0a63616e 206f7665 ame, you.can ove\n+ 0x00bcd3e0 72726964 65206974 20776974 68207468 rride it with th\n+ 0x00bcd3f0 6520606e 616d6553 6e61706c 65746020 e `nameSnaplet` \n+ 0x00bcd400 66756e63 74696f6e 2e202041 6c736f2c function. Also,\n+ 0x00bcd410 20696620 796f7520 77616e74 20746f20 if you want to \n+ 0x00bcd420 68617665 2074776f 0a696e73 74616e63 have two.instanc\n+ 0x00bcd430 6573206f 66207468 65207361 6d652073 es of the same s\n+ 0x00bcd440 6e61706c 65742c20 7468656e 20796f75 naplet, then you\n+ 0x00bcd450 2077696c 6c206e65 65642074 6f207573 will need to us\n+ 0x00bcd460 6520606e 616d6553 6e61706c 65746020 e `nameSnaplet` \n+ 0x00bcd470 746f2067 6976650a 6174206c 65617374 to give.at least\n+ 0x00bcd480 206f6e65 206f6620 7468656d 20612075 one of them a u\n+ 0x00bcd490 6e697175 65206e61 6d652e0a 0a616464 nique name...add\n+ 0x00bcd4a0 526f7574 65730a2d 2d2d2d2d 2d2d2d2d Routes.---------\n+ 0x00bcd4b0 0a0a5468 65206061 6464526f 75746573 ..The `addRoutes\n+ 0x00bcd4c0 60206675 6e637469 6f6e2069 7320686f ` function is ho\n+ 0x00bcd4d0 7720616e 20617070 6c696361 74696f6e w an application\n+ 0x00bcd4e0 20286f72 20736e61 706c6574 29206465 (or snaplet) de\n+ 0x00bcd4f0 66696e65 73206974 730a726f 75746573 fines its.routes\n+ 0x00bcd500 2e202055 6e646572 20746865 20686f6f . Under the hoo\n+ 0x00bcd510 64207468 6520736e 61706c65 7420696e d the snaplet in\n+ 0x00bcd520 66726173 74727563 74757265 206d6572 frastructure mer\n+ 0x00bcd530 67657320 616c6c20 74686520 726f7574 ges all the rout\n+ 0x00bcd540 65732066 726f6d0a 616c6c20 736e6170 es from.all snap\n+ 0x00bcd550 6c657473 2c207072 6570656e 64732070 lets, prepends p\n+ 0x00bcd560 72656669 78657320 66726f6d 20606e65 refixes from `ne\n+ 0x00bcd570 7374536e 61706c65 74602063 616c6c73 stSnaplet` calls\n+ 0x00bcd580 2c20616e 64207061 73736573 20746865 , and passes the\n+ 0x00bcd590 206c6973 740a746f 20536e61 7027730a list.to Snap's.\n+ 0x00bcd5a0 5b726f75 74655d28 68747470 3a2f2f68 [route](http://h\n+ 0x00bcd5b0 61636b61 67652e68 61736b65 6c6c2e6f ackage.haskell.o\n+ 0x00bcd5c0 72672f70 61636b61 6765732f 61726368 rg/packages/arch\n+ 0x00bcd5d0 6976652f 736e6170 2d636f72 652f302e ive/snap-core/0.\n+ 0x00bcd5e0 352e312e 342f646f 632f6874 6d6c2f53 5.1.4/doc/html/S\n+ 0x00bcd5f0 6e61702d 54797065 732e6874 6d6c2376 nap-Types.html#v\n+ 0x00bcd600 3a726f75 7465290a 66756e63 74696f6e :route).function\n+ 0x00bcd610 2e0a0a41 20726f75 74652069 73206120 ...A route is a \n+ 0x00bcd620 7475706c 65206f66 20612055 524c2061 tuple of a URL a\n+ 0x00bcd630 6e642061 2068616e 646c6572 2066756e nd a handler fun\n+ 0x00bcd640 6374696f 6e207468 61742077 696c6c20 ction that will \n+ 0x00bcd650 62652063 616c6c65 64207768 656e0a74 be called when.t\n+ 0x00bcd660 68652055 524c2069 73207265 71756573 he URL is reques\n+ 0x00bcd670 7465642e 20204861 6e646c65 72206973 ted. Handler is\n+ 0x00bcd680 20612077 72617070 65722061 726f756e a wrapper aroun\n+ 0x00bcd690 64207468 6520536e 6170206d 6f6e6164 d the Snap monad\n+ 0x00bcd6a0 20746861 74206861 6e646c65 730a7468 that handles.th\n+ 0x00bcd6b0 6520736e 61706c65 74277320 696e6672 e snaplet's infr\n+ 0x00bcd6c0 61737472 75637475 72652e20 20447572 astructure. Dur\n+ 0x00bcd6d0 696e6720 696e6974 69616c69 7a617469 ing initializati\n+ 0x00bcd6e0 6f6e2c20 736e6170 6c657473 20757365 on, snaplets use\n+ 0x00bcd6f0 20746865 0a60496e 69746961 6c697a65 the.`Initialize\n+ 0x00bcd700 7260206d 6f6e6164 2e202044 7572696e r` monad. Durin\n+ 0x00bcd710 67207275 6e74696d 652c2074 68657920 g runtime, they \n+ 0x00bcd720 75736520 74686520 6048616e 646c6572 use the `Handler\n+ 0x00bcd730 60206d6f 6e61642e 20205765 276c6c0a ` monad. We'll.\n+ 0x00bcd740 64697363 75737320 6048616e 646c6572 discuss `Handler\n+ 0x00bcd750 6020696e 206d6f72 65206465 7461696c ` in more detail\n+ 0x00bcd760 206c6174 65722e20 20496620 796f7527 later. If you'\n+ 0x00bcd770 72652066 616d696c 69617220 77697468 re familiar with\n+ 0x00bcd780 20536e61 70277320 6f6c640a 65787465 Snap's old.exte\n+ 0x00bcd790 6e73696f 6e207379 7374656d 2c20796f nsion system, yo\n+ 0x00bcd7a0 75206361 6e207468 696e6b20 6f662069 u can think of i\n+ 0x00bcd7b0 74206173 20726f75 67686c79 20657175 t as roughly equ\n+ 0x00bcd7c0 6976616c 656e7420 746f2074 68652041 ivalent to the A\n+ 0x00bcd7d0 70706c69 63617469 6f6e0a6d 6f6e6164 pplication.monad\n+ 0x00bcd7e0 2e202049 74206861 73206120 604d6f6e . It has a `Mon\n+ 0x00bcd7f0 61645374 61746560 20696e73 74616e63 adState` instanc\n+ 0x00bcd800 65207468 6174206c 65747320 796f7520 e that lets you \n+ 0x00bcd810 61636365 73732061 6e64206d 6f646966 access and modif\n+ 0x00bcd820 79207468 650a6375 7272656e 7420736e y the.current sn\n+ 0x00bcd830 61706c65 74277320 73746174 652c2061 aplet's state, a\n+ 0x00bcd840 6e642061 20604d6f 6e616453 6e617060 nd a `MonadSnap`\n+ 0x00bcd850 20696e73 74616e63 65207072 6f766964 instance provid\n+ 0x00bcd860 696e6720 7468650a 72657175 6573742d ing the.request-\n+ 0x00bcd870 70726f63 65737369 6e672066 756e6374 processing funct\n+ 0x00bcd880 696f6e73 20646566 696e6564 20696e20 ions defined in \n+ 0x00bcd890 536e6170 2e547970 65732e0a 0a777261 Snap.Types...wra\n+ 0x00bcd8a0 70536974 650a2d2d 2d2d2d2d 2d2d2d2d pSite.----------\n+ 0x00bcd8b0 2d2d0a0a 60777261 70536974 65602061 --..`wrapSite` a\n+ 0x00bcd8c0 6c6c6f77 7320796f 7520746f 20617070 llows you to app\n+ 0x00bcd8d0 6c792061 6e206172 62697472 61727920 ly an arbitrary \n+ 0x00bcd8e0 6048616e 646c6572 60207472 616e7366 `Handler` transf\n+ 0x00bcd8f0 6f726d61 74696f6e 20746f0a 74686520 ormation to.the \n+ 0x00bcd900 746f702d 6c657665 6c206861 6e646c65 top-level handle\n+ 0x00bcd910 722e2020 54686973 20697320 75736566 r. This is usef\n+ 0x00bcd920 756c2069 6620796f 75207761 6e742074 ul if you want t\n+ 0x00bcd930 6f20646f 20736f6d 65206765 6e657269 o do some generi\n+ 0x00bcd940 630a7072 6f636573 73696e67 20617420 c.processing at \n+ 0x00bcd950 74686520 62656769 6e6e696e 67206f72 the beginning or\n+ 0x00bcd960 20656e64 206f6620 65766572 79207265 end of every re\n+ 0x00bcd970 71756573 742e2020 466f7220 696e7374 quest. For inst\n+ 0x00bcd980 616e6365 2c206120 73657373 696f6e0a ance, a session.\n+ 0x00bcd990 736e6170 6c657420 6d696768 74207573 snaplet might us\n+ 0x00bcd9a0 65206974 20746f20 746f7563 68206120 e it to touch a \n+ 0x00bcd9b0 73657373 696f6e20 61637469 76697479 session activity\n+ 0x00bcd9c0 20746f6b 656e2062 65666f72 6520726f token before ro\n+ 0x00bcd9d0 7574696e 67206861 7070656e 732e0a49 uting happens..I\n+ 0x00bcd9e0 7420636f 756c6420 616c736f 20626520 t could also be \n+ 0x00bcd9f0 75736564 20746f20 696d706c 656d656e used to implemen\n+ 0x00bcda00 74206375 73746f6d 206c6f67 67696e67 t custom logging\n+ 0x00bcda10 2e202054 68652065 78616d70 6c652061 . The example a\n+ 0x00bcda20 626f7665 20757365 73206974 0a746f20 bove uses it.to \n+ 0x00bcda30 64656669 6e652068 65697374 53657276 define heistServ\n+ 0x00bcda40 65202870 726f7669 64656420 62792074 e (provided by t\n+ 0x00bcda50 68652048 65697374 20736e61 706c6574 he Heist snaplet\n+ 0x00bcda60 29206173 20746865 20646566 61756c74 ) as the default\n+ 0x00bcda70 2068616e 646c6572 20746f0a 62652074 handler to.be t\n+ 0x00bcda80 72696564 20696620 6e6f206f 74686572 ried if no other\n+ 0x00bcda90 2068616e 646c6572 206d6174 63686564 handler matched\n+ 0x00bcdaa0 2e202054 68697320 6d617920 7365656d . This may seem\n+ 0x00bcdab0 206c696b 6520616e 20656173 79207761 like an easy wa\n+ 0x00bcdac0 7920746f 20646566 696e650a 726f7574 y to define.rout\n+ 0x00bcdad0 65732c20 62757420 69662079 6f752073 es, but if you s\n+ 0x00bcdae0 7472696e 67207468 656d2061 6c6c2074 tring them all t\n+ 0x00bcdaf0 6f676574 68657220 696e2074 68697320 ogether in this \n+ 0x00bcdb00 77617920 65616368 2068616e 646c6572 way each handler\n+ 0x00bcdb10 2077696c 6c206265 0a657661 6c756174 will be.evaluat\n+ 0x00bcdb20 65642073 65717565 6e746961 6c6c7920 ed sequentially \n+ 0x00bcdb30 616e6420 796f7527 6c6c2067 6574204f and you'll get O\n+ 0x00bcdb40 286e2920 74696d65 20636f6d 706c6578 (n) time complex\n+ 0x00bcdb50 6974792c 20776865 72656173 20726f75 ity, whereas rou\n+ 0x00bcdb60 7465730a 64656669 6e656420 77697468 tes.defined with\n+ 0x00bcdb70 20606164 64526f75 74657360 20686176 `addRoutes` hav\n+ 0x00bcdb80 65204f28 6c6f6720 6e292074 696d6520 e O(log n) time \n+ 0x00bcdb90 636f6d70 6c657869 74792e20 20546865 complexity. The\n+ 0x00bcdba0 7265666f 72652c20 696e2061 0a726561 refore, in a.rea\n+ 0x00bcdbb0 6c2d776f 726c6420 6170706c 69636174 l-world applicat\n+ 0x00bcdbc0 696f6e20 796f7520 776f756c 64207072 ion you would pr\n+ 0x00bcdbd0 6f626162 6c792077 616e7420 746f2068 obably want to h\n+ 0x00bcdbe0 61766520 60282222 2c206865 69737453 ave `(\"\", heistS\n+ 0x00bcdbf0 65727665 29602069 6e0a7468 65206c69 erve)` in.the li\n+ 0x00bcdc00 73742070 61737365 6420746f 20606164 st passed to `ad\n+ 0x00bcdc10 64526f75 74657360 2e0a0a77 6974680a dRoutes`...with.\n+ 0x00bcdc20 2d2d2d2d 0a0a5468 65206c61 73742075 ----..The last u\n+ 0x00bcdc30 6e66616d 696c6961 72206675 6e637469 nfamiliar functi\n+ 0x00bcdc40 6f6e2069 6e207468 65206578 616d706c on in the exampl\n+ 0x00bcdc50 65206973 20607769 7468602e 20204865 e is `with`. He\n+ 0x00bcdc60 72652069 74206163 636f6d70 616e6965 re it accompanie\n+ 0x00bcdc70 7320610a 63616c6c 20746f20 74686520 s a.call to the \n+ 0x00bcdc80 66756e63 74696f6e 20606e61 6d655061 function `namePa\n+ 0x00bcdc90 6765602e 2020606e 616d6550 61676560 ge`. `namePage`\n+ 0x00bcdca0 20697320 61207369 6d706c65 20657861 is a simple exa\n+ 0x00bcdcb0 6d706c65 2068616e 646c6572 20616e64 mple handler and\n+ 0x00bcdcc0 0a6c6f6f 6b73206c 696b6520 74686973 .looks like this\n+ 0x00bcdcd0 2e0a0a3e 206e616d 65506167 65203a3a ...> namePage ::\n+ 0x00bcdce0 2048616e 646c6572 20622076 2028290a Handler b v ().\n+ 0x00bcdcf0 3e206e61 6d655061 6765203d 20646f0a > namePage = do.\n+ 0x00bcdd00 3e202020 20206d6e 616d6520 3c2d2067 > mname <- g\n+ 0x00bcdd10 6574536e 61706c65 744e616d 650a3e20 etSnapletName.> \n+ 0x00bcdd20 20202020 77726974 65546578 74202420 writeText $ \n+ 0x00bcdd30 66726f6d 4d617962 65202254 68697320 fromMaybe \"This \n+ 0x00bcdd40 73686f75 6c646e27 74206861 7070656e shouldn't happen\n+ 0x00bcdd50 22206d6e 616d650a 0a546869 73206675 \" mname..This fu\n+ 0x00bcdd60 6e637469 6f6e2069 73206120 67656e65 nction is a gene\n+ 0x00bcdd70 72696320 68616e64 6c657220 74686174 ric handler that\n+ 0x00bcdd80 20676574 73207468 65206e61 6d65206f gets the name o\n+ 0x00bcdd90 66207468 65206375 7272656e 7420736e f the current sn\n+ 0x00bcdda0 61706c65 740a616e 64207772 69746573 aplet.and writes\n+ 0x00bcddb0 20697420 696e746f 20746865 20726573 it into the res\n+ 0x00bcddc0 706f6e73 65207769 74682074 68652060 ponse with the `\n+ 0x00bcddd0 77726974 65546578 74602066 756e6374 writeText` funct\n+ 0x00bcdde0 696f6e20 64656669 6e656420 62792074 ion defined by t\n+ 0x00bcddf0 68650a73 6e61702d 636f7265 2070726f he.snap-core pro\n+ 0x00bcde00 6a656374 2e202054 68652074 79706520 ject. The type \n+ 0x00bcde10 76617269 61626c65 73202762 2720616e variables 'b' an\n+ 0x00bcde20 64202776 2720696e 64696361 74652074 d 'v' indicate t\n+ 0x00bcde30 68617420 74686973 2066756e 6374696f hat this functio\n+ 0x00bcde40 6e0a7769 6c6c2077 6f726b20 696e2061 n.will work in a\n+ 0x00bcde50 6e792073 6e61706c 65742077 69746820 ny snaplet with \n+ 0x00bcde60 616e7920 62617365 20617070 6c696361 any base applica\n+ 0x00bcde70 74696f6e 2e202054 68652027 77697468 tion. The 'with\n+ 0x00bcde80 27206675 6e637469 6f6e2069 730a7573 ' function is.us\n+ 0x00bcde90 65642074 6f207275 6e20606e 616d6550 ed to run `nameP\n+ 0x00bcdea0 61676560 20696e20 74686520 636f6e74 age` in the cont\n+ 0x00bcdeb0 65787420 6f662074 68652073 6e61706c ext of the snapl\n+ 0x00bcdec0 65747320 666f6f20 616e6420 62617220 ets foo and bar \n+ 0x00bcded0 666f7220 7468650a 636f7272 6573706f for the.correspo\n+ 0x00bcdee0 6e64696e 6720726f 75746573 2e0a0a53 nding routes...S\n+ 0x00bcdef0 69746520 52656c6f 6164696e 670a2d2d ite Reloading.--\n+ 0x00bcdf00 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a0a536e ------------..Sn\n+ 0x00bcdf10 61706c65 7420496e 69746961 6c697a65 aplet Initialize\n+ 0x00bcdf20 72732073 65727665 20647561 6c207075 rs serve dual pu\n+ 0x00bcdf30 72706f73 65206173 20626f74 6820696e rpose as both in\n+ 0x00bcdf40 69746961 6c697a65 72732061 6e642072 itializers and r\n+ 0x00bcdf50 656c6f61 64657273 2e0a5265 6c6f6164 eloaders..Reload\n+ 0x00bcdf60 73206172 65207472 69676765 72656420 s are triggered \n+ 0x00bcdf70 62792061 20737065 6369616c 2068616e by a special han\n+ 0x00bcdf80 646c6572 20746861 74206973 20626f75 dler that is bou\n+ 0x00bcdf90 6e642074 6f207468 650a602f 61646d69 nd to the.`/admi\n+ 0x00bcdfa0 6e2f7265 6c6f6164 6020726f 7574652e n/reload` route.\n+ 0x00bcdfb0 20205468 69732068 616e646c 65722072 This handler r\n+ 0x00bcdfc0 652d7275 6e732074 68652073 69746520 e-runs the site \n+ 0x00bcdfd0 696e6974 69616c69 7a657220 616e6420 initializer and \n+ 0x00bcdfe0 69662069 74206973 0a737563 63657373 if it is.success\n+ 0x00bcdff0 66756c2c 206c6f61 64732074 6865206e ful, loads the n\n+ 0x00bce000 65776c79 2067656e 65726174 65642069 ewly generated i\n+ 0x00bce010 6e2d6d65 6d6f7279 20737461 74652e20 n-memory state. \n+ 0x00bce020 20546f20 70726576 656e7420 64656e69 To prevent deni\n+ 0x00bce030 616c206f 660a7365 72766963 65206174 al of.service at\n+ 0x00bce040 7461636b 732c2074 68652072 656c6f61 tacks, the reloa\n+ 0x00bce050 6420726f 75746520 6973206f 6e6c7920 d route is only \n+ 0x00bce060 61636365 73736962 6c652066 726f6d20 accessible from \n+ 0x00bce070 6c6f6361 6c686f73 742e0a0a 49662074 localhost...If t\n+ 0x00bce080 68657265 20617265 20616e79 20657272 here are any err\n+ 0x00bce090 6f727320 64757269 6e672072 656c6f61 ors during reloa\n+ 0x00bce0a0 642c2079 6f752077 6f756c64 206e6174 d, you would nat\n+ 0x00bce0b0 7572616c 6c792077 616e7420 746f2073 urally want to s\n+ 0x00bce0c0 65652074 68656d20 696e0a74 68652048 ee them in.the H\n+ 0x00bce0d0 54545020 72657370 6f6e7365 20726574 TTP response ret\n+ 0x00bce0e0 75726e65 64206279 20746865 20736572 urned by the ser\n+ 0x00bce0f0 7665722e 2020486f 77657665 722c2077 ver. However, w\n+ 0x00bce100 68656e20 74686573 65207361 6d650a69 hen these same.i\n+ 0x00bce110 6e697469 616c697a 65727320 61726520 nitializers are \n+ 0x00bce120 72756e20 7768656e 20796f75 20666972 run when you fir\n+ 0x00bce130 73742073 74617274 20796f75 72206170 st start your ap\n+ 0x00bce140 702c2079 6f752077 696c6c20 77616e74 p, you will want\n+ 0x00bce150 20746f20 7365650a 73746174 7573206d to see.status m\n+ 0x00bce160 65737361 67657320 7072696e 74656420 essages printed \n+ 0x00bce170 746f2074 68652063 6f6e736f 6c652e20 to the console. \n+ 0x00bce180 20546f20 6d616b65 20746869 7320706f To make this po\n+ 0x00bce190 73736962 6c652077 65207072 6f766964 ssible we provid\n+ 0x00bce1a0 65207468 650a6070 72696e74 496e666f e the.`printInfo\n+ 0x00bce1b0 60206675 6e637469 6f6e2e20 20596f75 ` function. You\n+ 0x00bce1c0 2073686f 756c6420 75736520 69742074 should use it t\n+ 0x00bce1d0 6f206f75 74707574 20616e79 20696e66 o output any inf\n+ 0x00bce1e0 6f726d61 74696f6e 616c206d 65737361 ormational messa\n+ 0x00bce1f0 6765730a 67656e65 72617465 64206279 ges.generated by\n+ 0x00bce200 20796f75 7220696e 69746961 6c697a65 your initialize\n+ 0x00bce210 72732e20 20496620 796f7520 7072696e rs. If you prin\n+ 0x00bce220 74206469 72656374 6c792074 6f207374 t directly to st\n+ 0x00bce230 616e6461 7264206f 75747075 74206f72 andard output or\n+ 0x00bce240 0a737461 6e646172 64206572 726f722c .standard error,\n+ 0x00bce250 20746865 6e207468 6f736520 6d657373 then those mess\n+ 0x00bce260 61676573 2077696c 6c206e6f 74206265 ages will not be\n+ 0x00bce270 20617661 696c6162 6c652069 6e20796f available in yo\n+ 0x00bce280 75722062 726f7773 65722077 68656e0a ur browser when.\n+ 0x00bce290 796f7520 72656c6f 61642074 68652073 you reload the s\n+ 0x00bce2a0 6974652e 0a0a576f 726b696e 67207769 ite...Working wi\n+ 0x00bce2b0 74682073 74617465 0a2d2d2d 2d2d2d2d th state.-------\n+ 0x00bce2c0 2d2d2d2d 2d2d2d2d 2d2d2d0a 0a604861 -----------..`Ha\n+ 0x00bce2d0 6e646c65 72206220 76602068 61732061 ndler b v` has a\n+ 0x00bce2e0 20604d6f 6e616453 74617465 20766020 `MonadState v` \n+ 0x00bce2f0 696e7374 616e6365 2e202054 68697320 instance. This \n+ 0x00bce300 6d65616e 73207468 61742079 6f752063 means that you c\n+ 0x00bce310 616e2061 63636573 730a616c 6c20796f an access.all yo\n+ 0x00bce320 75722073 6e61706c 65742073 74617465 ur snaplet state\n+ 0x00bce330 20746872 6f756768 20746865 20676574 through the get\n+ 0x00bce340 2c207075 742c2067 6574732c 20616e64 , put, gets, and\n+ 0x00bce350 206d6f64 69667920 66756e63 74696f6e modify function\n+ 0x00bce360 73207468 61740a61 72652070 726f6261 s that.are proba\n+ 0x00bce370 626c7920 66616d69 6c696172 2066726f bly familiar fro\n+ 0x00bce380 6d207468 65207374 61746520 6d6f6e61 m the state mona\n+ 0x00bce390 642e2020 496e206f 75722065 78616d70 d. In our examp\n+ 0x00bce3a0 6c652061 70706c69 63617469 6f6e2077 le application w\n+ 0x00bce3b0 650a6465 6d6f6e73 74726174 65207468 e.demonstrate th\n+ 0x00bce3c0 69732077 69746820 60636f6d 70616e79 is with `company\n+ 0x00bce3d0 48616e64 6c657260 2e0a0a3e 20636f6d Handler`...> com\n+ 0x00bce3e0 70616e79 48616e64 6c657220 3a3a2048 panyHandler :: H\n+ 0x00bce3f0 616e646c 65722041 70702041 70702028 andler App App (\n+ 0x00bce400 290a3e20 636f6d70 616e7948 616e646c ).> companyHandl\n+ 0x00bce410 6572203d 206d6574 686f6420 47455420 er = method GET \n+ 0x00bce420 67657474 6572203c 7c3e206d 6574686f getter <|> metho\n+ 0x00bce430 6420504f 53542073 65747465 720a3e20 d POST setter.> \n+ 0x00bce440 20207768 6572650a 3e202020 20206765 where.> ge\n+ 0x00bce450 74746572 203d2064 6f0a3e20 20202020 tter = do.> \n+ 0x00bce460 20202020 6e616d65 52656620 3c2d2067 nameRef <- g\n+ 0x00bce470 65747320 5f636f6d 70616e79 4e616d65 ets _companyName\n+ 0x00bce480 0a3e2020 20202020 2020206e 616d6520 .> name \n+ 0x00bce490 3c2d206c 69667449 4f202420 72656164 <- liftIO $ read\n+ 0x00bce4a0 494f5265 66206e61 6d655265 660a3e20 IORef nameRef.> \n+ 0x00bce4b0 20202020 20202020 77726974 65425320 writeBS \n+ 0x00bce4c0 6e616d65 0a3e2020 20202073 65747465 name.> sette\n+ 0x00bce4d0 72203d20 646f0a3e 20202020 20202020 r = do.> \n+ 0x00bce4e0 206d6e61 6d65203c 2d206765 74506172 mname <- getPar\n+ 0x00bce4f0 616d2022 6e616d65 220a3e20 20202020 am \"name\".> \n+ 0x00bce500 20202020 6e616d65 52656620 3c2d2067 nameRef <- g\n+ 0x00bce510 65747320 5f636f6d 70616e79 4e616d65 ets _companyName\n+ 0x00bce520 0a3e2020 20202020 2020206c 69667449 .> liftI\n+ 0x00bce530 4f202420 6d617962 65202872 65747572 O $ maybe (retur\n+ 0x00bce540 6e202829 29202877 72697465 494f5265 n ()) (writeIORe\n+ 0x00bce550 66206e61 6d655265 6629206d 6e616d65 f nameRef) mname\n+ 0x00bce560 0a3e2020 20202020 20202067 65747465 .> gette\n+ 0x00bce570 720a0a49 6620796f 75207365 74206120 r..If you set a \n+ 0x00bce580 47455420 72657175 65737420 746f2060 GET request to `\n+ 0x00bce590 2f636f6d 70616e79 602c2079 6f75276c /company`, you'l\n+ 0x00bce5a0 6c206765 74207468 65207374 72696e67 l get the string\n+ 0x00bce5b0 2022666f 6f436f72 70222062 61636b2e \"fooCorp\" back.\n+ 0x00bce5c0 0a496620 796f7520 73656e64 20612050 .If you send a P\n+ 0x00bce5d0 4f535420 72657175 6573742c 20697420 OST request, it \n+ 0x00bce5e0 77696c6c 20736574 20746865 20494f52 will set the IOR\n+ 0x00bce5f0 65662068 656c6420 696e2074 68652060 ef held in the `\n+ 0x00bce600 5f636f6d 70616e79 4e616d65 600a6669 _companyName`.fi\n+ 0x00bce610 656c6420 696e2074 68652060 41707060 eld in the `App`\n+ 0x00bce620 20646174 61207374 72756374 75726520 data structure \n+ 0x00bce630 746f2074 68652076 616c7565 206f6620 to the value of \n+ 0x00bce640 74686520 606e616d 65602066 69656c64 the `name` field\n+ 0x00bce650 2e202054 68656e20 69740a63 616c6c73 . Then it.calls\n+ 0x00bce660 20746865 20676574 74657220 746f2072 the getter to r\n+ 0x00bce670 65747572 6e207468 61742076 616c7565 eturn that value\n+ 0x00bce680 20626163 6b20746f 20796f75 20736f20 back to you so \n+ 0x00bce690 796f7520 63616e20 73656520 69742077 you can see it w\n+ 0x00bce6a0 61730a61 63747561 6c6c7920 6368616e as.actually chan\n+ 0x00bce6b0 6765642e 20204167 61696e2c 2072656d ged. Again, rem\n+ 0x00bce6c0 656d6265 72207468 61742074 68697320 ember that this \n+ 0x00bce6d0 6368616e 6765206f 6e6c7920 70657273 change only pers\n+ 0x00bce6e0 69737473 20616372 6f73730a 72657175 ists across.requ\n+ 0x00bce6f0 65737473 20626563 61757365 20776520 ests because we \n+ 0x00bce700 75736564 20616e20 494f5265 662e2020 used an IORef. \n+ 0x00bce710 49662060 5f636f6d 70616e79 4e616d65 If `_companyName\n+ 0x00bce720 60207761 73206a75 73742061 20706c61 ` was just a pla\n+ 0x00bce730 696e2073 7472696e 670a616e 64207765 in string.and we\n+ 0x00bce740 20686164 20757365 64206d6f 64696679 had used modify\n+ 0x00bce750 2c207468 65206368 616e6765 64207265 , the changed re\n+ 0x00bce760 73756c74 20776f75 6c64206f 6e6c7920 sult would only \n+ 0x00bce770 62652076 69736962 6c652069 6e207468 be visible in th\n+ 0x00bce780 65207265 73740a6f 66207468 65207072 e rest.of the pr\n+ 0x00bce790 6f636573 73696e67 20666f72 20746861 ocessing for tha\n+ 0x00bce7a0 74207265 71756573 742e0a0a 54686520 t request...The \n+ 0x00bce7b0 48656973 7420536e 61706c65 740a3d3d Heist Snaplet.==\n+ 0x00bce7c0 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d0a ===============.\n+ 0x00bce7d0 0a546865 20617374 75746520 72656164 .The astute read\n+ 0x00bce7e0 6572206d 69676874 2061736b 20776879 er might ask why\n+ 0x00bce7f0 20746865 72652069 73206e6f 20607769 there is no `wi\n+ 0x00bce800 74682068 65697374 6020696e 2066726f th heist` in fro\n+ 0x00bce810 6e74206f 66207468 65206361 6c6c0a74 nt of the call.t\n+ 0x00bce820 6f206068 65697374 53657276 65602e20 o `heistServe`. \n+ 0x00bce830 20416e64 20696e64 6565642c 20746861 And indeed, tha\n+ 0x00bce840 7420776f 756c6420 6e6f726d 616c6c79 t would normally\n+ 0x00bce850 20626520 74686520 63617365 2e202042 be the case. B\n+ 0x00bce860 75742077 65206465 63696465 640a7468 ut we decided.th\n+ 0x00bce870 61742061 6e206170 706c6963 6174696f at an applicatio\n+ 0x00bce880 6e207769 6c6c206e 65766572 206e6565 n will never nee\n+ 0x00bce890 64206d6f 72652074 68616e20 6f6e6520 d more than one \n+ 0x00bce8a0 696e7374 616e6365 206f6620 61204865 instance of a He\n+ 0x00bce8b0 69737420 736e6170 6c65742e 0a536f20 ist snaplet..So \n+ 0x00bce8c0 77652070 726f7669 64656420 61207479 we provided a ty\n+ 0x00bce8d0 70652063 6c617373 2063616c 6c656420 pe class called \n+ 0x00bce8e0 60486173 48656973 74602074 68617420 `HasHeist` that \n+ 0x00bce8f0 616c6c6f 77732061 6e206170 706c6963 allows an applic\n+ 0x00bce900 6174696f 6e20746f 0a646566 696e6520 ation to.define \n+ 0x00bce910 74686520 676c6f62 616c2072 65666572 the global refer\n+ 0x00bce920 656e6365 20746f20 69747320 48656973 ence to its Heis\n+ 0x00bce930 7420736e 61706c65 74206279 20777269 t snaplet by wri\n+ 0x00bce940 74696e67 20612060 48617348 65697374 ting a `HasHeist\n+ 0x00bce950 600a696e 7374616e 63652e20 20496e20 `.instance. In \n+ 0x00bce960 74686973 20657861 6d706c65 20776520 this example we \n+ 0x00bce970 64656669 6e652074 68652069 6e737461 define the insta\n+ 0x00bce980 6e636520 61732066 6f6c6c6f 77733a0a nce as follows:.\n+ 0x00bce990 0a3e2069 6e737461 6e636520 48617348 .> instance HasH\n+ 0x00bce9a0 65697374 20417070 20776865 72652068 eist App where h\n+ 0x00bce9b0 65697374 4c656e73 203d2073 7562536e eistLens = subSn\n+ 0x00bce9c0 61706c65 74206865 6973740a 0a4e6f77 aplet heist..Now\n+ 0x00bce9d0 20616c6c 20776520 6e656564 20697320 all we need is \n+ 0x00bce9e0 61207369 6d706c65 206d6169 6e206675 a simple main fu\n+ 0x00bce9f0 6e637469 6f6e2074 6f207365 72766520 nction to serve \n+ 0x00bcea00 6f757220 6170706c 69636174 696f6e2e our application.\n+ 0x00bcea10 0a0a3e20 6d61696e 203a3a20 494f2028 ..> main :: IO (\n+ 0x00bcea20 290a3e20 6d61696e 203d2073 65727665 ).> main = serve\n+ 0x00bcea30 536e6170 6c657420 64656661 756c7443 Snaplet defaultC\n+ 0x00bcea40 6f6e6669 67206170 70496e69 740a0a54 onfig appInit..T\n+ 0x00bcea50 68697320 636f6d70 6c657465 73206120 his completes a \n+ 0x00bcea60 66756c6c 20776f72 6b696e67 20617070 full working app\n+ 0x00bcea70 6c696361 74696f6e 2e202057 65206469 lication. We di\n+ 0x00bcea80 64206c65 61766520 6f757420 61206c69 d leave out a li\n+ 0x00bcea90 74746c65 2064756d 6d790a63 6f646520 ttle dummy.code \n+ 0x00bceaa0 666f7220 74686520 466f6f20 616e6420 for the Foo and \n+ 0x00bceab0 42617220 736e6170 6c657473 2e202054 Bar snaplets. T\n+ 0x00bceac0 68697320 636f6465 20697320 696e636c his code is incl\n+ 0x00bcead0 75646564 20696e20 50617274 322e6873 uded in Part2.hs\n+ 0x00bceae0 2e202046 6f720a6d 6f726520 696e666f . For.more info\n+ 0x00bceaf0 726d6174 696f6e20 6c6f6f6b 20696e20 rmation look in \n+ 0x00bceb00 6f757220 5b415049 0a646f63 756d656e our [API.documen\n+ 0x00bceb10 74617469 6f6e5d28 68747470 3a2f2f68 tation](http://h\n+ 0x00bceb20 61636b61 67652e68 61736b65 6c6c2e6f ackage.haskell.o\n+ 0x00bceb30 72672f70 61636b61 67652f73 6e617029 rg/package/snap)\n+ 0x00bceb40 2c207370 65636966 6963616c 6c792074 , specifically t\n+ 0x00bceb50 68650a53 6e61702e 536e6170 6c657420 he.Snap.Snaplet \n+ 0x00bceb60 6d6f6475 6c652e20 204e6f20 7265616c module. No real\n+ 0x00bceb70 6c792c20 74686174 20776173 6e277420 ly, that wasn't \n+ 0x00bceb80 61206a6f 6b652e20 20546865 20415049 a joke. The API\n+ 0x00bceb90 20646f63 73206172 65207772 69747465 docs are writte\n+ 0x00bceba0 6e0a6173 2070726f 73652e20 20546865 n.as prose. The\n+ 0x00bcebb0 79207368 6f756c64 20626520 76657279 y should be very\n+ 0x00bcebc0 20656173 7920746f 20726561 642c2077 easy to read, w\n+ 0x00bcebd0 68696c65 20686176 696e6720 74686520 hile having the \n+ 0x00bcebe0 62656e65 66697420 6f660a69 6e636c75 benefit of.inclu\n+ 0x00bcebf0 64696e67 20616c6c 20746865 20616374 ding all the act\n+ 0x00bcec00 75616c20 74797065 20736967 6e617475 ual type signatu\n+ 0x00bcec10 7265732e 0a0a4669 6c657379 7374656d res...Filesystem\n+ 0x00bcec20 20446174 6120616e 64204175 746f6d61 Data and Automa\n+ 0x00bcec30 74696320 496e7374 616c6c61 74696f6e tic Installation\n+ 0x00bcec40 0a3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d .===============\n+ 0x00bcec50 3d3d3d3d 3d3d3d3d 3d3d3d3d 3d3d3d3d ================\n+ 0x00bcec60 3d3d3d3d 3d3d3d3d 3d3d3d0a 0a536f6d ===========..Som\n+ 0x00bcec70 6520736e 61706c65 74732077 696c6c20 e snaplets will \n+ 0x00bcec80 68617665 20646174 61207374 6f726564 have data stored\n+ 0x00bcec90 20696e20 74686520 66696c65 73797374 in the filesyst\n+ 0x00bceca0 656d2074 68617420 73686f75 6c642062 em that should b\n+ 0x00bcecb0 6520696e 7374616c 6c65640a 696e746f e installed.into\n+ 0x00bcecc0 20746865 20646972 6563746f 7279206f the directory o\n+ 0x00bcecd0 6620616e 79207072 6f6a6563 74207468 f any project th\n+ 0x00bcece0 61742075 73657320 69742e20 20486572 at uses it. Her\n+ 0x00bcecf0 65277320 616e2065 78616d70 6c65206f e's an example o\n+ 0x00bced00 66207768 61742061 0a736e61 706c6574 f what a.snaplet\n+ 0x00bced10 2066696c 65737973 74656d20 6c61796f filesystem layo\n+ 0x00bced20 7574206d 69676874 206c6f6f 6b206c69 ut might look li\n+ 0x00bced30 6b653a0a 0a202020 20666f6f 736e6170 ke:.. foosnap\n+ 0x00bced40 6c65742f 0a202020 2020207c 2d2d202a let/. |-- *\n+ 0x00bced50 64657665 6c2e6366 672a0a20 20202020 devel.cfg*. \n+ 0x00bced60 207c2d2d 2064622e 6366670a 20202020 |-- db.cfg. \n+ 0x00bced70 20207c2d 2d207075 626c6963 2f0a2020 |-- public/. \n+ 0x00bced80 20202020 20202020 7c2d2d20 7374796c |-- styl\n+ 0x00bced90 65736865 6574732f 0a202020 20202020 esheets/. \n+ 0x00bceda0 2020207c 2d2d2069 6d616765 732f0a20 |-- images/. \n+ 0x00bcedb0 20202020 20202020 207c2d2d 206a732f |-- js/\n+ 0x00bcedc0 0a202020 2020207c 2d2d202a 736e6170 . |-- *snap\n+ 0x00bcedd0 6c657473 2f2a0a20 20202020 20202020 lets/*. \n+ 0x00bcede0 207c2d2d 202a6865 6973742f 2a0a2020 |-- *heist/*. \n+ 0x00bcedf0 20202020 20202020 20202020 7c2d2d20 |-- \n+ 0x00bcee00 74656d70 6c617465 732f0a20 20202020 templates/. \n+ 0x00bcee10 20202020 207c2d2d 20737562 736e6170 |-- subsnap\n+ 0x00bcee20 6c657431 2f0a2020 20202020 20202020 let1/. \n+ 0x00bcee30 7c2d2d20 73756273 6e61706c 6574322f |-- subsnaplet2/\n+ 0x00bcee40 0a0a4f6e 6c792074 68652073 74617272 ..Only the starr\n+ 0x00bcee50 65642069 74656d73 20617265 20616374 ed items are act\n+ 0x00bcee60 75616c6c 7920656e 666f7263 65642062 ually enforced b\n+ 0x00bcee70 79206375 7272656e 7420636f 64652c20 y current code, \n+ 0x00bcee80 62757420 77652077 616e7420 746f0a65 but we want to.e\n+ 0x00bcee90 73746162 6c697368 20746865 206f7468 stablish the oth\n+ 0x00bceea0 65727320 61732061 20636f6e 76656e74 ers as a convent\n+ 0x00bceeb0 696f6e2e 20205468 65206669 6c652064 ion. The file d\n+ 0x00bceec0 6576656c 2e636667 20697320 6175746f evel.cfg is auto\n+ 0x00bceed0 6d617469 63616c6c 790a7265 61642062 matically.read b\n+ 0x00bceee0 79207468 6520736e 61706c65 7420696e y the snaplet in\n+ 0x00bceef0 66726173 74727563 74757265 2e202049 frastructure. I\n+ 0x00bcef00 74206973 20617661 696c6162 6c652074 t is available t\n+ 0x00bcef10 6f20796f 75207669 61207468 650a6067 o you via the.`g\n+ 0x00bcef20 6574536e 61706c65 74557365 72436f6e etSnapletUserCon\n+ 0x00bcef30 66696760 2066756e 6374696f 6e2e2020 fig` function. \n+ 0x00bcef40 436f6e66 69672066 696c6573 20757365 Config files use\n+ 0x00bcef50 20746865 20666f72 6d617420 64656669 the format defi\n+ 0x00bcef60 6e656420 62792042 7279616e 0a4f2753 ned by Bryan.O'S\n+ 0x00bcef70 756c6c69 76616e27 73206578 63656c6c ullivan's excell\n+ 0x00bcef80 656e7420 5b636f6e 66696775 7261746f ent [configurato\n+ 0x00bcef90 720a7061 636b6167 655d2868 7474703a r.package](http:\n+ 0x00bcefa0 2f2f6861 636b6167 652e6861 736b656c //hackage.haskel\n+ 0x00bcefb0 6c2e6f72 672f7061 636b6167 652f636f l.org/package/co\n+ 0x00bcefc0 6e666967 75726174 6f72292e 2020496e nfigurator). In\n+ 0x00bcefd0 20746869 73206578 616d706c 652c0a74 this example,.t\n+ 0x00bcefe0 68652075 73657220 68617320 63686f73 he user has chos\n+ 0x00bceff0 656e2074 6f207075 74206462 20636f6e en to put db con\n+ 0x00bcf000 66696720 6974656d 7320696e 20612073 fig items in a s\n+ 0x00bcf010 65706172 61746520 66696c65 20616e64 eparate file and\n+ 0x00bcf020 20757365 0a636f6e 66696775 7261746f use.configurato\n+ 0x00bcf030 72277320 696d706f 72742066 756e6374 r's import funct\n+ 0x00bcf040 696f6e61 6c697479 20746f20 696e636c ionality to incl\n+ 0x00bcf050 75646520 69742069 6e206465 76656c2e ude it in devel.\n+ 0x00bcf060 6366672e 20204966 0a666f6f 736e6170 cfg. If.foosnap\n+ 0x00bcf070 6c657420 75736573 20606e65 7374536e let uses `nestSn\n+ 0x00bcf080 61706c65 7460206f 72206065 6d626564 aplet` or `embed\n+ 0x00bcf090 536e6170 6c657460 20746f20 696e636c Snaplet` to incl\n+ 0x00bcf0a0 75646520 616e7920 6f746865 7220736e ude any other sn\n+ 0x00bcf0b0 61706c65 74732c0a 7468656e 2066696c aplets,.then fil\n+ 0x00bcf0c0 65737973 74656d20 64617461 20646566 esystem data def\n+ 0x00bcf0d0 696e6564 20627920 74686f73 6520736e ined by those sn\n+ 0x00bcf0e0 61706c65 74732077 696c6c20 62652069 aplets will be i\n+ 0x00bcf0f0 6e636c75 64656420 696e0a73 75626469 ncluded in.subdi\n+ 0x00bcf100 72656374 6f726965 7320756e 64657220 rectories under \n+ 0x00bcf110 74686520 60736e61 706c6574 732f6020 the `snaplets/` \n+ 0x00bcf120 64697265 63746f72 792e0a0a 536f2068 directory...So h\n+ 0x00bcf130 6f772064 6f20796f 75207465 6c6c2074 ow do you tell t\n+ 0x00bcf140 68652073 6e61706c 65742069 6e667261 he snaplet infra\n+ 0x00bcf150 73747275 63747572 65207468 61742079 structure that y\n+ 0x00bcf160 6f757220 736e6170 6c657420 68617320 our snaplet has \n+ 0x00bcf170 66696c65 73797374 656d0a64 61746120 filesystem.data \n+ 0x00bcf180 74686174 2073686f 756c6420 62652069 that should be i\n+ 0x00bcf190 6e737461 6c6c6564 3f20204c 6f6f6b20 nstalled? Look \n+ 0x00bcf1a0 61742074 68652064 6566696e 6974696f at the definitio\n+ 0x00bcf1b0 6e206f66 20617070 496e6974 2061626f n of appInit abo\n+ 0x00bcf1c0 76652e20 20546865 0a746869 72642061 ve. The.third a\n+ 0x00bcf1d0 7267756d 656e7420 746f2074 6865206d rgument to the m\n+ 0x00bcf1e0 616b6553 6e61706c 65742066 756e6374 akeSnaplet funct\n+ 0x00bcf1f0 696f6e20 69732077 68657265 20776520 ion is where we \n+ 0x00bcf200 73706563 69667920 74686520 66696c65 specify the file\n+ 0x00bcf210 73797374 656d0a64 69726563 746f7279 system.directory\n+ 0x00bcf220 20746861 74207368 6f756c64 20626520 that should be \n+ 0x00bcf230 696e7374 616c6c65 642e2020 54686174 installed. That\n+ 0x00bcf240 20617267 756d656e 74206861 73207468 argument has th\n+ 0x00bcf250 65207479 70652060 4d617962 65202849 e type `Maybe (I\n+ 0x00bcf260 4f0a4669 6c655061 74682960 2e202049 O.FilePath)`. I\n+ 0x00bcf270 6e207468 69732063 61736520 77652075 n this case we u\n+ 0x00bcf280 73656420 604e6f74 68696e67 60206265 sed `Nothing` be\n+ 0x00bcf290 63617573 65206f75 72207369 6d706c65 cause our simple\n+ 0x00bcf2a0 20657861 6d706c65 20646f65 736e2774 example doesn't\n+ 0x00bcf2b0 0a686176 6520616e 79206669 6c657379 .have any filesy\n+ 0x00bcf2c0 7374656d 20646174 612e2020 41732061 stem data. As a\n+ 0x00bcf2d0 6e206578 616d706c 652c206c 65742773 n example, let's\n+ 0x00bcf2e0 20736179 20796f75 20617265 20637265 say you are cre\n+ 0x00bcf2f0 6174696e 67206120 736e6170 6c65740a ating a snaplet.\n+ 0x00bcf300 63616c6c 6564206b 696c6c65 72617070 called killerapp\n+ 0x00bcf310 20746861 74207769 6c6c2062 65206469 that will be di\n+ 0x00bcf320 73747269 62757465 64206173 20612068 stributed as a h\n+ 0x00bcf330 61636b61 67652070 726f6a65 63742063 ackage project c\n+ 0x00bcf340 616c6c65 640a736e 61706c65 742d6b69 alled.snaplet-ki\n+ 0x00bcf350 6c6c6572 6170702e 2020596f 75722070 llerapp. Your p\n+ 0x00bcf360 726f6a65 63742064 69726563 746f7279 roject directory\n+ 0x00bcf370 20737472 75637475 72652077 696c6c20 structure will \n+ 0x00bcf380 6c6f6f6b 20736f6d 65746869 6e67206c look something l\n+ 0x00bcf390 696b650a 74686973 3a0a0a20 20202073 ike.this:.. s\n+ 0x00bcf3a0 6e61706c 65742d6b 696c6c65 72617070 naplet-killerapp\n+ 0x00bcf3b0 2f0a2020 20202020 7c2d2d20 7265736f /. |-- reso\n+ 0x00bcf3c0 75726365 732f0a20 20202020 207c2d2d urces/. |--\n+ 0x00bcf3d0 20736e61 706c6574 2d6b696c 6c657261 snaplet-killera\n+ 0x00bcf3e0 70702e63 6162616c 0a202020 2020207c pp.cabal. |\n+ 0x00bcf3f0 2d2d2073 72632f0a 0a416c6c 206f6620 -- src/..All of \n+ 0x00bcf400 74686520 66696c65 7320616e 64206469 the files and di\n+ 0x00bcf410 72656374 6f726965 73206c69 73746564 rectories listed\n+ 0x00bcf420 2061626f 76652075 6e646572 20666f6f above under foo\n+ 0x00bcf430 736e6170 6c65742f 2077696c 6c206265 snaplet/ will be\n+ 0x00bcf440 20696e0a 7265736f 75726365 732f2e20 in.resources/. \n+ 0x00bcf450 20536f6d 65776865 72652069 6e207468 Somewhere in th\n+ 0x00bcf460 6520636f 64652079 6f752077 696c6c20 e code you will \n+ 0x00bcf470 64656669 6e652061 6e20696e 69746961 define an initia\n+ 0x00bcf480 6c697a65 7220666f 72207468 650a736e lizer for the.sn\n+ 0x00bcf490 61706c65 74207468 61742077 696c6c20 aplet that will \n+ 0x00bcf4a0 6c6f6f6b 206c696b 65207468 69733a0a look like this:.\n+ 0x00bcf4b0 0a202020 206b696c 6c657249 6e697420 . killerInit \n+ 0x00bcf4c0 3d206d61 6b65536e 61706c65 7420226b = makeSnaplet \"k\n+ 0x00bcf4d0 696c6c65 72617070 22202234 32222028 illerapp\" \"42\" (\n+ 0x00bcf4e0 4a757374 20646174 61446972 29202420 Just dataDir) $ \n+ 0x00bcf4f0 646f0a0a 54686520 7072696d 61727920 do..The primary \n+ 0x00bcf500 66756e63 74696f6e 206f6620 43616261 function of Caba\n+ 0x00bcf510 6c206973 20746f20 696e7374 616c6c20 l is to install \n+ 0x00bcf520 636f6465 2e202042 75742069 74206861 code. But it ha\n+ 0x00bcf530 73207468 65206162 696c6974 7920746f s the ability to\n+ 0x00bcf540 0a696e73 74616c6c 20646174 61206669 .install data fi\n+ 0x00bcf550 6c657320 616e6420 70726f76 69646573 les and provides\n+ 0x00bcf560 20612066 756e6374 696f6e20 63616c6c a function call\n+ 0x00bcf570 65642060 67657444 61746144 69726020 ed `getDataDir` \n+ 0x00bcf580 666f7220 72657472 69657669 6e670a74 for retrieving.t\n+ 0x00bcf590 6865206c 6f636174 696f6e20 6f662074 he location of t\n+ 0x00bcf5a0 68657365 2066696c 65732e20 2053696e hese files. Sin\n+ 0x00bcf5b0 63652069 74207265 7475726e 73206120 ce it returns a \n+ 0x00bcf5c0 64696666 6572656e 74207265 73756c74 different result\n+ 0x00bcf5d0 20646570 656e6469 6e67206f 6e0a7768 depending on.wh\n+ 0x00bcf5e0 6174206d 61636869 6e652079 6f752772 at machine you'r\n+ 0x00bcf5f0 65207573 696e672c 20746865 20746869 e using, the thi\n+ 0x00bcf600 72642061 7267756d 656e7420 746f2060 rd argument to `\n+ 0x00bcf610 6d616b65 536e6170 6c657460 20686173 makeSnaplet` has\n+ 0x00bcf620 20746f20 62652060 4d617962 650a2849 to be `Maybe.(I\n+ 0x00bcf630 4f204669 6c655061 74682960 20696e73 O FilePath)` ins\n+ 0x00bcf640 74656164 206f6620 74686520 6d6f7265 tead of the more\n+ 0x00bcf650 206e6174 7572616c 20707572 65207665 natural pure ve\n+ 0x00bcf660 7273696f 6e2e2020 546f206d 616b6520 rsion. To make \n+ 0x00bcf670 7468696e 6773206d 6f72650a 6f726761 things more.orga\n+ 0x00bcf680 6e697a65 642c2077 65207573 65207468 nized, we use th\n+ 0x00bcf690 6520636f 6e76656e 74696f6e 206f6620 e convention of \n+ 0x00bcf6a0 70757474 696e6720 616c6c20 796f7572 putting all your\n+ 0x00bcf6b0 20736e61 706c6574 27732064 61746120 snaplet's data \n+ 0x00bcf6c0 66696c65 7320696e 20610a73 75626469 files in a.subdi\n+ 0x00bcf6d0 72656374 6f727920 63616c6c 65642072 rectory called r\n+ 0x00bcf6e0 65736f75 72636573 2e202053 6f207765 esources. So we\n+ 0x00bcf6f0 206e6565 6420746f 20637265 61746520 need to create \n+ 0x00bcf700 6120736d 616c6c20 66756e63 74696f6e a small function\n+ 0x00bcf710 20746861 740a6170 70656e64 7320602f that.appends `/\n+ 0x00bcf720 7265736f 75726365 73602074 6f207468 resources` to th\n+ 0x00bcf730 65207265 73756c74 206f6620 60676574 e result of `get\n+ 0x00bcf740 44617461 44697260 2e0a0a20 20202069 DataDir`... i\n+ 0x00bcf750 6d706f72 74205061 7468735f 736e6170 mport Paths_snap\n+ 0x00bcf760 6c65745f 6b696c6c 65726170 700a2020 let_killerapp. \n+ 0x00bcf770 20206461 74614469 72203d20 6c696674 dataDir = lift\n+ 0x00bcf780 4d20282b 2b222f72 65736f75 72636573 M (++\"/resources\n+ 0x00bcf790 22292067 65744461 74614469 720a0a49 \") getDataDir..I\n+ 0x00bcf7a0 66206f75 72207072 6f6a6563 74206973 f our project is\n+ 0x00bcf7b0 206e616d 65642073 6e61706c 65742d6b named snaplet-k\n+ 0x00bcf7c0 696c6c65 72617070 2c207468 65206067 illerapp, the `g\n+ 0x00bcf7d0 65744461 74614469 72602066 756e6374 etDataDir` funct\n+ 0x00bcf7e0 696f6e20 69730a64 6566696e 65642069 ion is.defined i\n+ 0x00bcf7f0 6e207468 65206d6f 64756c65 20506174 n the module Pat\n+ 0x00bcf800 68735f73 6e61706c 65745f6b 696c6c65 hs_snaplet_kille\n+ 0x00bcf810 72617070 2c207768 69636820 77652068 rapp, which we h\n+ 0x00bcf820 61766520 746f2069 6d706f72 742e2020 ave to import. \n+ 0x00bcf830 546f0a6d 616b6520 65766572 79746869 To.make everythi\n+ 0x00bcf840 6e672077 6f726b2c 20796f75 20686176 ng work, you hav\n+ 0x00bcf850 6520746f 2074656c 6c204361 62616c20 e to tell Cabal \n+ 0x00bcf860 61626f75 7420796f 75722064 61746120 about your data \n+ 0x00bcf870 66696c65 73206279 0a696e63 6c756469 files by.includi\n+ 0x00bcf880 6e672061 20736563 74696f6e 206c696b ng a section lik\n+ 0x00bcf890 65207468 6520666f 6c6c6f77 696e6720 e the following \n+ 0x00bcf8a0 696e2073 6e61706c 65742d6b 696c6c65 in snaplet-kille\n+ 0x00bcf8b0 72617070 2e636162 616c3a0a 0a202020 rapp.cabal:.. \n+ 0x00bcf8c0 20646174 612d6669 6c65733a 0a202020 data-files:. \n+ 0x00bcf8d0 20202072 65736f75 72636573 2f646576 resources/dev\n+ 0x00bcf8e0 656c2e63 66672c0a 20202020 20207265 el.cfg,. re\n+ 0x00bcf8f0 736f7572 6365732f 7075626c 69632f73 sources/public/s\n+ 0x00bcf900 74796c65 73686565 74732f73 74796c65 tylesheets/style\n+ 0x00bcf910 2e637373 2c0a2020 20202020 7265736f .css,. reso\n+ 0x00bcf920 75726365 732f736e 61706c65 74732f68 urces/snaplets/h\n+ 0x00bcf930 65697374 2f74656d 706c6174 65732f70 eist/templates/p\n+ 0x00bcf940 6167652e 74706c0a 0a4e6f77 20776865 age.tpl..Now whe\n+ 0x00bcf950 6e657665 7220796f 75722073 6e61706c never your snapl\n+ 0x00bcf960 65742069 73207573 65642c20 69747320 et is used, its \n+ 0x00bcf970 66696c65 73797374 656d2064 61746120 filesystem data \n+ 0x00bcf980 77696c6c 20626520 6175746f 6d616769 will be automagi\n+ 0x00bcf990 63616c6c 790a636f 70696564 20696e74 cally.copied int\n+ 0x00bcf9a0 6f207468 65206c6f 63616c20 70726f6a o the local proj\n+ 0x00bcf9b0 65637420 74686174 20697320 7573696e ect that is usin\n+ 0x00bcf9c0 67206974 2c207768 656e6576 65722074 g it, whenever t\n+ 0x00bcf9d0 68652061 70706c69 63617469 6f6e2069 he application i\n+ 0x00bcf9e0 730a7275 6e20616e 64206974 20736565 s.run and it see\n+ 0x00bcf9f0 73207468 61742074 68652073 6e61706c s that the snapl\n+ 0x00bcfa00 65742773 20646972 6563746f 72792064 et's directory d\n+ 0x00bcfa10 6f657320 6e6f7420 616c7265 61647920 oes not already \n+ 0x00bcfa20 65786973 742e2020 49662074 68650a75 exist. If the.u\n+ 0x00bcfa30 73657220 75706772 61646573 20746f20 ser upgrades to \n+ 0x00bcfa40 61206e65 77207665 7273696f 6e206f66 a new version of\n+ 0x00bcfa50 20746865 20736e61 706c6574 20616e64 the snaplet and\n+ 0x00bcfa60 20746865 206e6577 20766572 73696f6e the new version\n+ 0x00bcfa70 206d6164 65206368 616e6765 730a746f made changes.to\n+ 0x00bcfa80 20746865 2066696c 65737973 74656d20 the filesystem \n+ 0x00bcfa90 7265736f 75726365 732c2074 686f7365 resources, those\n+ 0x00bcfaa0 20726573 6f757263 65732077 696c6c20 resources will \n+ 0x00bcfab0 4e4f5420 62652061 75746f6d 61746963 NOT be automatic\n+ 0x00bcfac0 616c6c79 20636f70 6965640a 696e2062 ally copied.in b\n+ 0x00bcfad0 79206465 6661756c 742e2020 5265736f y default. Reso\n+ 0x00bcfae0 75726365 20696e73 74616c6c 6174696f urce installatio\n+ 0x00bcfaf0 6e202a6f 6e6c792a 20686170 70656e73 n *only* happens\n+ 0x00bcfb00 20776865 6e207468 65206073 6e61706c when the `snapl\n+ 0x00bcfb10 6574732f 666f6f60 0a646972 6563746f ets/foo`.directo\n+ 0x00bcfb20 72792064 6f657320 6e6f7420 65786973 ry does not exis\n+ 0x00bcfb30 742e2020 49662079 6f752077 616e7420 t. If you want \n+ 0x00bcfb40 746f2067 65742074 6865206c 61746573 to get the lates\n+ 0x00bcfb50 74207665 7273696f 6e206f66 20746865 t version of the\n+ 0x00bcfb60 0a66696c 65737973 74656d20 7265736f .filesystem reso\n+ 0x00bcfb70 75726365 732c2072 656d6f76 65207468 urces, remove th\n+ 0x00bcfb80 65206073 6e61706c 6574732f 666f6f60 e `snaplets/foo`\n+ 0x00bcfb90 20646972 6563746f 72792c20 616e6420 directory, and \n+ 0x00bcfba0 72657374 61727420 796f7572 0a617070 restart your.app\n+ 0x00bcfbb0 2e0a002e 2f737263 2f547574 6f726961 ..../src/Tutoria\n+ 0x00bcfbc0 6c2e6c68 73004e61 6d653a20 20202020 l.lhs.Name: \n 0x00bcfbd0 20202020 20202020 20202070 726f6a6e projn\n 0x00bcfbe0 616d650a 56657273 696f6e3a 20202020 ame.Version: \n 0x00bcfbf0 20202020 20202020 20302e31 0a53796e 0.1.Syn\n 0x00bcfc00 6f707369 733a2020 20202020 20202020 opsis: \n 0x00bcfc10 20205072 6f6a6563 74205379 6e6f7073 Project Synops\n 0x00bcfc20 69732048 6572650a 44657363 72697074 is Here.Descript\n 0x00bcfc30 696f6e3a 20202020 20202020 2050726f ion: Pro\n@@ -1266,803 +1266,803 @@\n 0x00bd0320 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n 0x00bd0330 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n 0x00bd0340 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n 0x00bd0350 2d2d2d0a 74797065 20417070 48616e64 ---.type AppHand\n 0x00bd0360 6c657220 3d204861 6e646c65 72204170 ler = Handler Ap\n 0x00bd0370 70204170 700a0a0a 002e2f73 72632f41 p App...../src/A\n 0x00bd0380 70706c69 63617469 6f6e2e68 73007b2d pplication.hs.{-\n- 0x00bd0390 23204c41 4e475541 4745204f 7665726c # LANGUAGE Overl\n- 0x00bd03a0 6f616465 64537472 696e6773 20232d7d oadedStrings #-}\n- 0x00bd03b0 0a0a2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ..--------------\n- 0x00bd03c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd03d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd03e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd03f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0400 0a2d2d20 7c205468 6973206d 6f64756c .-- | This modul\n- 0x00bd0410 65206973 20776865 72652061 6c6c2074 e is where all t\n- 0x00bd0420 68652072 6f757465 7320616e 64206861 he routes and ha\n- 0x00bd0430 6e646c65 72732061 72652064 6566696e ndlers are defin\n- 0x00bd0440 65642066 6f722079 6f75720a 2d2d2073 ed for your.-- s\n- 0x00bd0450 6974652e 20546865 20276170 70272066 ite. The 'app' f\n- 0x00bd0460 756e6374 696f6e20 69732074 68652069 unction is the i\n- 0x00bd0470 6e697469 616c697a 65722074 68617420 nitializer that \n- 0x00bd0480 636f6d62 696e6573 20657665 72797468 combines everyth\n- 0x00bd0490 696e670a 2d2d2074 6f676574 68657220 ing.-- together \n- 0x00bd04a0 616e6420 69732065 78706f72 74656420 and is exported \n- 0x00bd04b0 62792074 68697320 6d6f6475 6c652e0a by this module..\n- 0x00bd04c0 6d6f6475 6c652053 6974650a 20202820 module Site. ( \n- 0x00bd04d0 6170700a 20202920 77686572 650a0a2d app. ) where..-\n- 0x00bd04e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd04f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0500 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0510 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0520 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d0a696d -------------.im\n- 0x00bd0530 706f7274 20202020 20202020 20202043 port C\n- 0x00bd0540 6f6e7472 6f6c2e41 70706c69 63617469 ontrol.Applicati\n- 0x00bd0550 76650a69 6d706f72 74202020 20202020 ve.import \n- 0x00bd0560 20202020 44617461 2e427974 65537472 Data.ByteStr\n- 0x00bd0570 696e6720 28427974 65537472 696e6729 ing (ByteString)\n- 0x00bd0580 0a696d70 6f727420 20202020 20202020 .import \n- 0x00bd0590 20204461 74612e4d 61702e53 796e7461 Data.Map.Synta\n- 0x00bd05a0 78202828 23232929 0a696d70 6f727420 x ((##)).import \n- 0x00bd05b0 7175616c 69666965 64204461 74612e54 qualified Data.T\n- 0x00bd05c0 65787420 61732054 0a696d70 6f727420 ext as T.import \n- 0x00bd05d0 20202020 20202020 2020536e 61702e43 Snap.C\n- 0x00bd05e0 6f72650a 696d706f 72742020 20202020 ore.import \n- 0x00bd05f0 20202020 20536e61 702e536e 61706c65 Snap.Snaple\n- 0x00bd0600 740a696d 706f7274 20202020 20202020 t.import \n- 0x00bd0610 20202053 6e61702e 536e6170 6c65742e Snap.Snaplet.\n- 0x00bd0620 41757468 0a696d70 6f727420 20202020 Auth.import \n- 0x00bd0630 20202020 2020536e 61702e53 6e61706c Snap.Snapl\n- 0x00bd0640 65742e41 7574682e 4261636b 656e6473 et.Auth.Backends\n- 0x00bd0650 2e4a736f 6e46696c 650a696d 706f7274 .JsonFile.import\n- 0x00bd0660 20202020 20202020 20202053 6e61702e Snap.\n- 0x00bd0670 536e6170 6c65742e 48656973 740a696d Snaplet.Heist.im\n- 0x00bd0680 706f7274 20202020 20202020 20202053 port S\n- 0x00bd0690 6e61702e 536e6170 6c65742e 53657373 nap.Snaplet.Sess\n- 0x00bd06a0 696f6e2e 4261636b 656e6473 2e436f6f ion.Backends.Coo\n- 0x00bd06b0 6b696553 65737369 6f6e0a69 6d706f72 kieSession.impor\n- 0x00bd06c0 74202020 20202020 20202020 536e6170 t Snap\n- 0x00bd06d0 2e557469 6c2e4669 6c655365 7276650a .Util.FileServe.\n- 0x00bd06e0 696d706f 72742071 75616c69 66696564 import qualified\n- 0x00bd06f0 20486569 73742e49 6e746572 70726574 Heist.Interpret\n- 0x00bd0700 65642061 7320490a 2d2d2d2d 2d2d2d2d ed as I.--------\n- 0x00bd0710 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0720 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0730 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0740 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0750 2d2d2d2d 2d2d0a69 6d706f72 74202020 ------.import \n- 0x00bd0760 20202020 20202020 4170706c 69636174 Applicat\n- 0x00bd0770 696f6e0a 0a0a2d2d 2d2d2d2d 2d2d2d2d ion...----------\n+ 0x00bd0390 23204c41 4e475541 47452043 50502020 # LANGUAGE CPP \n+ 0x00bd03a0 20202020 20202020 20202023 2d7d0a7b #-}.{\n+ 0x00bd03b0 2d23204c 414e4755 41474520 54656d70 -# LANGUAGE Temp\n+ 0x00bd03c0 6c617465 4861736b 656c6c20 232d7d0a lateHaskell #-}.\n+ 0x00bd03d0 0a7b2d0a 0a4e4f54 453a2044 6f6e2774 .{-..NOTE: Don't\n+ 0x00bd03e0 206d6f64 69667920 74686973 2066696c modify this fil\n+ 0x00bd03f0 6520756e 6c657373 20796f75 206b6e6f e unless you kno\n+ 0x00bd0400 77207768 61742079 6f752061 72652064 w what you are d\n+ 0x00bd0410 6f696e67 2e202049 6620796f 75206172 oing. If you ar\n+ 0x00bd0420 650a6e65 7720746f 20736e61 702c2073 e.new to snap, s\n+ 0x00bd0430 74617274 20776974 68205369 74652e68 tart with Site.h\n+ 0x00bd0440 7320616e 64204170 706c6963 6174696f s and Applicatio\n+ 0x00bd0450 6e2e6873 2e202054 68697320 66696c65 n.hs. This file\n+ 0x00bd0460 20636f6e 7461696e 730a626f 696c6572 contains.boiler\n+ 0x00bd0470 706c6174 65206e65 65646564 20666f72 plate needed for\n+ 0x00bd0480 2064796e 616d6963 2072656c 6f616469 dynamic reloadi\n+ 0x00bd0490 6e672061 6e642069 73206e6f 74206d65 ng and is not me\n+ 0x00bd04a0 616e7420 666f7220 67656e65 72616c0a ant for general.\n+ 0x00bd04b0 636f6e73 756d7074 696f6e2e 0a0a4f63 consumption...Oc\n+ 0x00bd04c0 63617369 6f6e616c 6c792069 66207765 casionally if we\n+ 0x00bd04d0 206d6f64 69667920 74686520 77617920 modify the way \n+ 0x00bd04e0 74686520 64796e61 6d696320 72656c6f the dynamic relo\n+ 0x00bd04f0 61646572 20776f72 6b732061 6e642079 ader works and y\n+ 0x00bd0500 6f752077 616e7420 746f0a75 70677261 ou want to.upgra\n+ 0x00bd0510 64652c20 796f7520 6d696768 74206861 de, you might ha\n+ 0x00bd0520 76652074 6f207377 6170206f 75742074 ve to swap out t\n+ 0x00bd0530 68697320 66696c65 20666f72 2061206e his file for a n\n+ 0x00bd0540 65776572 20766572 73696f6e 2e202042 ewer version. B\n+ 0x00bd0550 75742069 6e0a6d6f 73742063 61736573 ut in.most cases\n+ 0x00bd0560 20796f75 276c6c20 6e657665 72206e65 you'll never ne\n+ 0x00bd0570 65642074 6f206d6f 64696679 20746869 ed to modify thi\n+ 0x00bd0580 7320636f 64652e0a 0a2d7d0a 6d6f6475 s code...-}.modu\n+ 0x00bd0590 6c65204d 61696e20 77686572 650a0a2d le Main where..-\n+ 0x00bd05a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd05b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd05c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd05d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd05e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d0a696d -------------.im\n+ 0x00bd05f0 706f7274 20202020 20202020 20202043 port C\n+ 0x00bd0600 6f6e7472 6f6c2e45 78636570 74696f6e ontrol.Exception\n+ 0x00bd0610 2028536f 6d654578 63657074 696f6e2c (SomeException,\n+ 0x00bd0620 20747279 290a696d 706f7274 20717561 try).import qua\n+ 0x00bd0630 6c696669 65642044 6174612e 54657874 lified Data.Text\n+ 0x00bd0640 20617320 540a696d 706f7274 20202020 as T.import \n+ 0x00bd0650 20202020 20202053 6e61702e 48747470 Snap.Http\n+ 0x00bd0660 2e536572 7665720a 696d706f 72742020 .Server.import \n+ 0x00bd0670 20202020 20202020 20536e61 702e536e Snap.Sn\n+ 0x00bd0680 61706c65 740a696d 706f7274 20202020 aplet.import \n+ 0x00bd0690 20202020 20202053 6e61702e 536e6170 Snap.Snap\n+ 0x00bd06a0 6c65742e 436f6e66 69670a69 6d706f72 let.Config.impor\n+ 0x00bd06b0 74202020 20202020 20202020 536e6170 t Snap\n+ 0x00bd06c0 2e436f72 650a696d 706f7274 20202020 .Core.import \n+ 0x00bd06d0 20202020 20202053 79737465 6d2e494f System.IO\n+ 0x00bd06e0 0a696d70 6f727420 20202020 20202020 .import \n+ 0x00bd06f0 20205369 74650a0a 23696664 65662044 Site..#ifdef D\n+ 0x00bd0700 4556454c 4f504d45 4e540a69 6d706f72 EVELOPMENT.impor\n+ 0x00bd0710 74202020 20202020 20202020 536e6170 t Snap\n+ 0x00bd0720 2e4c6f61 6465722e 44796e61 6d69630a .Loader.Dynamic.\n+ 0x00bd0730 23656c73 650a696d 706f7274 20202020 #else.import \n+ 0x00bd0740 20202020 20202053 6e61702e 4c6f6164 Snap.Load\n+ 0x00bd0750 65722e53 74617469 630a2365 6e646966 er.Static.#endif\n+ 0x00bd0760 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...-------------\n+ 0x00bd0770 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n 0x00bd0780 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n 0x00bd0790 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n 0x00bd07a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd07b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd07c0 2d2d2d2d 0a2d2d20 7c205265 6e646572 ----.-- | Render\n- 0x00bd07d0 206c6f67 696e2066 6f726d0a 68616e64 login form.hand\n- 0x00bd07e0 6c654c6f 67696e20 3a3a204d 61796265 leLogin :: Maybe\n- 0x00bd07f0 20542e54 65787420 2d3e2048 616e646c T.Text -> Handl\n- 0x00bd0800 65722041 70702028 41757468 4d616e61 er App (AuthMana\n- 0x00bd0810 67657220 41707029 2028290a 68616e64 ger App) ().hand\n- 0x00bd0820 6c654c6f 67696e20 61757468 4572726f leLogin authErro\n- 0x00bd0830 72203d20 68656973 744c6f63 616c2028 r = heistLocal (\n- 0x00bd0840 492e6269 6e645370 6c696365 73206572 I.bindSplices er\n- 0x00bd0850 72732920 24207265 6e646572 20226c6f rs) $ render \"lo\n- 0x00bd0860 67696e22 0a202077 68657265 0a202020 gin\". where. \n- 0x00bd0870 20657272 73203d20 6d617962 65206d65 errs = maybe me\n- 0x00bd0880 6d707479 2073706c 69636520 61757468 mpty splice auth\n- 0x00bd0890 4572726f 720a2020 20207370 6c696365 Error. splice\n- 0x00bd08a0 20657272 203d2022 6c6f6769 6e457272 err = \"loginErr\n- 0x00bd08b0 6f722220 23232049 2e746578 7453706c or\" ## I.textSpl\n- 0x00bd08c0 69636520 6572720a 0a0a2d2d 2d2d2d2d ice err...------\n- 0x00bd08d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd08e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd08f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0900 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0910 2d2d2d2d 2d2d2d2d 0a2d2d20 7c204861 --------.-- | Ha\n- 0x00bd0920 6e646c65 206c6f67 696e2073 75626d69 ndle login submi\n- 0x00bd0930 740a6861 6e646c65 4c6f6769 6e537562 t.handleLoginSub\n- 0x00bd0940 6d697420 3a3a2048 616e646c 65722041 mit :: Handler A\n- 0x00bd0950 70702028 41757468 4d616e61 67657220 pp (AuthManager \n- 0x00bd0960 41707029 2028290a 68616e64 6c654c6f App) ().handleLo\n- 0x00bd0970 67696e53 75626d69 74203d0a 20202020 ginSubmit =. \n- 0x00bd0980 6c6f6769 6e557365 7220226c 6f67696e loginUser \"login\n- 0x00bd0990 22202270 61737377 6f726422 204e6f74 \" \"password\" Not\n- 0x00bd09a0 68696e67 0a202020 20202020 20202020 hing. \n- 0x00bd09b0 20202028 5c5f202d 3e206861 6e646c65 (\\_ -> handle\n- 0x00bd09c0 4c6f6769 6e206572 72292028 72656469 Login err) (redi\n- 0x00bd09d0 72656374 20222f22 290a2020 77686572 rect \"/\"). wher\n- 0x00bd09e0 650a2020 20206572 72203d20 4a757374 e. err = Just\n- 0x00bd09f0 2022556e 6b6e6f77 6e207573 6572206f \"Unknown user o\n- 0x00bd0a00 72207061 7373776f 7264220a 0a0a2d2d r password\"...--\n- 0x00bd0a10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0a20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0a30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0a40 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0a50 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a2d2d20 ------------.-- \n- 0x00bd0a60 7c204c6f 6773206f 75742061 6e642072 | Logs out and r\n- 0x00bd0a70 65646972 65637473 20746865 20757365 edirects the use\n- 0x00bd0a80 7220746f 20746865 20736974 6520696e r to the site in\n- 0x00bd0a90 6465782e 0a68616e 646c654c 6f676f75 dex..handleLogou\n- 0x00bd0aa0 74203a3a 2048616e 646c6572 20417070 t :: Handler App\n- 0x00bd0ab0 20284175 74684d61 6e616765 72204170 (AuthManager Ap\n- 0x00bd0ac0 70292028 290a6861 6e646c65 4c6f676f p) ().handleLogo\n- 0x00bd0ad0 7574203d 206c6f67 6f757420 3e3e2072 ut = logout >> r\n- 0x00bd0ae0 65646972 65637420 222f220a 0a0a2d2d edirect \"/\"...--\n- 0x00bd0af0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0b00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0b10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0b20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0b30 2d2d2d2d 2d2d2d2d 2d2d2d2d 0a2d2d20 ------------.-- \n- 0x00bd0b40 7c204861 6e646c65 206e6577 20757365 | Handle new use\n- 0x00bd0b50 7220666f 726d2073 75626d69 740a6861 r form submit.ha\n- 0x00bd0b60 6e646c65 4e657755 73657220 3a3a2048 ndleNewUser :: H\n- 0x00bd0b70 616e646c 65722041 70702028 41757468 andler App (Auth\n- 0x00bd0b80 4d616e61 67657220 41707029 2028290a Manager App) ().\n- 0x00bd0b90 68616e64 6c654e65 77557365 72203d20 handleNewUser = \n- 0x00bd0ba0 6d657468 6f642047 45542068 616e646c method GET handl\n- 0x00bd0bb0 65466f72 6d203c7c 3e206d65 74686f64 eForm <|> method\n- 0x00bd0bc0 20504f53 54206861 6e646c65 466f726d POST handleForm\n- 0x00bd0bd0 5375626d 69740a20 20776865 72650a20 Submit. where. \n- 0x00bd0be0 20202068 616e646c 65466f72 6d203d20 handleForm = \n- 0x00bd0bf0 72656e64 65722022 6e65775f 75736572 render \"new_user\n- 0x00bd0c00 220a2020 20206861 6e646c65 466f726d \". handleForm\n- 0x00bd0c10 5375626d 6974203d 20726567 69737465 Submit = registe\n- 0x00bd0c20 72557365 7220226c 6f67696e 22202270 rUser \"login\" \"p\n- 0x00bd0c30 61737377 6f726422 203e3e20 72656469 assword\" >> redi\n- 0x00bd0c40 72656374 20222f22 0a0a0a2d 2d2d2d2d rect \"/\"...-----\n- 0x00bd0c50 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0c60 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0c70 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0c80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0c90 2d2d2d2d 2d2d2d2d 2d0a2d2d 207c2054 ---------.-- | T\n- 0x00bd0ca0 68652061 70706c69 63617469 6f6e2773 he application's\n- 0x00bd0cb0 20726f75 7465732e 0a726f75 74657320 routes..routes \n- 0x00bd0cc0 3a3a205b 28427974 65537472 696e672c :: [(ByteString,\n- 0x00bd0cd0 2048616e 646c6572 20417070 20417070 Handler App App\n- 0x00bd0ce0 20282929 5d0a726f 75746573 203d205b ())].routes = [\n- 0x00bd0cf0 2028226c 6f67696e 222c2020 20207769 (\"login\", wi\n- 0x00bd0d00 74682061 75746820 68616e64 6c654c6f th auth handleLo\n- 0x00bd0d10 67696e53 75626d69 74290a20 20202020 ginSubmit). \n- 0x00bd0d20 20202020 2c202822 6c6f676f 7574222c , (\"logout\",\n- 0x00bd0d30 20202077 69746820 61757468 2068616e with auth han\n- 0x00bd0d40 646c654c 6f676f75 74290a20 20202020 dleLogout). \n- 0x00bd0d50 20202020 2c202822 6e65775f 75736572 , (\"new_user\n- 0x00bd0d60 222c2077 69746820 61757468 2068616e \", with auth han\n- 0x00bd0d70 646c654e 65775573 6572290a 20202020 dleNewUser). \n- 0x00bd0d80 20202020 202c2028 22222c20 20202020 , (\"\", \n- 0x00bd0d90 20202020 73657276 65446972 6563746f serveDirecto\n- 0x00bd0da0 72792022 73746174 69632229 0a202020 ry \"static\"). \n- 0x00bd0db0 20202020 20205d0a 0a0a2d2d 2d2d2d2d ]...------\n- 0x00bd0dc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0dd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0de0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0df0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd0e00 2d2d2d2d 2d2d2d2d 0a2d2d20 7c205468 --------.-- | Th\n- 0x00bd0e10 65206170 706c6963 6174696f 6e20696e e application in\n- 0x00bd0e20 69746961 6c697a65 722e0a61 7070203a itializer..app :\n- 0x00bd0e30 3a20536e 61706c65 74496e69 74204170 : SnapletInit Ap\n- 0x00bd0e40 70204170 700a6170 70203d20 6d616b65 p App.app = make\n- 0x00bd0e50 536e6170 6c657420 22617070 22202241 Snaplet \"app\" \"A\n- 0x00bd0e60 6e20736e 61706c65 74206578 616d706c n snaplet exampl\n- 0x00bd0e70 65206170 706c6963 6174696f 6e2e2220 e application.\" \n- 0x00bd0e80 4e6f7468 696e6720 2420646f 0a202020 Nothing $ do. \n- 0x00bd0e90 2068203c 2d206e65 7374536e 61706c65 h <- nestSnaple\n- 0x00bd0ea0 74202222 20686569 73742024 20686569 t \"\" heist $ hei\n- 0x00bd0eb0 7374496e 69742022 74656d70 6c617465 stInit \"template\n- 0x00bd0ec0 73220a20 20202073 203c2d20 6e657374 s\". s <- nest\n- 0x00bd0ed0 536e6170 6c657420 22736573 73222073 Snaplet \"sess\" s\n- 0x00bd0ee0 65737320 240a2020 20202020 20202020 ess $. \n- 0x00bd0ef0 20696e69 74436f6f 6b696553 65737369 initCookieSessi\n- 0x00bd0f00 6f6e4d61 6e616765 72202273 6974655f onManager \"site_\n- 0x00bd0f10 6b65792e 74787422 20227365 73732220 key.txt\" \"sess\" \n- 0x00bd0f20 4e6f7468 696e6720 284a7573 74203336 Nothing (Just 36\n- 0x00bd0f30 3030290a 0a202020 202d2d20 4e4f5445 00).. -- NOTE\n- 0x00bd0f40 3a205765 27726520 7573696e 6720696e : We're using in\n- 0x00bd0f50 69744a73 6f6e4669 6c654175 74684d61 itJsonFileAuthMa\n- 0x00bd0f60 6e616765 72206865 72652062 65636175 nager here becau\n- 0x00bd0f70 73652069 74277320 65617379 20616e64 se it's easy and\n- 0x00bd0f80 0a202020 202d2d20 646f6573 6e277420 . -- doesn't \n- 0x00bd0f90 72657175 69726520 616e7920 6b696e64 require any kind\n- 0x00bd0fa0 206f6620 64617461 62617365 20736572 of database ser\n- 0x00bd0fb0 76657220 746f2072 756e2e20 20496e20 ver to run. In \n- 0x00bd0fc0 70726163 74696365 2c0a2020 20202d2d practice,. --\n- 0x00bd0fd0 20796f75 276c6c20 70726f62 61626c79 you'll probably\n- 0x00bd0fe0 2077616e 7420746f 20636861 6e676520 want to change \n- 0x00bd0ff0 74686973 20746f20 61206d6f 72652072 this to a more r\n- 0x00bd1000 6f627573 74206175 74682062 61636b65 obust auth backe\n- 0x00bd1010 6e642e0a 20202020 61203c2d 206e6573 nd.. a <- nes\n- 0x00bd1020 74536e61 706c6574 20226175 74682220 tSnaplet \"auth\" \n- 0x00bd1030 61757468 20240a20 20202020 20202020 auth $. \n- 0x00bd1040 2020696e 69744a73 6f6e4669 6c654175 initJsonFileAu\n- 0x00bd1050 74684d61 6e616765 72206465 66417574 thManager defAut\n- 0x00bd1060 68536574 74696e67 73207365 73732022 hSettings sess \"\n- 0x00bd1070 75736572 732e6a73 6f6e220a 20202020 users.json\". \n- 0x00bd1080 61646452 6f757465 7320726f 75746573 addRoutes routes\n- 0x00bd1090 0a202020 20616464 41757468 53706c69 . addAuthSpli\n- 0x00bd10a0 63657320 68206175 74680a20 20202072 ces h auth. r\n- 0x00bd10b0 65747572 6e202420 41707020 68207320 eturn $ App h s \n- 0x00bd10c0 610a0a00 2e2f7372 632f5369 74652e68 a..../src/Site.h\n- 0x00bd10d0 73007b2d 23204c41 4e475541 47452043 s.{-# LANGUAGE C\n- 0x00bd10e0 50502020 20202020 20202020 20202023 PP #\n- 0x00bd10f0 2d7d0a7b 2d23204c 414e4755 41474520 -}.{-# LANGUAGE \n- 0x00bd1100 54656d70 6c617465 4861736b 656c6c20 TemplateHaskell \n- 0x00bd1110 232d7d0a 0a7b2d0a 0a4e4f54 453a2044 #-}..{-..NOTE: D\n- 0x00bd1120 6f6e2774 206d6f64 69667920 74686973 on't modify this\n- 0x00bd1130 2066696c 6520756e 6c657373 20796f75 file unless you\n- 0x00bd1140 206b6e6f 77207768 61742079 6f752061 know what you a\n- 0x00bd1150 72652064 6f696e67 2e202049 6620796f re doing. If yo\n- 0x00bd1160 75206172 650a6e65 7720746f 20736e61 u are.new to sna\n- 0x00bd1170 702c2073 74617274 20776974 68205369 p, start with Si\n- 0x00bd1180 74652e68 7320616e 64204170 706c6963 te.hs and Applic\n- 0x00bd1190 6174696f 6e2e6873 2e202054 68697320 ation.hs. This \n- 0x00bd11a0 66696c65 20636f6e 7461696e 730a626f file contains.bo\n- 0x00bd11b0 696c6572 706c6174 65206e65 65646564 ilerplate needed\n- 0x00bd11c0 20666f72 2064796e 616d6963 2072656c for dynamic rel\n- 0x00bd11d0 6f616469 6e672061 6e642069 73206e6f oading and is no\n- 0x00bd11e0 74206d65 616e7420 666f7220 67656e65 t meant for gene\n- 0x00bd11f0 72616c0a 636f6e73 756d7074 696f6e2e ral.consumption.\n- 0x00bd1200 0a0a4f63 63617369 6f6e616c 6c792069 ..Occasionally i\n- 0x00bd1210 66207765 206d6f64 69667920 74686520 f we modify the \n- 0x00bd1220 77617920 74686520 64796e61 6d696320 way the dynamic \n- 0x00bd1230 72656c6f 61646572 20776f72 6b732061 reloader works a\n- 0x00bd1240 6e642079 6f752077 616e7420 746f0a75 nd you want to.u\n- 0x00bd1250 70677261 64652c20 796f7520 6d696768 pgrade, you migh\n- 0x00bd1260 74206861 76652074 6f207377 6170206f t have to swap o\n- 0x00bd1270 75742074 68697320 66696c65 20666f72 ut this file for\n- 0x00bd1280 2061206e 65776572 20766572 73696f6e a newer version\n- 0x00bd1290 2e202042 75742069 6e0a6d6f 73742063 . But in.most c\n- 0x00bd12a0 61736573 20796f75 276c6c20 6e657665 ases you'll neve\n- 0x00bd12b0 72206e65 65642074 6f206d6f 64696679 r need to modify\n- 0x00bd12c0 20746869 7320636f 64652e0a 0a2d7d0a this code...-}.\n- 0x00bd12d0 6d6f6475 6c65204d 61696e20 77686572 module Main wher\n- 0x00bd12e0 650a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d e..-------------\n- 0x00bd12f0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1300 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1310 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1320 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1330 2d0a696d 706f7274 20202020 20202020 -.import \n- 0x00bd1340 20202043 6f6e7472 6f6c2e45 78636570 Control.Excep\n- 0x00bd1350 74696f6e 2028536f 6d654578 63657074 tion (SomeExcept\n- 0x00bd1360 696f6e2c 20747279 290a696d 706f7274 ion, try).import\n- 0x00bd1370 20717561 6c696669 65642044 6174612e qualified Data.\n- 0x00bd1380 54657874 20617320 540a696d 706f7274 Text as T.import\n- 0x00bd1390 20202020 20202020 20202053 6e61702e Snap.\n- 0x00bd13a0 48747470 2e536572 7665720a 696d706f Http.Server.impo\n- 0x00bd13b0 72742020 20202020 20202020 20536e61 rt Sna\n- 0x00bd13c0 702e536e 61706c65 740a696d 706f7274 p.Snaplet.import\n- 0x00bd13d0 20202020 20202020 20202053 6e61702e Snap.\n- 0x00bd13e0 536e6170 6c65742e 436f6e66 69670a69 Snaplet.Config.i\n- 0x00bd13f0 6d706f72 74202020 20202020 20202020 mport \n- 0x00bd1400 536e6170 2e436f72 650a696d 706f7274 Snap.Core.import\n- 0x00bd1410 20202020 20202020 20202053 79737465 Syste\n- 0x00bd1420 6d2e494f 0a696d70 6f727420 20202020 m.IO.import \n- 0x00bd1430 20202020 20205369 74650a0a 23696664 Site..#ifd\n- 0x00bd1440 65662044 4556454c 4f504d45 4e540a69 ef DEVELOPMENT.i\n- 0x00bd1450 6d706f72 74202020 20202020 20202020 mport \n- 0x00bd1460 536e6170 2e4c6f61 6465722e 44796e61 Snap.Loader.Dyna\n- 0x00bd1470 6d69630a 23656c73 650a696d 706f7274 mic.#else.import\n- 0x00bd1480 20202020 20202020 20202053 6e61702e Snap.\n- 0x00bd1490 4c6f6164 65722e53 74617469 630a2365 Loader.Static.#e\n- 0x00bd14a0 6e646966 0a0a0a2d 2d2d2d2d 2d2d2d2d ndif...---------\n- 0x00bd14b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd14c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd14d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd14e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd14f0 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This \n- 0x00bd1500 69732074 68652065 6e747279 20706f69 is the entry poi\n- 0x00bd1510 6e742066 6f722074 68697320 77656220 nt for this web \n- 0x00bd1520 73657276 65722061 70706c69 63617469 server applicati\n- 0x00bd1530 6f6e2e20 49742073 7570706f 7274730a on. It supports.\n- 0x00bd1540 2d2d2065 6173696c 79207377 69746368 -- easily switch\n- 0x00bd1550 696e6720 62657477 65656e20 696e7465 ing between inte\n- 0x00bd1560 72707265 74696e67 20736f75 72636520 rpreting source \n- 0x00bd1570 616e6420 72756e6e 696e6720 73746174 and running stat\n- 0x00bd1580 6963616c 6c792063 6f6d7069 6c65640a ically compiled.\n- 0x00bd1590 2d2d2063 6f64652e 0a2d2d0a 2d2d2049 -- code..--.-- I\n- 0x00bd15a0 6e206569 74686572 206d6f64 652c2074 n either mode, t\n- 0x00bd15b0 68652067 656e6572 61746564 2070726f he generated pro\n- 0x00bd15c0 6772616d 2073686f 756c6420 62652072 gram should be r\n- 0x00bd15d0 756e2066 726f6d20 74686520 726f6f74 un from the root\n- 0x00bd15e0 206f6620 7468650a 2d2d2070 726f6a65 of the.-- proje\n- 0x00bd15f0 63742074 7265652e 20576865 6e206974 ct tree. When it\n- 0x00bd1600 20697320 72756e2c 20697420 6c6f6361 is run, it loca\n- 0x00bd1610 74657320 69747320 74656d70 6c617465 tes its template\n- 0x00bd1620 732c2073 74617469 6320636f 6e74656e s, static conten\n- 0x00bd1630 742c2061 6e640a2d 2d20736f 75726365 t, and.-- source\n- 0x00bd1640 2066696c 65732069 6e206465 76656c6f files in develo\n- 0x00bd1650 706d656e 74206d6f 64652c20 72656c61 pment mode, rela\n- 0x00bd1660 74697665 20746f20 74686520 63757272 tive to the curr\n- 0x00bd1670 656e7420 776f726b 696e6720 64697265 ent working dire\n- 0x00bd1680 63746f72 792e0a2d 2d0a2d2d 20576865 ctory..--.-- Whe\n- 0x00bd1690 6e20636f 6d70696c 65642077 69746820 n compiled with \n- 0x00bd16a0 74686520 64657665 6c6f706d 656e7420 the development \n- 0x00bd16b0 666c6167 2c206f6e 6c792063 68616e67 flag, only chang\n- 0x00bd16c0 65732074 6f207468 65206c69 62726172 es to the librar\n- 0x00bd16d0 6965732c 20796f75 720a2d2d 20636162 ies, your.-- cab\n- 0x00bd16e0 616c2066 696c652c 206f7220 74686973 al file, or this\n- 0x00bd16f0 2066696c 65207368 6f756c64 20726571 file should req\n- 0x00bd1700 75697265 20612072 65636f6d 70696c65 uire a recompile\n- 0x00bd1710 20746f20 62652070 69636b65 64207570 to be picked up\n- 0x00bd1720 2e0a2d2d 20457665 72797468 696e6720 ..-- Everything \n- 0x00bd1730 656c7365 20697320 696e7465 72707265 else is interpre\n- 0x00bd1740 74656420 61742072 756e7469 6d652e20 ted at runtime. \n- 0x00bd1750 54686572 65206172 65206120 66657720 There are a few \n- 0x00bd1760 636f6e73 65717565 6e636573 206f660a consequences of.\n- 0x00bd1770 2d2d2074 6869732e 0a2d2d0a 2d2d2046 -- this..--.-- F\n- 0x00bd1780 69727374 2c207468 69732069 73206d75 irst, this is mu\n- 0x00bd1790 63682073 6c6f7765 722e2052 756e6e69 ch slower. Runni\n- 0x00bd17a0 6e672074 68652069 6e746572 70726574 ng the interpret\n- 0x00bd17b0 65722074 616b6573 20612073 69676e69 er takes a signi\n- 0x00bd17c0 66696361 6e740a2d 2d206368 756e6b20 ficant.-- chunk \n- 0x00bd17d0 6f662074 696d6520 28612063 6f75706c of time (a coupl\n- 0x00bd17e0 65207465 6e746873 206f6620 61207365 e tenths of a se\n- 0x00bd17f0 636f6e64 206f6e20 74686520 61757468 cond on the auth\n- 0x00bd1800 6f722773 206d6163 68696e65 2c206174 or's machine, at\n- 0x00bd1810 20746869 730a2d2d 2074696d 65292c20 this.-- time), \n- 0x00bd1820 72656761 72646c65 7373206f 66207468 regardless of th\n- 0x00bd1830 65207369 6d706c69 63697479 206f6620 e simplicity of \n- 0x00bd1840 74686520 6c6f6164 65642063 6f64652e the loaded code.\n- 0x00bd1850 20496e20 6f726465 7220746f 0a2d2d20 In order to.-- \n- 0x00bd1860 7265636f 6d70696c 6520616e 64207265 recompile and re\n- 0x00bd1870 2d6c6f61 64207365 72766572 20737461 -load server sta\n- 0x00bd1880 74652061 7320696e 66726571 75656e74 te as infrequent\n- 0x00bd1890 6c792061 7320706f 73736962 6c652c20 ly as possible, \n- 0x00bd18a0 74686520 736f7572 63650a2d 2d206469 the source.-- di\n- 0x00bd18b0 72656374 6f726965 73206172 65207761 rectories are wa\n- 0x00bd18c0 74636865 6420666f 72207570 64617465 tched for update\n- 0x00bd18d0 732c2061 73206172 6520616e 79206578 s, as are any ex\n- 0x00bd18e0 74726120 64697265 63746f72 69657320 tra directories \n- 0x00bd18f0 73706563 69666965 640a2d2d 2062656c specified.-- bel\n- 0x00bd1900 6f772e0a 2d2d0a2d 2d205365 636f6e64 ow..--.-- Second\n- 0x00bd1910 2c207468 65206765 6e657261 74656420 , the generated \n- 0x00bd1920 73657276 65722062 696e6172 79206973 server binary is\n- 0x00bd1930 204d5543 48206c61 72676572 2c207369 MUCH larger, si\n- 0x00bd1940 6e636520 6974206c 696e6b73 20696e20 nce it links in \n- 0x00bd1950 7468650a 2d2d2047 48432041 50492028 the.-- GHC API (\n- 0x00bd1960 76696120 74686520 68696e74 206c6962 via the hint lib\n- 0x00bd1970 72617279 292e0a2d 2d0a2d2d 20546869 rary)..--.-- Thi\n- 0x00bd1980 72642c20 616e6420 74686520 72656173 rd, and the reas\n- 0x00bd1990 6f6e2079 6f752077 6f756c64 20657665 on you would eve\n- 0x00bd19a0 72207761 6e742074 6f206163 7475616c r want to actual\n- 0x00bd19b0 6c792063 6f6d7069 6c652077 6974680a ly compile with.\n- 0x00bd19c0 2d2d2064 6576656c 6f706d65 6e74206d -- development m\n- 0x00bd19d0 6f64652c 20697320 74686174 20697420 ode, is that it \n- 0x00bd19e0 656e6162 6c657320 61206661 73746572 enables a faster\n- 0x00bd19f0 20646576 656c6f70 6d656e74 20637963 development cyc\n- 0x00bd1a00 6c652e20 596f7520 63616e0a 2d2d2073 le. You can.-- s\n- 0x00bd1a10 696d706c 79206564 69742061 2066696c imply edit a fil\n- 0x00bd1a20 652c2073 61766520 796f7572 20636861 e, save your cha\n- 0x00bd1a30 6e676573 2c20616e 64206869 74207265 nges, and hit re\n- 0x00bd1a40 6c6f6164 20746f20 73656520 796f7572 load to see your\n- 0x00bd1a50 20636861 6e676573 0a2d2d20 7265666c changes.-- refl\n- 0x00bd1a60 65637465 6420696d 6d656469 6174656c ected immediatel\n- 0x00bd1a70 792e0a2d 2d0a2d2d 20576865 6e207468 y..--.-- When th\n- 0x00bd1a80 69732069 7320636f 6d70696c 65642077 is is compiled w\n- 0x00bd1a90 6974686f 75742074 68652064 6576656c ithout the devel\n- 0x00bd1aa0 6f706d65 6e742066 6c61672c 20616c6c opment flag, all\n- 0x00bd1ab0 20746865 20616374 696f6e73 20617265 the actions are\n- 0x00bd1ac0 0a2d2d20 73746174 6963616c 6c792063 .-- statically c\n- 0x00bd1ad0 6f6d7069 6c656420 696e2e20 54686973 ompiled in. This\n- 0x00bd1ae0 20726573 756c7473 20696e20 66617374 results in fast\n- 0x00bd1af0 65722065 78656375 74696f6e 2c206120 er execution, a \n- 0x00bd1b00 736d616c 6c657220 62696e61 72790a2d smaller binary.-\n- 0x00bd1b10 2d207369 7a652c20 616e6420 68617669 - size, and havi\n- 0x00bd1b20 6e672074 6f207265 636f6d70 696c6520 ng to recompile \n- 0x00bd1b30 74686520 73657276 65722066 6f722061 the server for a\n- 0x00bd1b40 6e792063 6f646520 6368616e 67652e0a ny code change..\n- 0x00bd1b50 2d2d0a6d 61696e20 3a3a2049 4f202829 --.main :: IO ()\n- 0x00bd1b60 0a6d6169 6e203d20 646f0a20 2020202d .main = do. -\n- 0x00bd1b70 2d204465 70656e64 696e6720 6f6e2074 - Depending on t\n- 0x00bd1b80 68652076 65727369 6f6e206f 66206c6f he version of lo\n- 0x00bd1b90 6164536e 61705448 20696e20 73636f70 adSnapTH in scop\n- 0x00bd1ba0 652c2074 68697320 65697468 65722065 e, this either e\n- 0x00bd1bb0 6e61626c 65730a20 2020202d 2d206479 nables. -- dy\n- 0x00bd1bc0 6e616d69 63207265 6c6f6164 696e672c namic reloading,\n- 0x00bd1bd0 206f7220 636f6d70 696c6573 20697420 or compiles it \n- 0x00bd1be0 77697468 6f75742e 20546865 206c6173 without. The las\n- 0x00bd1bf0 74206172 67756d65 6e742074 6f0a2020 t argument to. \n- 0x00bd1c00 20202d2d 206c6f61 64536e61 70544820 -- loadSnapTH \n- 0x00bd1c10 69732061 206c6973 74206f66 20616464 is a list of add\n- 0x00bd1c20 6974696f 6e616c20 64697265 63746f72 itional director\n- 0x00bd1c30 69657320 746f2077 61746368 20666f72 ies to watch for\n- 0x00bd1c40 20636861 6e676573 20746f0a 20202020 changes to. \n- 0x00bd1c50 2d2d2074 72696767 65722072 656c6f61 -- trigger reloa\n- 0x00bd1c60 64732069 6e206465 76656c6f 706d656e ds in developmen\n- 0x00bd1c70 74206d6f 64652e20 49742064 6f65736e t mode. It doesn\n- 0x00bd1c80 2774206e 65656420 746f2069 6e636c75 't need to inclu\n- 0x00bd1c90 64652073 6f757263 650a2020 20202d2d de source. --\n- 0x00bd1ca0 20646972 6563746f 72696573 2c207468 directories, th\n- 0x00bd1cb0 6f736520 61726520 7069636b 65642075 ose are picked u\n- 0x00bd1cc0 70206175 746f6d61 74696361 6c6c7920 p automatically \n- 0x00bd1cd0 62792074 68652073 706c6963 652e0a20 by the splice.. \n- 0x00bd1ce0 20202028 636f6e66 2c207369 74652c20 (conf, site, \n- 0x00bd1cf0 636c6561 6e757029 203c2d20 24286c6f cleanup) <- $(lo\n- 0x00bd1d00 6164536e 61705448 205b7c20 67657443 adSnapTH [| getC\n- 0x00bd1d10 6f6e6620 7c5d0a20 20202020 20202020 onf |]. \n- 0x00bd1d20 20202020 20202020 20202020 20202020 \n- 0x00bd1d30 20202020 20202020 20202020 20202020 \n- 0x00bd1d40 20276765 74416374 696f6e73 0a202020 'getActions. \n- 0x00bd1d50 20202020 20202020 20202020 20202020 \n- 0x00bd1d60 20202020 20202020 20202020 20202020 \n- 0x00bd1d70 20202020 2020205b 22736e61 706c6574 [\"snaplet\n- 0x00bd1d80 732f6865 6973742f 74656d70 6c617465 s/heist/template\n- 0x00bd1d90 73225d29 0a0a2020 20205f20 3c2d2074 s\"]).. _ <- t\n- 0x00bd1da0 72792024 20687474 70536572 76652063 ry $ httpServe c\n- 0x00bd1db0 6f6e6620 73697465 203a3a20 494f2028 onf site :: IO (\n- 0x00bd1dc0 45697468 65722053 6f6d6545 78636570 Either SomeExcep\n- 0x00bd1dd0 74696f6e 20282929 0a202020 20636c65 tion ()). cle\n- 0x00bd1de0 616e7570 0a0a0a2d 2d2d2d2d 2d2d2d2d anup...---------\n- 0x00bd1df0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1e00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1e10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1e20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd1e30 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This \n- 0x00bd1e40 61637469 6f6e206c 6f616473 20746865 action loads the\n- 0x00bd1e50 20636f6e 66696720 75736564 20627920 config used by \n- 0x00bd1e60 74686973 20617070 6c696361 74696f6e this application\n- 0x00bd1e70 2e205468 65206c6f 61646564 20636f6e . The loaded con\n- 0x00bd1e80 6669670a 2d2d2069 73207265 7475726e fig.-- is return\n- 0x00bd1e90 65642061 73207468 65206669 72737420 ed as the first \n- 0x00bd1ea0 656c656d 656e7420 6f662074 68652074 element of the t\n- 0x00bd1eb0 75706c65 2070726f 64756365 64206279 uple produced by\n- 0x00bd1ec0 20746865 206c6f61 64536e61 7054480a the loadSnapTH.\n- 0x00bd1ed0 2d2d2053 706c6963 652e2054 68652074 -- Splice. The t\n- 0x00bd1ee0 79706520 6973206e 6f742073 6f6c6964 ype is not solid\n- 0x00bd1ef0 6c792066 69786564 2c207468 6f756768 ly fixed, though\n- 0x00bd1f00 20697420 6d757374 20626520 616e2049 it must be an I\n- 0x00bd1f10 4f206163 74696f6e 20746861 740a2d2d O action that.--\n- 0x00bd1f20 2070726f 64756365 73207468 65207361 produces the sa\n- 0x00bd1f30 6d652074 79706520 61732027 67657441 me type as 'getA\n- 0x00bd1f40 6374696f 6e732720 74616b65 732e2049 ctions' takes. I\n- 0x00bd1f50 7420616c 736f206d 75737420 62652061 t also must be a\n- 0x00bd1f60 6e20696e 7374616e 6365206f 660a2d2d n instance of.--\n- 0x00bd1f70 20547970 6561626c 652e2049 66207468 Typeable. If th\n- 0x00bd1f80 65207479 7065206f 66207468 69732069 e type of this i\n- 0x00bd1f90 73206368 616e6765 642c2061 2066756c s changed, a ful\n- 0x00bd1fa0 6c207265 636f6d70 696c6520 77696c6c l recompile will\n- 0x00bd1fb0 20626520 6e656564 65642074 6f0a2d2d be needed to.--\n- 0x00bd1fc0 20706963 6b207570 20746865 20636861 pick up the cha\n- 0x00bd1fd0 6e67652c 20657665 6e20696e 20646576 nge, even in dev\n- 0x00bd1fe0 656c6f70 6d656e74 206d6f64 652e0a2d elopment mode..-\n- 0x00bd1ff0 2d0a2d2d 20546869 73206163 74696f6e -.-- This action\n- 0x00bd2000 20697320 6f6e6c79 2072756e 206f6e63 is only run onc\n- 0x00bd2010 652c2072 65676172 646c6573 73206f66 e, regardless of\n- 0x00bd2020 20776865 74686572 20646576 656c6f70 whether develop\n- 0x00bd2030 6d656e74 206f720a 2d2d2070 726f6475 ment or.-- produ\n- 0x00bd2040 6374696f 6e206d6f 64652069 7320696e ction mode is in\n- 0x00bd2050 20757365 2e0a6765 74436f6e 66203a3a use..getConf ::\n- 0x00bd2060 20494f20 28436f6e 66696720 536e6170 IO (Config Snap\n- 0x00bd2070 20417070 436f6e66 6967290a 67657443 AppConfig).getC\n- 0x00bd2080 6f6e6620 3d20636f 6d6d616e 644c696e onf = commandLin\n- 0x00bd2090 65417070 436f6e66 69672064 65666175 eAppConfig defau\n- 0x00bd20a0 6c74436f 6e666967 0a0a0a2d 2d2d2d2d ltConfig...-----\n- 0x00bd20b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd20c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd20d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd20e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n- 0x00bd20f0 2d2d2d2d 2d2d2d2d 2d0a2d2d 207c2054 ---------.-- | T\n- 0x00bd2100 68697320 66756e63 74696f6e 2067656e his function gen\n- 0x00bd2110 65726174 65732074 68652074 68652073 erates the the s\n- 0x00bd2120 69746520 68616e64 6c657220 616e6420 ite handler and \n- 0x00bd2130 636c6561 6e757020 61637469 6f6e2066 cleanup action f\n- 0x00bd2140 726f6d20 7468650a 2d2d2063 6f6e6669 rom the.-- confi\n- 0x00bd2150 67757261 74696f6e 2e20496e 2070726f guration. In pro\n- 0x00bd2160 64756374 696f6e20 6d6f6465 2c207468 duction mode, th\n- 0x00bd2170 69732061 6374696f 6e206973 206f6e6c is action is onl\n- 0x00bd2180 79207275 6e206f6e 63652e20 496e0a2d y run once. In.-\n- 0x00bd2190 2d206465 76656c6f 706d656e 74206d6f - development mo\n- 0x00bd21a0 64652c20 74686973 20616374 696f6e20 de, this action \n- 0x00bd21b0 69732072 756e2077 68656e65 76657220 is run whenever \n- 0x00bd21c0 74686520 6170706c 69636174 696f6e20 the application \n- 0x00bd21d0 69732072 656c6f61 6465642e 0a2d2d0a is reloaded..--.\n- 0x00bd21e0 2d2d2044 6576656c 6f706d65 6e74206d -- Development m\n- 0x00bd21f0 6f646520 616c736f 206d616b 65732073 ode also makes s\n- 0x00bd2200 75726520 74686174 20746865 20636c65 ure that the cle\n- 0x00bd2210 616e7570 20616374 696f6e73 20617265 anup actions are\n- 0x00bd2220 2072756e 0a2d2d20 61707072 6f707269 run.-- appropri\n- 0x00bd2230 6174656c 79206265 666f7265 20736875 ately before shu\n- 0x00bd2240 74646f77 6e2e2054 68652063 6c65616e tdown. The clean\n- 0x00bd2250 75702061 6374696f 6e207265 7475726e up action return\n- 0x00bd2260 65642066 726f6d20 6c6f6164 536e6170 ed from loadSnap\n- 0x00bd2270 54480a2d 2d207368 6f756c64 20737469 TH.-- should sti\n- 0x00bd2280 6c6c2062 65207573 65642061 66746572 ll be used after\n- 0x00bd2290 20746865 20736572 76657220 68617320 the server has \n- 0x00bd22a0 73746f70 70656420 68616e64 6c696e67 stopped handling\n- 0x00bd22b0 20726571 75657374 732c2061 73207468 requests, as th\n- 0x00bd22c0 650a2d2d 20636c65 616e7570 20616374 e.-- cleanup act\n- 0x00bd22d0 696f6e73 20617265 206f6e6c 79206175 ions are only au\n- 0x00bd22e0 746f6d61 74696361 6c6c7920 72756e20 tomatically run \n- 0x00bd22f0 7768656e 20612072 656c6f61 64206973 when a reload is\n- 0x00bd2300 20747269 67676572 65642e0a 2d2d0a2d triggered..--.-\n- 0x00bd2310 2d205468 69732073 616d706c 6520646f - This sample do\n- 0x00bd2320 65736e27 74206163 7475616c 6c792075 esn't actually u\n- 0x00bd2330 73652074 68652063 6f6e6669 67207061 se the config pa\n- 0x00bd2340 73736564 20696e2c 20627574 206d6f72 ssed in, but mor\n- 0x00bd2350 650a2d2d 20736f70 68697374 69636174 e.-- sophisticat\n- 0x00bd2360 65642063 6f646520 6d696768 742e0a67 ed code might..g\n- 0x00bd2370 65744163 74696f6e 73203a3a 20436f6e etActions :: Con\n- 0x00bd2380 66696720 536e6170 20417070 436f6e66 fig Snap AppConf\n- 0x00bd2390 6967202d 3e20494f 2028536e 61702028 ig -> IO (Snap (\n- 0x00bd23a0 292c2049 4f202829 290a6765 74416374 ), IO ()).getAct\n- 0x00bd23b0 696f6e73 20636f6e 66203d20 646f0a20 ions conf = do. \n- 0x00bd23c0 20202028 6d736773 2c207369 74652c20 (msgs, site, \n- 0x00bd23d0 636c6561 6e757029 203c2d20 72756e53 cleanup) <- runS\n- 0x00bd23e0 6e61706c 65740a20 20202020 20202028 naplet. (\n- 0x00bd23f0 61707045 6e766972 6f6e6d65 6e74203d appEnvironment =\n- 0x00bd2400 3c3c2067 65744f74 68657220 636f6e66 << getOther conf\n- 0x00bd2410 29206170 700a2020 20206850 75745374 ) app. hPutSt\n- 0x00bd2420 724c6e20 73746465 72722024 20542e75 rLn stderr $ T.u\n- 0x00bd2430 6e706163 6b206d73 67730a20 20202072 npack msgs. r\n- 0x00bd2440 65747572 6e202873 6974652c 20636c65 eturn (site, cle\n- 0x00bd2450 616e7570 290a003c 6170706c 79207465 anup)... \n- 0x00bd2470 203c6170 706c7920 74656d70 6c617465 .\n- 0x00bd2490 3c2f6170 706c793e 0a002e2f 736e6170 .../snap\n- 0x00bd24a0 6c657473 2f686569 73742f74 656d706c lets/heist/templ\n- 0x00bd24b0 61746573 2f6e6577 5f757365 722e7470 ates/new_user.tp\n- 0x00bd24c0 6c003c68 746d6c3e 0a20203c 68656164 l.. . Sna\n- 0x00bd24e0 70207765 62207365 72766572 3c2f7469 p web server</ti\n- 0x00bd24f0 746c653e 0a202020 203c6c69 6e6b2072 tle>. <link r\n- 0x00bd2500 656c3d22 7374796c 65736865 65742220 el=\"stylesheet\" \n- 0x00bd2510 74797065 3d227465 78742f63 73732220 type=\"text/css\" \n- 0x00bd2520 68726566 3d222f73 63726565 6e2e6373 href=\"/screen.cs\n- 0x00bd2530 73222f3e 0a20203c 2f686561 643e0a20 s\"/>. </head>. \n- 0x00bd2540 203c626f 64793e0a 20202020 3c646976 <body>. <div\n- 0x00bd2550 2069643d 22636f6e 74656e74 223e0a0a id=\"content\">..\n- 0x00bd2560 20202020 20203c61 70706c79 2d636f6e <apply-con\n- 0x00bd2570 74656e74 2f3e0a0a 20202020 3c2f6469 tent/>.. </di\n- 0x00bd2580 763e0a20 203c2f62 6f64793e 0a3c2f68 v>. </body>.</h\n- 0x00bd2590 746d6c3e 0a002e2f 736e6170 6c657473 tml>.../snaplets\n- 0x00bd25a0 2f686569 73742f74 656d706c 61746573 /heist/templates\n- 0x00bd25b0 2f626173 652e7470 6c003c61 70706c79 /base.tpl.<apply\n- 0x00bd25c0 2074656d 706c6174 653d2262 61736522 template=\"base\"\n- 0x00bd25d0 3e0a0a20 203c6966 4c6f6767 6564496e >.. <ifLoggedIn\n- 0x00bd25e0 3e0a2020 20203c70 3e0a2020 20202020 >. <p>. \n- 0x00bd25f0 54686973 20697320 61207369 6d706c65 This is a simple\n- 0x00bd2600 2064656d 6f207061 67652073 65727665 demo page serve\n- 0x00bd2610 64207573 696e670a 20202020 20203c61 d using. <a\n- 0x00bd2620 20687265 663d2268 7474703a 2f2f736e href=\"http://sn\n- 0x00bd2630 61706672 616d6577 6f726b2e 636f6d2f apframework.com/\n- 0x00bd2640 646f6373 2f747574 6f726961 6c732f68 docs/tutorials/h\n- 0x00bd2650 65697374 223e4865 6973743c 2f613e0a eist\">Heist</a>.\n- 0x00bd2660 20202020 2020616e 64207468 65203c61 and the <a\n- 0x00bd2670 20687265 663d2268 7474703a 2f2f736e href=\"http://sn\n- 0x00bd2680 61706672 616d6577 6f726b2e 636f6d2f apframework.com/\n- 0x00bd2690 223e536e 61703c2f 613e2077 65622066 \">Snap</a> web f\n- 0x00bd26a0 72616d65 776f726b 2e0a2020 20203c2f ramework.. </\n- 0x00bd26b0 703e0a0a 20202020 3c703e43 6f6e6772 p>.. <p>Congr\n- 0x00bd26c0 61747321 2020596f 75277265 206c6f67 ats! You're log\n- 0x00bd26d0 67656420 696e2061 7320273c 6c6f6767 ged in as '<logg\n- 0x00bd26e0 6564496e 55736572 2f3e273c 2f703e0a edInUser/>'</p>.\n- 0x00bd26f0 0a202020 203c703e 3c612068 7265663d . <p><a href=\n- 0x00bd2700 222f6c6f 676f7574 223e4c6f 676f7574 \"/logout\">Logout\n- 0x00bd2710 3c2f613e 3c2f703e 0a20203c 2f69664c </a></p>. </ifL\n- 0x00bd2720 6f676765 64496e3e 0a0a2020 3c69664c oggedIn>.. <ifL\n- 0x00bd2730 6f676765 644f7574 3e0a2020 20203c61 oggedOut>. <a\n- 0x00bd2740 70706c79 2074656d 706c6174 653d225f pply template=\"_\n- 0x00bd2750 6c6f6769 6e222f3e 0a20203c 2f69664c login\"/>. </ifL\n- 0x00bd2760 6f676765 644f7574 3e0a0a3c 2f617070 oggedOut>..</app\n- 0x00bd2770 6c793e0a 002e2f73 6e61706c 6574732f ly>.../snaplets/\n- 0x00bd2780 68656973 742f7465 6d706c61 7465732f heist/templates/\n- 0x00bd2790 696e6465 782e7470 6c003c68 313e536e index.tpl.<h1>Sn\n- 0x00bd27a0 61702045 78616d70 6c652041 7070204c ap Example App L\n- 0x00bd27b0 6f67696e 3c2f6831 3e0a0a3c 703e3c6c ogin</h1>..<p><l\n- 0x00bd27c0 6f67696e 4572726f 722f3e3c 2f703e0a oginError/></p>.\n- 0x00bd27d0 0a3c6269 6e642074 61673d22 706f7374 .<bind tag=\"post\n- 0x00bd27e0 41637469 6f6e223e 2f6c6f67 696e3c2f Action\">/login</\n- 0x00bd27f0 62696e64 3e0a3c62 696e6420 7461673d bind>.<bind tag=\n- 0x00bd2800 22737562 6d697454 65787422 3e4c6f67 \"submitText\">Log\n- 0x00bd2810 696e3c2f 62696e64 3e0a3c61 70706c79 in</bind>.<apply\n- 0x00bd2820 2074656d 706c6174 653d2275 73657266 template=\"userf\n- 0x00bd2830 6f726d22 2f3e0a0a 3c703e44 6f6e2774 orm\"/>..<p>Don't\n- 0x00bd2840 20686176 65206120 6c6f6769 6e207965 have a login ye\n- 0x00bd2850 743f203c 61206872 65663d22 2f6e6577 t? <a href=\"/new\n- 0x00bd2860 5f757365 72223e43 72656174 65206120 _user\">Create a \n- 0x00bd2870 6e657720 75736572 3c2f613e 3c2f703e new user</a></p>\n- 0x00bd2880 0a002e2f 736e6170 6c657473 2f686569 .../snaplets/hei\n- 0x00bd2890 73742f74 656d706c 61746573 2f5f6c6f st/templates/_lo\n- 0x00bd28a0 67696e2e 74706c00 3c617070 6c792074 gin.tpl.<apply t\n- 0x00bd28b0 656d706c 6174653d 22626173 65223e0a emplate=\"base\">.\n- 0x00bd28c0 20203c61 70706c79 2074656d 706c6174 <apply templat\n- 0x00bd28d0 653d225f 6c6f6769 6e222f3e 0a3c2f61 e=\"_login\"/>.</a\n- 0x00bd28e0 70706c79 3e0a002e 2f736e61 706c6574 pply>.../snaplet\n- 0x00bd28f0 732f6865 6973742f 74656d70 6c617465 s/heist/template\n- 0x00bd2900 732f6c6f 67696e2e 74706c00 3c68313e s/login.tpl.<h1>\n- 0x00bd2910 52656769 73746572 2061206e 65772075 Register a new u\n- 0x00bd2920 7365723c 2f68313e 0a0a3c62 696e6420 ser</h1>..<bind \n- 0x00bd2930 7461673d 22706f73 74416374 696f6e22 tag=\"postAction\"\n- 0x00bd2940 3e2f6e65 775f7573 65723c2f 62696e64 >/new_user</bind\n- 0x00bd2950 3e0a3c62 696e6420 7461673d 22737562 >.<bind tag=\"sub\n- 0x00bd2960 6d697454 65787422 3e416464 20557365 mitText\">Add Use\n- 0x00bd2970 723c2f62 696e643e 0a3c6170 706c7920 r</bind>.<apply \n- 0x00bd2980 74656d70 6c617465 3d227573 6572666f template=\"userfo\n- 0x00bd2990 726d222f 3e0a002e 2f736e61 706c6574 rm\"/>.../snaplet\n- 0x00bd29a0 732f6865 6973742f 74656d70 6c617465 s/heist/template\n- 0x00bd29b0 732f5f6e 65775f75 7365722e 74706c00 s/_new_user.tpl.\n- 0x00bd29c0 3c666f72 6d206d65 74686f64 3d22706f <form method=\"po\n- 0x00bd29d0 73742220 61637469 6f6e3d22 247b706f st\" action=\"${po\n- 0x00bd29e0 73744163 74696f6e 7d223e0a 20203c74 stAction}\">. <t\n- 0x00bd29f0 61626c65 2069643d 22696e66 6f223e0a able id=\"info\">.\n- 0x00bd2a00 20202020 3c74723e 0a202020 2020203c <tr>. <\n- 0x00bd2a10 74643e4c 6f67696e 3a3c2f74 643e3c74 td>Login:</td><t\n- 0x00bd2a20 643e3c69 6e707574 20747970 653d2274 d><input type=\"t\n- 0x00bd2a30 65787422 206e616d 653d226c 6f67696e ext\" name=\"login\n- 0x00bd2a40 22207369 7a653d22 32302220 2f3e3c2f \" size=\"20\" /></\n- 0x00bd2a50 74643e0a 20202020 3c2f7472 3e0a2020 td>. </tr>. \n- 0x00bd2a60 20203c74 723e0a20 20202020 203c7464 <tr>. <td\n- 0x00bd2a70 3e506173 73776f72 643a3c2f 74643e3c >Password:</td><\n- 0x00bd2a80 74643e3c 696e7075 74207479 70653d22 td><input type=\"\n- 0x00bd2a90 70617373 776f7264 22206e61 6d653d22 password\" name=\"\n- 0x00bd2aa0 70617373 776f7264 22207369 7a653d22 password\" size=\"\n- 0x00bd2ab0 32302220 2f3e3c2f 74643e0a 20202020 20\" /></td>. \n- 0x00bd2ac0 3c2f7472 3e0a2020 20203c74 723e0a20 </tr>. <tr>. \n- 0x00bd2ad0 20202020 203c7464 3e3c2f74 643e0a20 <td></td>. \n- 0x00bd2ae0 20202020 203c7464 3e3c696e 70757420 <td><input \n- 0x00bd2af0 74797065 3d227375 626d6974 22207661 type=\"submit\" va\n- 0x00bd2b00 6c75653d 22247b73 75626d69 74546578 lue=\"${submitTex\n- 0x00bd2b10 747d2220 2f3e3c2f 74643e0a 20202020 t}\" /></td>. \n- 0x00bd2b20 3c2f7472 3e0a2020 3c2f7461 626c653e </tr>. </table>\n- 0x00bd2b30 0a3c2f66 6f726d3e 0a002e2f 736e6170 .</form>.../snap\n+ 0x00bd07b0 2d0a2d2d 207c2054 68697320 69732074 -.-- | This is t\n+ 0x00bd07c0 68652065 6e747279 20706f69 6e742066 he entry point f\n+ 0x00bd07d0 6f722074 68697320 77656220 73657276 or this web serv\n+ 0x00bd07e0 65722061 70706c69 63617469 6f6e2e20 er application. \n+ 0x00bd07f0 49742073 7570706f 7274730a 2d2d2065 It supports.-- e\n+ 0x00bd0800 6173696c 79207377 69746368 696e6720 asily switching \n+ 0x00bd0810 62657477 65656e20 696e7465 72707265 between interpre\n+ 0x00bd0820 74696e67 20736f75 72636520 616e6420 ting source and \n+ 0x00bd0830 72756e6e 696e6720 73746174 6963616c running statical\n+ 0x00bd0840 6c792063 6f6d7069 6c65640a 2d2d2063 ly compiled.-- c\n+ 0x00bd0850 6f64652e 0a2d2d0a 2d2d2049 6e206569 ode..--.-- In ei\n+ 0x00bd0860 74686572 206d6f64 652c2074 68652067 ther mode, the g\n+ 0x00bd0870 656e6572 61746564 2070726f 6772616d enerated program\n+ 0x00bd0880 2073686f 756c6420 62652072 756e2066 should be run f\n+ 0x00bd0890 726f6d20 74686520 726f6f74 206f6620 rom the root of \n+ 0x00bd08a0 7468650a 2d2d2070 726f6a65 63742074 the.-- project t\n+ 0x00bd08b0 7265652e 20576865 6e206974 20697320 ree. When it is \n+ 0x00bd08c0 72756e2c 20697420 6c6f6361 74657320 run, it locates \n+ 0x00bd08d0 69747320 74656d70 6c617465 732c2073 its templates, s\n+ 0x00bd08e0 74617469 6320636f 6e74656e 742c2061 tatic content, a\n+ 0x00bd08f0 6e640a2d 2d20736f 75726365 2066696c nd.-- source fil\n+ 0x00bd0900 65732069 6e206465 76656c6f 706d656e es in developmen\n+ 0x00bd0910 74206d6f 64652c20 72656c61 74697665 t mode, relative\n+ 0x00bd0920 20746f20 74686520 63757272 656e7420 to the current \n+ 0x00bd0930 776f726b 696e6720 64697265 63746f72 working director\n+ 0x00bd0940 792e0a2d 2d0a2d2d 20576865 6e20636f y..--.-- When co\n+ 0x00bd0950 6d70696c 65642077 69746820 74686520 mpiled with the \n+ 0x00bd0960 64657665 6c6f706d 656e7420 666c6167 development flag\n+ 0x00bd0970 2c206f6e 6c792063 68616e67 65732074 , only changes t\n+ 0x00bd0980 6f207468 65206c69 62726172 6965732c o the libraries,\n+ 0x00bd0990 20796f75 720a2d2d 20636162 616c2066 your.-- cabal f\n+ 0x00bd09a0 696c652c 206f7220 74686973 2066696c ile, or this fil\n+ 0x00bd09b0 65207368 6f756c64 20726571 75697265 e should require\n+ 0x00bd09c0 20612072 65636f6d 70696c65 20746f20 a recompile to \n+ 0x00bd09d0 62652070 69636b65 64207570 2e0a2d2d be picked up..--\n+ 0x00bd09e0 20457665 72797468 696e6720 656c7365 Everything else\n+ 0x00bd09f0 20697320 696e7465 72707265 74656420 is interpreted \n+ 0x00bd0a00 61742072 756e7469 6d652e20 54686572 at runtime. Ther\n+ 0x00bd0a10 65206172 65206120 66657720 636f6e73 e are a few cons\n+ 0x00bd0a20 65717565 6e636573 206f660a 2d2d2074 equences of.-- t\n+ 0x00bd0a30 6869732e 0a2d2d0a 2d2d2046 69727374 his..--.-- First\n+ 0x00bd0a40 2c207468 69732069 73206d75 63682073 , this is much s\n+ 0x00bd0a50 6c6f7765 722e2052 756e6e69 6e672074 lower. Running t\n+ 0x00bd0a60 68652069 6e746572 70726574 65722074 he interpreter t\n+ 0x00bd0a70 616b6573 20612073 69676e69 66696361 akes a significa\n+ 0x00bd0a80 6e740a2d 2d206368 756e6b20 6f662074 nt.-- chunk of t\n+ 0x00bd0a90 696d6520 28612063 6f75706c 65207465 ime (a couple te\n+ 0x00bd0aa0 6e746873 206f6620 61207365 636f6e64 nths of a second\n+ 0x00bd0ab0 206f6e20 74686520 61757468 6f722773 on the author's\n+ 0x00bd0ac0 206d6163 68696e65 2c206174 20746869 machine, at thi\n+ 0x00bd0ad0 730a2d2d 2074696d 65292c20 72656761 s.-- time), rega\n+ 0x00bd0ae0 72646c65 7373206f 66207468 65207369 rdless of the si\n+ 0x00bd0af0 6d706c69 63697479 206f6620 74686520 mplicity of the \n+ 0x00bd0b00 6c6f6164 65642063 6f64652e 20496e20 loaded code. In \n+ 0x00bd0b10 6f726465 7220746f 0a2d2d20 7265636f order to.-- reco\n+ 0x00bd0b20 6d70696c 6520616e 64207265 2d6c6f61 mpile and re-loa\n+ 0x00bd0b30 64207365 72766572 20737461 74652061 d server state a\n+ 0x00bd0b40 7320696e 66726571 75656e74 6c792061 s infrequently a\n+ 0x00bd0b50 7320706f 73736962 6c652c20 74686520 s possible, the \n+ 0x00bd0b60 736f7572 63650a2d 2d206469 72656374 source.-- direct\n+ 0x00bd0b70 6f726965 73206172 65207761 74636865 ories are watche\n+ 0x00bd0b80 6420666f 72207570 64617465 732c2061 d for updates, a\n+ 0x00bd0b90 73206172 6520616e 79206578 74726120 s are any extra \n+ 0x00bd0ba0 64697265 63746f72 69657320 73706563 directories spec\n+ 0x00bd0bb0 69666965 640a2d2d 2062656c 6f772e0a ified.-- below..\n+ 0x00bd0bc0 2d2d0a2d 2d205365 636f6e64 2c207468 --.-- Second, th\n+ 0x00bd0bd0 65206765 6e657261 74656420 73657276 e generated serv\n+ 0x00bd0be0 65722062 696e6172 79206973 204d5543 er binary is MUC\n+ 0x00bd0bf0 48206c61 72676572 2c207369 6e636520 H larger, since \n+ 0x00bd0c00 6974206c 696e6b73 20696e20 7468650a it links in the.\n+ 0x00bd0c10 2d2d2047 48432041 50492028 76696120 -- GHC API (via \n+ 0x00bd0c20 74686520 68696e74 206c6962 72617279 the hint library\n+ 0x00bd0c30 292e0a2d 2d0a2d2d 20546869 72642c20 )..--.-- Third, \n+ 0x00bd0c40 616e6420 74686520 72656173 6f6e2079 and the reason y\n+ 0x00bd0c50 6f752077 6f756c64 20657665 72207761 ou would ever wa\n+ 0x00bd0c60 6e742074 6f206163 7475616c 6c792063 nt to actually c\n+ 0x00bd0c70 6f6d7069 6c652077 6974680a 2d2d2064 ompile with.-- d\n+ 0x00bd0c80 6576656c 6f706d65 6e74206d 6f64652c evelopment mode,\n+ 0x00bd0c90 20697320 74686174 20697420 656e6162 is that it enab\n+ 0x00bd0ca0 6c657320 61206661 73746572 20646576 les a faster dev\n+ 0x00bd0cb0 656c6f70 6d656e74 20637963 6c652e20 elopment cycle. \n+ 0x00bd0cc0 596f7520 63616e0a 2d2d2073 696d706c You can.-- simpl\n+ 0x00bd0cd0 79206564 69742061 2066696c 652c2073 y edit a file, s\n+ 0x00bd0ce0 61766520 796f7572 20636861 6e676573 ave your changes\n+ 0x00bd0cf0 2c20616e 64206869 74207265 6c6f6164 , and hit reload\n+ 0x00bd0d00 20746f20 73656520 796f7572 20636861 to see your cha\n+ 0x00bd0d10 6e676573 0a2d2d20 7265666c 65637465 nges.-- reflecte\n+ 0x00bd0d20 6420696d 6d656469 6174656c 792e0a2d d immediately..-\n+ 0x00bd0d30 2d0a2d2d 20576865 6e207468 69732069 -.-- When this i\n+ 0x00bd0d40 7320636f 6d70696c 65642077 6974686f s compiled witho\n+ 0x00bd0d50 75742074 68652064 6576656c 6f706d65 ut the developme\n+ 0x00bd0d60 6e742066 6c61672c 20616c6c 20746865 nt flag, all the\n+ 0x00bd0d70 20616374 696f6e73 20617265 0a2d2d20 actions are.-- \n+ 0x00bd0d80 73746174 6963616c 6c792063 6f6d7069 statically compi\n+ 0x00bd0d90 6c656420 696e2e20 54686973 20726573 led in. This res\n+ 0x00bd0da0 756c7473 20696e20 66617374 65722065 ults in faster e\n+ 0x00bd0db0 78656375 74696f6e 2c206120 736d616c xecution, a smal\n+ 0x00bd0dc0 6c657220 62696e61 72790a2d 2d207369 ler binary.-- si\n+ 0x00bd0dd0 7a652c20 616e6420 68617669 6e672074 ze, and having t\n+ 0x00bd0de0 6f207265 636f6d70 696c6520 74686520 o recompile the \n+ 0x00bd0df0 73657276 65722066 6f722061 6e792063 server for any c\n+ 0x00bd0e00 6f646520 6368616e 67652e0a 2d2d0a6d ode change..--.m\n+ 0x00bd0e10 61696e20 3a3a2049 4f202829 0a6d6169 ain :: IO ().mai\n+ 0x00bd0e20 6e203d20 646f0a20 2020202d 2d204465 n = do. -- De\n+ 0x00bd0e30 70656e64 696e6720 6f6e2074 68652076 pending on the v\n+ 0x00bd0e40 65727369 6f6e206f 66206c6f 6164536e ersion of loadSn\n+ 0x00bd0e50 61705448 20696e20 73636f70 652c2074 apTH in scope, t\n+ 0x00bd0e60 68697320 65697468 65722065 6e61626c his either enabl\n+ 0x00bd0e70 65730a20 2020202d 2d206479 6e616d69 es. -- dynami\n+ 0x00bd0e80 63207265 6c6f6164 696e672c 206f7220 c reloading, or \n+ 0x00bd0e90 636f6d70 696c6573 20697420 77697468 compiles it with\n+ 0x00bd0ea0 6f75742e 20546865 206c6173 74206172 out. The last ar\n+ 0x00bd0eb0 67756d65 6e742074 6f0a2020 20202d2d gument to. --\n+ 0x00bd0ec0 206c6f61 64536e61 70544820 69732061 loadSnapTH is a\n+ 0x00bd0ed0 206c6973 74206f66 20616464 6974696f list of additio\n+ 0x00bd0ee0 6e616c20 64697265 63746f72 69657320 nal directories \n+ 0x00bd0ef0 746f2077 61746368 20666f72 20636861 to watch for cha\n+ 0x00bd0f00 6e676573 20746f0a 20202020 2d2d2074 nges to. -- t\n+ 0x00bd0f10 72696767 65722072 656c6f61 64732069 rigger reloads i\n+ 0x00bd0f20 6e206465 76656c6f 706d656e 74206d6f n development mo\n+ 0x00bd0f30 64652e20 49742064 6f65736e 2774206e de. It doesn't n\n+ 0x00bd0f40 65656420 746f2069 6e636c75 64652073 eed to include s\n+ 0x00bd0f50 6f757263 650a2020 20202d2d 20646972 ource. -- dir\n+ 0x00bd0f60 6563746f 72696573 2c207468 6f736520 ectories, those \n+ 0x00bd0f70 61726520 7069636b 65642075 70206175 are picked up au\n+ 0x00bd0f80 746f6d61 74696361 6c6c7920 62792074 tomatically by t\n+ 0x00bd0f90 68652073 706c6963 652e0a20 20202028 he splice.. (\n+ 0x00bd0fa0 636f6e66 2c207369 74652c20 636c6561 conf, site, clea\n+ 0x00bd0fb0 6e757029 203c2d20 24286c6f 6164536e nup) <- $(loadSn\n+ 0x00bd0fc0 61705448 205b7c20 67657443 6f6e6620 apTH [| getConf \n+ 0x00bd0fd0 7c5d0a20 20202020 20202020 20202020 |]. \n+ 0x00bd0fe0 20202020 20202020 20202020 20202020 \n+ 0x00bd0ff0 20202020 20202020 20202020 20276765 'ge\n+ 0x00bd1000 74416374 696f6e73 0a202020 20202020 tActions. \n+ 0x00bd1010 20202020 20202020 20202020 20202020 \n+ 0x00bd1020 20202020 20202020 20202020 20202020 \n+ 0x00bd1030 2020205b 22736e61 706c6574 732f6865 [\"snaplets/he\n+ 0x00bd1040 6973742f 74656d70 6c617465 73225d29 ist/templates\"])\n+ 0x00bd1050 0a0a2020 20205f20 3c2d2074 72792024 .. _ <- try $\n+ 0x00bd1060 20687474 70536572 76652063 6f6e6620 httpServe conf \n+ 0x00bd1070 73697465 203a3a20 494f2028 45697468 site :: IO (Eith\n+ 0x00bd1080 65722053 6f6d6545 78636570 74696f6e er SomeException\n+ 0x00bd1090 20282929 0a202020 20636c65 616e7570 ()). cleanup\n+ 0x00bd10a0 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...-------------\n+ 0x00bd10b0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd10c0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd10d0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd10e0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd10f0 2d0a2d2d 207c2054 68697320 61637469 -.-- | This acti\n+ 0x00bd1100 6f6e206c 6f616473 20746865 20636f6e on loads the con\n+ 0x00bd1110 66696720 75736564 20627920 74686973 fig used by this\n+ 0x00bd1120 20617070 6c696361 74696f6e 2e205468 application. Th\n+ 0x00bd1130 65206c6f 61646564 20636f6e 6669670a e loaded config.\n+ 0x00bd1140 2d2d2069 73207265 7475726e 65642061 -- is returned a\n+ 0x00bd1150 73207468 65206669 72737420 656c656d s the first elem\n+ 0x00bd1160 656e7420 6f662074 68652074 75706c65 ent of the tuple\n+ 0x00bd1170 2070726f 64756365 64206279 20746865 produced by the\n+ 0x00bd1180 206c6f61 64536e61 7054480a 2d2d2053 loadSnapTH.-- S\n+ 0x00bd1190 706c6963 652e2054 68652074 79706520 plice. The type \n+ 0x00bd11a0 6973206e 6f742073 6f6c6964 6c792066 is not solidly f\n+ 0x00bd11b0 69786564 2c207468 6f756768 20697420 ixed, though it \n+ 0x00bd11c0 6d757374 20626520 616e2049 4f206163 must be an IO ac\n+ 0x00bd11d0 74696f6e 20746861 740a2d2d 2070726f tion that.-- pro\n+ 0x00bd11e0 64756365 73207468 65207361 6d652074 duces the same t\n+ 0x00bd11f0 79706520 61732027 67657441 6374696f ype as 'getActio\n+ 0x00bd1200 6e732720 74616b65 732e2049 7420616c ns' takes. It al\n+ 0x00bd1210 736f206d 75737420 62652061 6e20696e so must be an in\n+ 0x00bd1220 7374616e 6365206f 660a2d2d 20547970 stance of.-- Typ\n+ 0x00bd1230 6561626c 652e2049 66207468 65207479 eable. If the ty\n+ 0x00bd1240 7065206f 66207468 69732069 73206368 pe of this is ch\n+ 0x00bd1250 616e6765 642c2061 2066756c 6c207265 anged, a full re\n+ 0x00bd1260 636f6d70 696c6520 77696c6c 20626520 compile will be \n+ 0x00bd1270 6e656564 65642074 6f0a2d2d 20706963 needed to.-- pic\n+ 0x00bd1280 6b207570 20746865 20636861 6e67652c k up the change,\n+ 0x00bd1290 20657665 6e20696e 20646576 656c6f70 even in develop\n+ 0x00bd12a0 6d656e74 206d6f64 652e0a2d 2d0a2d2d ment mode..--.--\n+ 0x00bd12b0 20546869 73206163 74696f6e 20697320 This action is \n+ 0x00bd12c0 6f6e6c79 2072756e 206f6e63 652c2072 only run once, r\n+ 0x00bd12d0 65676172 646c6573 73206f66 20776865 egardless of whe\n+ 0x00bd12e0 74686572 20646576 656c6f70 6d656e74 ther development\n+ 0x00bd12f0 206f720a 2d2d2070 726f6475 6374696f or.-- productio\n+ 0x00bd1300 6e206d6f 64652069 7320696e 20757365 n mode is in use\n+ 0x00bd1310 2e0a6765 74436f6e 66203a3a 20494f20 ..getConf :: IO \n+ 0x00bd1320 28436f6e 66696720 536e6170 20417070 (Config Snap App\n+ 0x00bd1330 436f6e66 6967290a 67657443 6f6e6620 Config).getConf \n+ 0x00bd1340 3d20636f 6d6d616e 644c696e 65417070 = commandLineApp\n+ 0x00bd1350 436f6e66 69672064 65666175 6c74436f Config defaultCo\n+ 0x00bd1360 6e666967 0a0a0a2d 2d2d2d2d 2d2d2d2d nfig...---------\n+ 0x00bd1370 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1380 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1390 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd13a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd13b0 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This \n+ 0x00bd13c0 66756e63 74696f6e 2067656e 65726174 function generat\n+ 0x00bd13d0 65732074 68652074 68652073 69746520 es the the site \n+ 0x00bd13e0 68616e64 6c657220 616e6420 636c6561 handler and clea\n+ 0x00bd13f0 6e757020 61637469 6f6e2066 726f6d20 nup action from \n+ 0x00bd1400 7468650a 2d2d2063 6f6e6669 67757261 the.-- configura\n+ 0x00bd1410 74696f6e 2e20496e 2070726f 64756374 tion. In product\n+ 0x00bd1420 696f6e20 6d6f6465 2c207468 69732061 ion mode, this a\n+ 0x00bd1430 6374696f 6e206973 206f6e6c 79207275 ction is only ru\n+ 0x00bd1440 6e206f6e 63652e20 496e0a2d 2d206465 n once. In.-- de\n+ 0x00bd1450 76656c6f 706d656e 74206d6f 64652c20 velopment mode, \n+ 0x00bd1460 74686973 20616374 696f6e20 69732072 this action is r\n+ 0x00bd1470 756e2077 68656e65 76657220 74686520 un whenever the \n+ 0x00bd1480 6170706c 69636174 696f6e20 69732072 application is r\n+ 0x00bd1490 656c6f61 6465642e 0a2d2d0a 2d2d2044 eloaded..--.-- D\n+ 0x00bd14a0 6576656c 6f706d65 6e74206d 6f646520 evelopment mode \n+ 0x00bd14b0 616c736f 206d616b 65732073 75726520 also makes sure \n+ 0x00bd14c0 74686174 20746865 20636c65 616e7570 that the cleanup\n+ 0x00bd14d0 20616374 696f6e73 20617265 2072756e actions are run\n+ 0x00bd14e0 0a2d2d20 61707072 6f707269 6174656c .-- appropriatel\n+ 0x00bd14f0 79206265 666f7265 20736875 74646f77 y before shutdow\n+ 0x00bd1500 6e2e2054 68652063 6c65616e 75702061 n. The cleanup a\n+ 0x00bd1510 6374696f 6e207265 7475726e 65642066 ction returned f\n+ 0x00bd1520 726f6d20 6c6f6164 536e6170 54480a2d rom loadSnapTH.-\n+ 0x00bd1530 2d207368 6f756c64 20737469 6c6c2062 - should still b\n+ 0x00bd1540 65207573 65642061 66746572 20746865 e used after the\n+ 0x00bd1550 20736572 76657220 68617320 73746f70 server has stop\n+ 0x00bd1560 70656420 68616e64 6c696e67 20726571 ped handling req\n+ 0x00bd1570 75657374 732c2061 73207468 650a2d2d uests, as the.--\n+ 0x00bd1580 20636c65 616e7570 20616374 696f6e73 cleanup actions\n+ 0x00bd1590 20617265 206f6e6c 79206175 746f6d61 are only automa\n+ 0x00bd15a0 74696361 6c6c7920 72756e20 7768656e tically run when\n+ 0x00bd15b0 20612072 656c6f61 64206973 20747269 a reload is tri\n+ 0x00bd15c0 67676572 65642e0a 2d2d0a2d 2d205468 ggered..--.-- Th\n+ 0x00bd15d0 69732073 616d706c 6520646f 65736e27 is sample doesn'\n+ 0x00bd15e0 74206163 7475616c 6c792075 73652074 t actually use t\n+ 0x00bd15f0 68652063 6f6e6669 67207061 73736564 he config passed\n+ 0x00bd1600 20696e2c 20627574 206d6f72 650a2d2d in, but more.--\n+ 0x00bd1610 20736f70 68697374 69636174 65642063 sophisticated c\n+ 0x00bd1620 6f646520 6d696768 742e0a67 65744163 ode might..getAc\n+ 0x00bd1630 74696f6e 73203a3a 20436f6e 66696720 tions :: Config \n+ 0x00bd1640 536e6170 20417070 436f6e66 6967202d Snap AppConfig -\n+ 0x00bd1650 3e20494f 2028536e 61702028 292c2049 > IO (Snap (), I\n+ 0x00bd1660 4f202829 290a6765 74416374 696f6e73 O ()).getActions\n+ 0x00bd1670 20636f6e 66203d20 646f0a20 20202028 conf = do. (\n+ 0x00bd1680 6d736773 2c207369 74652c20 636c6561 msgs, site, clea\n+ 0x00bd1690 6e757029 203c2d20 72756e53 6e61706c nup) <- runSnapl\n+ 0x00bd16a0 65740a20 20202020 20202028 61707045 et. (appE\n+ 0x00bd16b0 6e766972 6f6e6d65 6e74203d 3c3c2067 nvironment =<< g\n+ 0x00bd16c0 65744f74 68657220 636f6e66 29206170 etOther conf) ap\n+ 0x00bd16d0 700a2020 20206850 75745374 724c6e20 p. hPutStrLn \n+ 0x00bd16e0 73746465 72722024 20542e75 6e706163 stderr $ T.unpac\n+ 0x00bd16f0 6b206d73 67730a20 20202072 65747572 k msgs. retur\n+ 0x00bd1700 6e202873 6974652c 20636c65 616e7570 n (site, cleanup\n+ 0x00bd1710 290a007b 2d23204c 414e4755 41474520 )..{-# LANGUAGE \n+ 0x00bd1720 4f766572 6c6f6164 65645374 72696e67 OverloadedString\n+ 0x00bd1730 7320232d 7d0a0a2d 2d2d2d2d 2d2d2d2d s #-}..---------\n+ 0x00bd1740 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1750 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1760 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1770 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1780 2d2d2d2d 2d0a2d2d 207c2054 68697320 -----.-- | This \n+ 0x00bd1790 6d6f6475 6c652069 73207768 65726520 module is where \n+ 0x00bd17a0 616c6c20 74686520 726f7574 65732061 all the routes a\n+ 0x00bd17b0 6e642068 616e646c 65727320 61726520 nd handlers are \n+ 0x00bd17c0 64656669 6e656420 666f7220 796f7572 defined for your\n+ 0x00bd17d0 0a2d2d20 73697465 2e205468 65202761 .-- site. The 'a\n+ 0x00bd17e0 70702720 66756e63 74696f6e 20697320 pp' function is \n+ 0x00bd17f0 74686520 696e6974 69616c69 7a657220 the initializer \n+ 0x00bd1800 74686174 20636f6d 62696e65 73206576 that combines ev\n+ 0x00bd1810 65727974 68696e67 0a2d2d20 746f6765 erything.-- toge\n+ 0x00bd1820 74686572 20616e64 20697320 6578706f ther and is expo\n+ 0x00bd1830 72746564 20627920 74686973 206d6f64 rted by this mod\n+ 0x00bd1840 756c652e 0a6d6f64 756c6520 53697465 ule..module Site\n+ 0x00bd1850 0a202028 20617070 0a202029 20776865 . ( app. ) whe\n+ 0x00bd1860 72650a0a 2d2d2d2d 2d2d2d2d 2d2d2d2d re..------------\n+ 0x00bd1870 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1880 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1890 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd18a0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd18b0 2d2d0a69 6d706f72 74202020 20202020 --.import \n+ 0x00bd18c0 20202020 436f6e74 726f6c2e 4170706c Control.Appl\n+ 0x00bd18d0 69636174 6976650a 696d706f 72742020 icative.import \n+ 0x00bd18e0 20202020 20202020 20446174 612e4279 Data.By\n+ 0x00bd18f0 74655374 72696e67 20284279 74655374 teString (ByteSt\n+ 0x00bd1900 72696e67 290a696d 706f7274 20202020 ring).import \n+ 0x00bd1910 20202020 20202044 6174612e 4d61702e Data.Map.\n+ 0x00bd1920 53796e74 61782028 28232329 290a696d Syntax ((##)).im\n+ 0x00bd1930 706f7274 20717561 6c696669 65642044 port qualified D\n+ 0x00bd1940 6174612e 54657874 20617320 540a696d ata.Text as T.im\n+ 0x00bd1950 706f7274 20202020 20202020 20202053 port S\n+ 0x00bd1960 6e61702e 436f7265 0a696d70 6f727420 nap.Core.import \n+ 0x00bd1970 20202020 20202020 2020536e 61702e53 Snap.S\n+ 0x00bd1980 6e61706c 65740a69 6d706f72 74202020 naplet.import \n+ 0x00bd1990 20202020 20202020 536e6170 2e536e61 Snap.Sna\n+ 0x00bd19a0 706c6574 2e417574 680a696d 706f7274 plet.Auth.import\n+ 0x00bd19b0 20202020 20202020 20202053 6e61702e Snap.\n+ 0x00bd19c0 536e6170 6c65742e 41757468 2e426163 Snaplet.Auth.Bac\n+ 0x00bd19d0 6b656e64 732e4a73 6f6e4669 6c650a69 kends.JsonFile.i\n+ 0x00bd19e0 6d706f72 74202020 20202020 20202020 mport \n+ 0x00bd19f0 536e6170 2e536e61 706c6574 2e486569 Snap.Snaplet.Hei\n+ 0x00bd1a00 73740a69 6d706f72 74202020 20202020 st.import \n+ 0x00bd1a10 20202020 536e6170 2e536e61 706c6574 Snap.Snaplet\n+ 0x00bd1a20 2e536573 73696f6e 2e426163 6b656e64 .Session.Backend\n+ 0x00bd1a30 732e436f 6f6b6965 53657373 696f6e0a s.CookieSession.\n+ 0x00bd1a40 696d706f 72742020 20202020 20202020 import \n+ 0x00bd1a50 20536e61 702e5574 696c2e46 696c6553 Snap.Util.FileS\n+ 0x00bd1a60 65727665 0a696d70 6f727420 7175616c erve.import qual\n+ 0x00bd1a70 69666965 64204865 6973742e 496e7465 ified Heist.Inte\n+ 0x00bd1a80 72707265 74656420 61732049 0a2d2d2d rpreted as I.---\n+ 0x00bd1a90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1aa0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1ab0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1ac0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1ad0 2d2d2d2d 2d2d2d2d 2d2d2d0a 696d706f -----------.impo\n+ 0x00bd1ae0 72742020 20202020 20202020 20417070 rt App\n+ 0x00bd1af0 6c696361 74696f6e 0a0a0a2d 2d2d2d2d lication...-----\n+ 0x00bd1b00 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1b10 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1b20 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1b30 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1b40 2d2d2d2d 2d2d2d2d 2d0a2d2d 207c2052 ---------.-- | R\n+ 0x00bd1b50 656e6465 72206c6f 67696e20 666f726d ender login form\n+ 0x00bd1b60 0a68616e 646c654c 6f67696e 203a3a20 .handleLogin :: \n+ 0x00bd1b70 4d617962 6520542e 54657874 202d3e20 Maybe T.Text -> \n+ 0x00bd1b80 48616e64 6c657220 41707020 28417574 Handler App (Aut\n+ 0x00bd1b90 684d616e 61676572 20417070 29202829 hManager App) ()\n+ 0x00bd1ba0 0a68616e 646c654c 6f67696e 20617574 .handleLogin aut\n+ 0x00bd1bb0 68457272 6f72203d 20686569 73744c6f hError = heistLo\n+ 0x00bd1bc0 63616c20 28492e62 696e6453 706c6963 cal (I.bindSplic\n+ 0x00bd1bd0 65732065 72727329 20242072 656e6465 es errs) $ rende\n+ 0x00bd1be0 7220226c 6f67696e 220a2020 77686572 r \"login\". wher\n+ 0x00bd1bf0 650a2020 20206572 7273203d 206d6179 e. errs = may\n+ 0x00bd1c00 6265206d 656d7074 79207370 6c696365 be mempty splice\n+ 0x00bd1c10 20617574 68457272 6f720a20 20202073 authError. s\n+ 0x00bd1c20 706c6963 65206572 72203d20 226c6f67 plice err = \"log\n+ 0x00bd1c30 696e4572 726f7222 20232320 492e7465 inError\" ## I.te\n+ 0x00bd1c40 78745370 6c696365 20657272 0a0a0a2d xtSplice err...-\n+ 0x00bd1c50 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1c60 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1c70 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1c80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1c90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d0a2d2d -------------.--\n+ 0x00bd1ca0 207c2048 616e646c 65206c6f 67696e20 | Handle login \n+ 0x00bd1cb0 7375626d 69740a68 616e646c 654c6f67 submit.handleLog\n+ 0x00bd1cc0 696e5375 626d6974 203a3a20 48616e64 inSubmit :: Hand\n+ 0x00bd1cd0 6c657220 41707020 28417574 684d616e ler App (AuthMan\n+ 0x00bd1ce0 61676572 20417070 29202829 0a68616e ager App) ().han\n+ 0x00bd1cf0 646c654c 6f67696e 5375626d 6974203d dleLoginSubmit =\n+ 0x00bd1d00 0a202020 206c6f67 696e5573 65722022 . loginUser \"\n+ 0x00bd1d10 6c6f6769 6e222022 70617373 776f7264 login\" \"password\n+ 0x00bd1d20 22204e6f 7468696e 670a2020 20202020 \" Nothing. \n+ 0x00bd1d30 20202020 20202020 285c5f20 2d3e2068 (\\_ -> h\n+ 0x00bd1d40 616e646c 654c6f67 696e2065 72722920 andleLogin err) \n+ 0x00bd1d50 28726564 69726563 7420222f 22290a20 (redirect \"/\"). \n+ 0x00bd1d60 20776865 72650a20 20202065 7272203d where. err =\n+ 0x00bd1d70 204a7573 74202255 6e6b6e6f 776e2075 Just \"Unknown u\n+ 0x00bd1d80 73657220 6f722070 61737377 6f726422 ser or password\"\n+ 0x00bd1d90 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...-------------\n+ 0x00bd1da0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1db0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1dc0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1dd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1de0 2d0a2d2d 207c204c 6f677320 6f757420 -.-- | Logs out \n+ 0x00bd1df0 616e6420 72656469 72656374 73207468 and redirects th\n+ 0x00bd1e00 65207573 65722074 6f207468 65207369 e user to the si\n+ 0x00bd1e10 74652069 6e646578 2e0a6861 6e646c65 te index..handle\n+ 0x00bd1e20 4c6f676f 7574203a 3a204861 6e646c65 Logout :: Handle\n+ 0x00bd1e30 72204170 70202841 7574684d 616e6167 r App (AuthManag\n+ 0x00bd1e40 65722041 70702920 28290a68 616e646c er App) ().handl\n+ 0x00bd1e50 654c6f67 6f757420 3d206c6f 676f7574 eLogout = logout\n+ 0x00bd1e60 203e3e20 72656469 72656374 20222f22 >> redirect \"/\"\n+ 0x00bd1e70 0a0a0a2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ...-------------\n+ 0x00bd1e80 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1e90 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1ea0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1eb0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1ec0 2d0a2d2d 207c2048 616e646c 65206e65 -.-- | Handle ne\n+ 0x00bd1ed0 77207573 65722066 6f726d20 7375626d w user form subm\n+ 0x00bd1ee0 69740a68 616e646c 654e6577 55736572 it.handleNewUser\n+ 0x00bd1ef0 203a3a20 48616e64 6c657220 41707020 :: Handler App \n+ 0x00bd1f00 28417574 684d616e 61676572 20417070 (AuthManager App\n+ 0x00bd1f10 29202829 0a68616e 646c654e 65775573 ) ().handleNewUs\n+ 0x00bd1f20 6572203d 206d6574 686f6420 47455420 er = method GET \n+ 0x00bd1f30 68616e64 6c65466f 726d203c 7c3e206d handleForm <|> m\n+ 0x00bd1f40 6574686f 6420504f 53542068 616e646c ethod POST handl\n+ 0x00bd1f50 65466f72 6d537562 6d69740a 20207768 eFormSubmit. wh\n+ 0x00bd1f60 6572650a 20202020 68616e64 6c65466f ere. handleFo\n+ 0x00bd1f70 726d203d 2072656e 64657220 226e6577 rm = render \"new\n+ 0x00bd1f80 5f757365 72220a20 20202068 616e646c _user\". handl\n+ 0x00bd1f90 65466f72 6d537562 6d697420 3d207265 eFormSubmit = re\n+ 0x00bd1fa0 67697374 65725573 65722022 6c6f6769 gisterUser \"logi\n+ 0x00bd1fb0 6e222022 70617373 776f7264 22203e3e n\" \"password\" >>\n+ 0x00bd1fc0 20726564 69726563 7420222f 220a0a0a redirect \"/\"...\n+ 0x00bd1fd0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1fe0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd1ff0 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd2000 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd2010 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d0a2d --------------.-\n+ 0x00bd2020 2d207c20 54686520 6170706c 69636174 - | The applicat\n+ 0x00bd2030 696f6e27 7320726f 75746573 2e0a726f ion's routes..ro\n+ 0x00bd2040 75746573 203a3a20 5b284279 74655374 utes :: [(ByteSt\n+ 0x00bd2050 72696e67 2c204861 6e646c65 72204170 ring, Handler Ap\n+ 0x00bd2060 70204170 70202829 295d0a72 6f757465 p App ())].route\n+ 0x00bd2070 73203d20 5b202822 6c6f6769 6e222c20 s = [ (\"login\", \n+ 0x00bd2080 20202077 69746820 61757468 2068616e with auth han\n+ 0x00bd2090 646c654c 6f67696e 5375626d 6974290a dleLoginSubmit).\n+ 0x00bd20a0 20202020 20202020 202c2028 226c6f67 , (\"log\n+ 0x00bd20b0 6f757422 2c202020 77697468 20617574 out\", with aut\n+ 0x00bd20c0 68206861 6e646c65 4c6f676f 7574290a h handleLogout).\n+ 0x00bd20d0 20202020 20202020 202c2028 226e6577 , (\"new\n+ 0x00bd20e0 5f757365 72222c20 77697468 20617574 _user\", with aut\n+ 0x00bd20f0 68206861 6e646c65 4e657755 73657229 h handleNewUser)\n+ 0x00bd2100 0a202020 20202020 20202c20 2822222c . , (\"\",\n+ 0x00bd2110 20202020 20202020 20736572 76654469 serveDi\n+ 0x00bd2120 72656374 6f727920 22737461 74696322 rectory \"static\"\n+ 0x00bd2130 290a2020 20202020 2020205d 0a0a0a2d ). ]...-\n+ 0x00bd2140 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd2150 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd2160 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd2170 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d ----------------\n+ 0x00bd2180 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d0a2d2d -------------.--\n+ 0x00bd2190 207c2054 68652061 70706c69 63617469 | The applicati\n+ 0x00bd21a0 6f6e2069 6e697469 616c697a 65722e0a on initializer..\n+ 0x00bd21b0 61707020 3a3a2053 6e61706c 6574496e app :: SnapletIn\n+ 0x00bd21c0 69742041 70702041 70700a61 7070203d it App App.app =\n+ 0x00bd21d0 206d616b 65536e61 706c6574 20226170 makeSnaplet \"ap\n+ 0x00bd21e0 70222022 416e2073 6e61706c 65742065 p\" \"An snaplet e\n+ 0x00bd21f0 78616d70 6c652061 70706c69 63617469 xample applicati\n+ 0x00bd2200 6f6e2e22 204e6f74 68696e67 20242064 on.\" Nothing $ d\n+ 0x00bd2210 6f0a2020 20206820 3c2d206e 65737453 o. h <- nestS\n+ 0x00bd2220 6e61706c 65742022 22206865 69737420 naplet \"\" heist \n+ 0x00bd2230 24206865 69737449 6e697420 2274656d $ heistInit \"tem\n+ 0x00bd2240 706c6174 6573220a 20202020 73203c2d plates\". s <-\n+ 0x00bd2250 206e6573 74536e61 706c6574 20227365 nestSnaplet \"se\n+ 0x00bd2260 73732220 73657373 20240a20 20202020 ss\" sess $. \n+ 0x00bd2270 20202020 2020696e 6974436f 6f6b6965 initCookie\n+ 0x00bd2280 53657373 696f6e4d 616e6167 65722022 SessionManager \"\n+ 0x00bd2290 73697465 5f6b6579 2e747874 22202273 site_key.txt\" \"s\n+ 0x00bd22a0 65737322 204e6f74 68696e67 20284a75 ess\" Nothing (Ju\n+ 0x00bd22b0 73742033 36303029 0a0a2020 20202d2d st 3600).. --\n+ 0x00bd22c0 204e4f54 453a2057 65277265 20757369 NOTE: We're usi\n+ 0x00bd22d0 6e672069 6e69744a 736f6e46 696c6541 ng initJsonFileA\n+ 0x00bd22e0 7574684d 616e6167 65722068 65726520 uthManager here \n+ 0x00bd22f0 62656361 75736520 69742773 20656173 because it's eas\n+ 0x00bd2300 7920616e 640a2020 20202d2d 20646f65 y and. -- doe\n+ 0x00bd2310 736e2774 20726571 75697265 20616e79 sn't require any\n+ 0x00bd2320 206b696e 64206f66 20646174 61626173 kind of databas\n+ 0x00bd2330 65207365 72766572 20746f20 72756e2e e server to run.\n+ 0x00bd2340 2020496e 20707261 63746963 652c0a20 In practice,. \n+ 0x00bd2350 2020202d 2d20796f 75276c6c 2070726f -- you'll pro\n+ 0x00bd2360 6261626c 79207761 6e742074 6f206368 bably want to ch\n+ 0x00bd2370 616e6765 20746869 7320746f 2061206d ange this to a m\n+ 0x00bd2380 6f726520 726f6275 73742061 75746820 ore robust auth \n+ 0x00bd2390 6261636b 656e642e 0a202020 2061203c backend.. a <\n+ 0x00bd23a0 2d206e65 7374536e 61706c65 74202261 - nestSnaplet \"a\n+ 0x00bd23b0 75746822 20617574 6820240a 20202020 uth\" auth $. \n+ 0x00bd23c0 20202020 20202069 6e69744a 736f6e46 initJsonF\n+ 0x00bd23d0 696c6541 7574684d 616e6167 65722064 ileAuthManager d\n+ 0x00bd23e0 65664175 74685365 7474696e 67732073 efAuthSettings s\n+ 0x00bd23f0 65737320 22757365 72732e6a 736f6e22 ess \"users.json\"\n+ 0x00bd2400 0a202020 20616464 526f7574 65732072 . addRoutes r\n+ 0x00bd2410 6f757465 730a2020 20206164 64417574 outes. addAut\n+ 0x00bd2420 6853706c 69636573 20682061 7574680a hSplices h auth.\n+ 0x00bd2430 20202020 72657475 726e2024 20417070 return $ App\n+ 0x00bd2440 20682073 20610a0a 002e2f73 72632f53 h s a..../src/S\n+ 0x00bd2450 6974652e 6873003c 68746d6c 3e0a2020 ite.hs.<html>. \n+ 0x00bd2460 3c686561 643e0a20 2020203c 7469746c <head>. <titl\n+ 0x00bd2470 653e536e 61702077 65622073 65727665 e>Snap web serve\n+ 0x00bd2480 723c2f74 69746c65 3e0a2020 20203c6c r. . . . \n+ 0x00bd24e0 203c6469 76206964 3d22636f 6e74656e
.. .. \n+ 0x00bd2510 203c2f64 69763e0a 20203c2f 626f6479
. ..../sna\n+ 0x00bd2530 706c6574 732f6865 6973742f 74656d70 plets/heist/temp\n+ 0x00bd2540 6c617465 732f6261 73652e74 706c003c lates/base.tpl.<\n+ 0x00bd2550 68313e53 6e617020 4578616d 706c6520 h1>Snap Example \n+ 0x00bd2560 41707020 4c6f6769 6e3c2f68 313e0a0a App Login..\n+ 0x00bd2570 3c703e3c 6c6f6769 6e457272 6f722f3e

\n+ 0x00bd2580 3c2f703e 0a0a3c62 696e6420 7461673d

../lo\n+ 0x00bd25a0 67696e3c 2f62696e 643e0a3c 62696e64 gin.Login.<\n+ 0x00bd25d0 6170706c 79207465 6d706c61 74653d22 apply template=\"\n+ 0x00bd25e0 75736572 666f726d 222f3e0a 0a3c703e userform\"/>..

\n+ 0x00bd25f0 446f6e27 74206861 76652061 206c6f67 Don't have a log\n+ 0x00bd2600 696e2079 65743f20 3c612068 7265663d in yet? Crea\n+ 0x00bd2620 74652061 206e6577 20757365 723c2f61 te a new user

.../snaplet\n+ 0x00bd2640 732f6865 6973742f 74656d70 6c617465 s/heist/template\n+ 0x00bd2650 732f5f6c 6f67696e 2e74706c 003c6831 s/_login.tpl.Register a new \n+ 0x00bd2670 75736572 3c2f6831 3e0a0a3c 62696e64 user../new_user.Add Us\n+ 0x00bd26c0 65723c2f 62696e64 3e0a3c61 70706c79 er..../snaple\n+ 0x00bd26f0 74732f68 65697374 2f74656d 706c6174 ts/heist/templat\n+ 0x00bd2700 65732f5f 6e65775f 75736572 2e74706c es/_new_user.tpl\n+ 0x00bd2710 003c6170 706c7920 74656d70 6c617465 .. ...\n+ 0x00bd2750 2e2f736e 61706c65 74732f68 65697374 ./snaplets/heist\n+ 0x00bd2760 2f74656d 706c6174 65732f6c 6f67696e /templates/login\n+ 0x00bd2770 2e74706c 003c6170 706c7920 74656d70 .tpl... \n+ 0x00bd2790 3c69664c 6f676765 64496e3e 0a202020 . \n+ 0x00bd27a0 203c703e 0a202020 20202054 68697320

. This \n+ 0x00bd27b0 69732061 2073696d 706c6520 64656d6f is a simple demo\n+ 0x00bd27c0 20706167 65207365 72766564 20757369 page served usi\n+ 0x00bd27d0 6e670a20 20202020 203c6120 68726566 ng. Heist. \n+ 0x00bd2820 20616e64 20746865 203c6120 68726566 and the Sna\n+ 0x00bd2850 703c2f61 3e207765 62206672 616d6577 p web framew\n+ 0x00bd2860 6f726b2e 0a202020 203c2f70 3e0a0a20 ork..

.. \n+ 0x00bd2870 2020203c 703e436f 6e677261 74732120

Congrats! \n+ 0x00bd2880 20596f75 27726520 6c6f6767 65642069 You're logged i\n+ 0x00bd2890 6e206173 20273c6c 6f676765 64496e55 n as ''

.. \n+ 0x00bd28b0 3c703e3c 61206872 65663d22 2f6c6f67

Logout<\n+ 0x00bd28d0 2f703e0a 20203c2f 69664c6f 67676564 /p>. .. . . ....\n+ 0x00bd2930 2e2f736e 61706c65 74732f68 65697374 ./snaplets/heist\n+ 0x00bd2940 2f74656d 706c6174 65732f69 6e646578 /templates/index\n+ 0x00bd2950 2e74706c 003c666f 726d206d 6574686f .tpl.\n+ 0x00bd2980 0a20203c 7461626c 65206964 3d22696e . . . \n+ 0x00bd29a0 20202020 3c74643e 4c6f6769 6e3a3c2f . . . \n+ 0x00bd2a00 20203c74 643e5061 7373776f 72643a3c \n+ 0x00bd2a50 0a202020 203c2f74 723e0a20 2020203c . . <\n+ 0x00bd2a60 74723e0a 20202020 20203c74 643e3c2f tr>. \n+ 0x00bd2ab0 0a202020 203c2f74 723e0a20 203c2f74 . . ....\n+ 0x00bd2ad0 2f736e61 706c6574 732f6865 6973742f /snaplets/heist/\n+ 0x00bd2ae0 74656d70 6c617465 732f7573 6572666f templates/userfo\n+ 0x00bd2af0 726d2e74 706c003c 6170706c 79207465 rm.tpl.. \n+ 0x00bd2b10 203c6170 706c7920 74656d70 6c617465 .\n+ 0x00bd2b30 3c2f6170 706c793e 0a002e2f 736e6170 .../snap\n 0x00bd2b40 6c657473 2f686569 73742f74 656d706c lets/heist/templ\n- 0x00bd2b50 61746573 2f757365 72666f72 6d2e7470 ates/userform.tp\n- 0x00bd2b60 6c006874 6d6c207b 0a202020 70616464 l.html {. padd\n- 0x00bd2b70 696e673a 20303b0a 2020206d 61726769 ing: 0;. margi\n- 0x00bd2b80 6e3a2030 3b0a2020 20626163 6b67726f n: 0;. backgro\n- 0x00bd2b90 756e642d 636f6c6f 723a2023 66666666 und-color: #ffff\n- 0x00bd2ba0 66663b0a 20202066 6f6e742d 66616d69 ff;. font-fami\n- 0x00bd2bb0 6c793a20 56657264 616e612c 2048656c ly: Verdana, Hel\n- 0x00bd2bc0 76657469 63612c20 73616e73 2d736572 vetica, sans-ser\n- 0x00bd2bd0 69663b0a 7d0a626f 6479207b 0a202020 if;.}.body {. \n- 0x00bd2be0 70616464 696e673a 20303b0a 2020206d padding: 0;. m\n- 0x00bd2bf0 61726769 6e3a2030 3b0a7d0a 61207b0a argin: 0;.}.a {.\n- 0x00bd2c00 20202074 6578742d 6465636f 72617469 text-decorati\n- 0x00bd2c10 6f6e3a20 756e6465 726c696e 653b0a7d on: underline;.}\n- 0x00bd2c20 0a61203a 686f7665 72207b0a 20202063 .a :hover {. c\n- 0x00bd2c30 7572736f 723a2070 6f696e74 65723b0a ursor: pointer;.\n- 0x00bd2c40 20202074 6578742d 6465636f 72617469 text-decorati\n- 0x00bd2c50 6f6e3a20 756e6465 726c696e 653b0a7d on: underline;.}\n- 0x00bd2c60 0a696d67 207b0a20 2020626f 72646572 .img {. border\n- 0x00bd2c70 3a206e6f 6e653b0a 7d0a2363 6f6e7465 : none;.}.#conte\n- 0x00bd2c80 6e74207b 0a202020 70616464 696e672d nt {. padding-\n- 0x00bd2c90 6c656674 3a203165 6d3b0a7d 0a23696e left: 1em;.}.#in\n- 0x00bd2ca0 666f207b 0a202020 666f6e74 2d73697a fo {. font-siz\n- 0x00bd2cb0 653a2036 30253b0a 7d0a002e 2f737461 e: 60%;.}.../sta\n- 0x00bd2cc0 7469632f 73637265 656e2e63 7373004e tic/screen.css.N\n- 0x00bd2cd0 616d653a 20202020 20202020 20202020 ame: \n- 0x00bd2ce0 20202020 70726f6a 6e616d65 0a566572 projname.Ver\n- 0x00bd2cf0 73696f6e 3a202020 20202020 20202020 sion: \n- 0x00bd2d00 2020302e 310a5379 6e6f7073 69733a20 0.1.Synopsis: \n- 0x00bd2d10 20202020 20202020 20202050 726f6a65 Proje\n- 0x00bd2d20 63742053 796e6f70 73697320 48657265 ct Synopsis Here\n- 0x00bd2d30 0a446573 63726970 74696f6e 3a202020 .Description: \n- 0x00bd2d40 20202020 20205072 6f6a6563 74204465 Project De\n- 0x00bd2d50 73637269 7074696f 6e204865 72650a4c scription Here.L\n- 0x00bd2d60 6963656e 73653a20 20202020 20202020 icense: \n- 0x00bd2d70 20202020 416c6c52 69676874 73526573 AllRightsRes\n- 0x00bd2d80 65727665 640a4175 74686f72 3a202020 erved.Author: \n- 0x00bd2d90 20202020 20202020 20202041 7574686f Autho\n- 0x00bd2da0 720a4d61 696e7461 696e6572 3a202020 r.Maintainer: \n- 0x00bd2db0 20202020 2020206d 61696e74 61696e65 maintaine\n- 0x00bd2dc0 72406578 616d706c 652e636f 6d0a5374 r@example.com.St\n- 0x00bd2dd0 6162696c 6974793a 20202020 20202020 ability: \n- 0x00bd2de0 20202045 78706572 696d656e 74616c0a Experimental.\n- 0x00bd2df0 43617465 676f7279 3a202020 20202020 Category: \n- 0x00bd2e00 20202020 20576562 0a427569 6c642d74 Web.Build-t\n- 0x00bd2e10 7970653a 20202020 20202020 20205369 ype: Si\n- 0x00bd2e20 6d706c65 0a436162 616c2d76 65727369 mple.Cabal-versi\n- 0x00bd2e30 6f6e3a20 20202020 20203e3d 312e320a on: >=1.2.\n- 0x00bd2e40 0a466c61 67206465 76656c6f 706d656e .Flag developmen\n- 0x00bd2e50 740a2020 44657363 72697074 696f6e3a t. Description:\n- 0x00bd2e60 20576865 74686572 20746f20 6275696c Whether to buil\n- 0x00bd2e70 64207468 65207365 72766572 20696e20 d the server in \n- 0x00bd2e80 64657665 6c6f706d 656e7420 28696e74 development (int\n- 0x00bd2e90 65727072 65746564 29206d6f 64650a20 erpreted) mode. \n- 0x00bd2ea0 20446566 61756c74 3a204661 6c73650a Default: False.\n- 0x00bd2eb0 0a466c61 67206f6c 642d6261 73650a20 .Flag old-base. \n- 0x00bd2ec0 20646566 61756c74 3a204661 6c73650a default: False.\n- 0x00bd2ed0 20206d61 6e75616c 3a204661 6c73650a manual: False.\n- 0x00bd2ee0 0a457865 63757461 626c6520 70726f6a .Executable proj\n- 0x00bd2ef0 6e616d65 0a202068 732d736f 75726365 name. hs-source\n- 0x00bd2f00 2d646972 733a2073 72630a20 206d6169 -dirs: src. mai\n- 0x00bd2f10 6e2d6973 3a204d61 696e2e68 730a0a20 n-is: Main.hs.. \n- 0x00bd2f20 20427569 6c642d64 6570656e 64733a0a Build-depends:.\n- 0x00bd2f30 20202020 62617365 20202020 20202020 base \n- 0x00bd2f40 20202020 20202020 20202020 20203e3d >=\n- 0x00bd2f50 20342e34 20202020 20262620 3c20352c 4.4 && < 5,\n- 0x00bd2f60 0a202020 20627974 65737472 696e6720 . bytestring \n- 0x00bd2f70 20202020 20202020 20202020 2020203e >\n- 0x00bd2f80 3d20302e 392e3120 20202626 203c2030 = 0.9.1 && < 0\n- 0x00bd2f90 2e31312c 0a202020 20686569 73742020 .11,. heist \n- 0x00bd2fa0 20202020 20202020 20202020 20202020 \n- 0x00bd2fb0 2020203e 3d20312e 30202020 20202626 >= 1.0 &&\n- 0x00bd2fc0 203c2031 2e322c0a 20202020 6c656e73 < 1.2,. lens\n- 0x00bd2fd0 20202020 20202020 20202020 20202020 \n- 0x00bd2fe0 20202020 20203e3d 20332e37 2e362020 >= 3.7.6 \n- 0x00bd2ff0 20262620 3c20342e 31382c0a 20202020 && < 4.18,. \n- 0x00bd3000 6d61702d 73796e74 61782020 20202020 map-syntax \n- 0x00bd3010 20202020 20202020 20203e3d 20302e32 >= 0.2\n- 0x00bd3020 20202020 20262620 3c20302e 342c0a20 && < 0.4,. \n- 0x00bd3030 2020206d 6f6e6164 2d636f6e 74726f6c monad-control\n- 0x00bd3040 20202020 20202020 20202020 203e3d20 >= \n- 0x00bd3050 312e3020 20202020 2626203c 20312e31 1.0 && < 1.1\n- 0x00bd3060 2c0a2020 20206d74 6c202020 20202020 ,. mtl \n- 0x00bd3070 20202020 20202020 20202020 20202020 \n- 0x00bd3080 3e3d2032 20202020 20202026 26203c20 >= 2 && < \n- 0x00bd3090 322e332c 0a202020 20736e61 70202020 2.3,. snap \n- 0x00bd30a0 20202020 20202020 20202020 20202020 \n- 0x00bd30b0 2020203e 3d20312e 30202020 20202626 >= 1.0 &&\n- 0x00bd30c0 203c2031 2e322c0a 20202020 736e6170 < 1.2,. snap\n- 0x00bd30d0 2d636f72 65202020 20202020 20202020 -core \n- 0x00bd30e0 20202020 20203e3d 20312e30 20202020 >= 1.0 \n- 0x00bd30f0 20262620 3c20312e 312c0a20 20202073 && < 1.1,. s\n- 0x00bd3100 6e61702d 73657276 65722020 20202020 nap-server \n- 0x00bd3110 20202020 20202020 203e3d20 312e3020 >= 1.0 \n- 0x00bd3120 20202020 2626203c 20312e32 2c0a2020 && < 1.2,. \n- 0x00bd3130 2020736e 61702d6c 6f616465 722d7374 snap-loader-st\n- 0x00bd3140 61746963 20202020 20202020 3e3d2031 atic >= 1\n- 0x00bd3150 2e302020 20202026 26203c20 312e312c .0 && < 1.1,\n- 0x00bd3160 0a202020 20746578 74202020 20202020 . text \n- 0x00bd3170 20202020 20202020 20202020 2020203e >\n- 0x00bd3180 3d20302e 31312020 20202626 203c2031 = 0.11 && < 1\n- 0x00bd3190 2e332c0a 20202020 74696d65 20202020 .3,. time \n- 0x00bd31a0 20202020 20202020 20202020 20202020 \n- 0x00bd31b0 20203e3d 20312e31 20202020 20262620 >= 1.1 && \n- 0x00bd31c0 3c20312e 392c0a20 20202078 6d6c6874 < 1.9,. xmlht\n- 0x00bd31d0 6d6c2020 20202020 20202020 20202020 ml \n- 0x00bd31e0 20202020 203e3d20 302e3120 20202020 >= 0.1 \n- 0x00bd31f0 2626203c 20302e33 0a0a2020 69662066 && < 0.3.. if f\n- 0x00bd3200 6c616728 64657665 6c6f706d 656e7429 lag(development)\n- 0x00bd3210 0a202020 20627569 6c642d64 6570656e . build-depen\n- 0x00bd3220 64733a0a 20202020 2020736e 61702d6c ds:. snap-l\n- 0x00bd3230 6f616465 722d6479 6e616d69 63203e3d oader-dynamic >=\n- 0x00bd3240 20312e30 20262620 3c20312e 310a2020 1.0 && < 1.1. \n- 0x00bd3250 20206370 702d6f70 74696f6e 733a202d cpp-options: -\n- 0x00bd3260 44444556 454c4f50 4d454e54 0a202020 DDEVELOPMENT. \n- 0x00bd3270 202d2d20 496e2064 6576656c 6f706d65 -- In developme\n- 0x00bd3280 6e74206d 6f64652c 20737065 65642069 nt mode, speed i\n- 0x00bd3290 7320616c 72656164 7920676f 696e6720 s already going \n- 0x00bd32a0 746f2073 75666665 722c2073 6f20736b to suffer, so sk\n- 0x00bd32b0 69700a20 2020202d 2d207468 65206661 ip. -- the fa\n- 0x00bd32c0 6e637920 6f707469 6d697a61 74696f6e ncy optimization\n- 0x00bd32d0 20666c61 67732e20 20416464 6974696f flags. Additio\n- 0x00bd32e0 6e616c6c 792c2064 69736162 6c652061 nally, disable a\n- 0x00bd32f0 6c6c0a20 2020202d 2d207761 726e696e ll. -- warnin\n- 0x00bd3300 67732e20 20546865 2068696e 74206c69 gs. The hint li\n- 0x00bd3310 62726172 7920646f 65736e27 74206769 brary doesn't gi\n- 0x00bd3320 76652061 6e206f70 74696f6e 20746f20 ve an option to \n- 0x00bd3330 65786563 7574650a 20202020 2d2d2063 execute. -- c\n- 0x00bd3340 6f6d7069 6c656420 636f6465 20776865 ompiled code whe\n- 0x00bd3350 6e207468 65726520 77657265 20616c73 n there were als\n- 0x00bd3360 6f207761 726e696e 67732c20 736f2064 o warnings, so d\n- 0x00bd3370 69736162 6c696e67 0a202020 202d2d20 isabling. -- \n- 0x00bd3380 7761726e 696e6773 20616c6c 6f777320 warnings allows \n- 0x00bd3390 71756963 6b657220 776f726b 666c6f77 quicker workflow\n- 0x00bd33a0 2e0a2020 20206768 632d6f70 74696f6e .. ghc-option\n- 0x00bd33b0 733a202d 74687265 61646564 202d770a s: -threaded -w.\n- 0x00bd33c0 2020656c 73650a20 20202069 6620696d else. if im\n- 0x00bd33d0 706c2867 6863203e 3d20362e 31322e30 pl(ghc >= 6.12.0\n- 0x00bd33e0 290a2020 20202020 6768632d 6f707469 ). ghc-opti\n- 0x00bd33f0 6f6e733a 202d7468 72656164 6564202d ons: -threaded -\n- 0x00bd3400 57616c6c 202d6677 61726e2d 74616273 Wall -fwarn-tabs\n- 0x00bd3410 202d6675 6e626f78 2d737472 6963742d -funbox-strict-\n- 0x00bd3420 6669656c 6473202d 4f320a20 20202020 fields -O2. \n- 0x00bd3430 20202020 20202020 20202020 20202d66 -f\n- 0x00bd3440 6e6f2d77 61726e2d 6f727068 616e7320 no-warn-orphans \n- 0x00bd3450 2d666e6f 2d776172 6e2d756e 75736564 -fno-warn-unused\n- 0x00bd3460 2d646f2d 62696e64 0a202020 20656c73 -do-bind. els\n- 0x00bd3470 650a2020 20202020 6768632d 6f707469 e. ghc-opti\n- 0x00bd3480 6f6e733a 202d7468 72656164 6564202d ons: -threaded -\n- 0x00bd3490 57616c6c 202d6677 61726e2d 74616273 Wall -fwarn-tabs\n- 0x00bd34a0 202d6675 6e626f78 2d737472 6963742d -funbox-strict-\n- 0x00bd34b0 6669656c 6473202d 4f320a20 20202020 fields -O2. \n- 0x00bd34c0 20202020 20202020 20202020 20202d66 -f\n- 0x00bd34d0 6e6f2d77 61726e2d 6f727068 616e730a no-warn-orphans.\n+ 0x00bd2b50 61746573 2f6e6577 5f757365 722e7470 ates/new_user.tp\n+ 0x00bd2b60 6c004e61 6d653a20 20202020 20202020 l.Name: \n+ 0x00bd2b70 20202020 20202070 726f6a6e 616d650a projname.\n+ 0x00bd2b80 56657273 696f6e3a 20202020 20202020 Version: \n+ 0x00bd2b90 20202020 20302e31 0a53796e 6f707369 0.1.Synopsi\n+ 0x00bd2ba0 733a2020 20202020 20202020 20205072 s: Pr\n+ 0x00bd2bb0 6f6a6563 74205379 6e6f7073 69732048 oject Synopsis H\n+ 0x00bd2bc0 6572650a 44657363 72697074 696f6e3a ere.Description:\n+ 0x00bd2bd0 20202020 20202020 2050726f 6a656374 Project\n+ 0x00bd2be0 20446573 63726970 74696f6e 20486572 Description Her\n+ 0x00bd2bf0 650a4c69 63656e73 653a2020 20202020 e.License: \n+ 0x00bd2c00 20202020 20202041 6c6c5269 67687473 AllRights\n+ 0x00bd2c10 52657365 72766564 0a417574 686f723a Reserved.Author:\n+ 0x00bd2c20 20202020 20202020 20202020 20204175 Au\n+ 0x00bd2c30 74686f72 0a4d6169 6e746169 6e65723a thor.Maintainer:\n+ 0x00bd2c40 20202020 20202020 20206d61 696e7461 mainta\n+ 0x00bd2c50 696e6572 40657861 6d706c65 2e636f6d iner@example.com\n+ 0x00bd2c60 0a537461 62696c69 74793a20 20202020 .Stability: \n+ 0x00bd2c70 20202020 20204578 70657269 6d656e74 Experiment\n+ 0x00bd2c80 616c0a43 61746567 6f72793a 20202020 al.Category: \n+ 0x00bd2c90 20202020 20202020 5765620a 4275696c Web.Buil\n+ 0x00bd2ca0 642d7479 70653a20 20202020 20202020 d-type: \n+ 0x00bd2cb0 2053696d 706c650a 43616261 6c2d7665 Simple.Cabal-ve\n+ 0x00bd2cc0 7273696f 6e3a2020 20202020 203e3d31 rsion: >=1\n+ 0x00bd2cd0 2e320a0a 466c6167 20646576 656c6f70 .2..Flag develop\n+ 0x00bd2ce0 6d656e74 0a202044 65736372 69707469 ment. Descripti\n+ 0x00bd2cf0 6f6e3a20 57686574 68657220 746f2062 on: Whether to b\n+ 0x00bd2d00 75696c64 20746865 20736572 76657220 uild the server \n+ 0x00bd2d10 696e2064 6576656c 6f706d65 6e742028 in development (\n+ 0x00bd2d20 696e7465 72707265 74656429 206d6f64 interpreted) mod\n+ 0x00bd2d30 650a2020 44656661 756c743a 2046616c e. Default: Fal\n+ 0x00bd2d40 73650a0a 466c6167 206f6c64 2d626173 se..Flag old-bas\n+ 0x00bd2d50 650a2020 64656661 756c743a 2046616c e. default: Fal\n+ 0x00bd2d60 73650a20 206d616e 75616c3a 2046616c se. manual: Fal\n+ 0x00bd2d70 73650a0a 45786563 75746162 6c652070 se..Executable p\n+ 0x00bd2d80 726f6a6e 616d650a 20206873 2d736f75 rojname. hs-sou\n+ 0x00bd2d90 7263652d 64697273 3a207372 630a2020 rce-dirs: src. \n+ 0x00bd2da0 6d61696e 2d69733a 204d6169 6e2e6873 main-is: Main.hs\n+ 0x00bd2db0 0a0a2020 4275696c 642d6465 70656e64 .. Build-depend\n+ 0x00bd2dc0 733a0a20 20202062 61736520 20202020 s:. base \n+ 0x00bd2dd0 20202020 20202020 20202020 20202020 \n+ 0x00bd2de0 203e3d20 342e3420 20202020 2626203c >= 4.4 && <\n+ 0x00bd2df0 20352c0a 20202020 62797465 73747269 5,. bytestri\n+ 0x00bd2e00 6e672020 20202020 20202020 20202020 ng \n+ 0x00bd2e10 20203e3d 20302e39 2e312020 20262620 >= 0.9.1 && \n+ 0x00bd2e20 3c20302e 31312c0a 20202020 68656973 < 0.11,. heis\n+ 0x00bd2e30 74202020 20202020 20202020 20202020 t \n+ 0x00bd2e40 20202020 20203e3d 20312e30 20202020 >= 1.0 \n+ 0x00bd2e50 20262620 3c20312e 322c0a20 2020206c && < 1.2,. l\n+ 0x00bd2e60 656e7320 20202020 20202020 20202020 ens \n+ 0x00bd2e70 20202020 20202020 203e3d20 332e372e >= 3.7.\n+ 0x00bd2e80 36202020 2626203c 20342e31 382c0a20 6 && < 4.18,. \n+ 0x00bd2e90 2020206d 61702d73 796e7461 78202020 map-syntax \n+ 0x00bd2ea0 20202020 20202020 20202020 203e3d20 >= \n+ 0x00bd2eb0 302e3220 20202020 2626203c 20302e34 0.2 && < 0.4\n+ 0x00bd2ec0 2c0a2020 20206d6f 6e61642d 636f6e74 ,. monad-cont\n+ 0x00bd2ed0 726f6c20 20202020 20202020 20202020 rol \n+ 0x00bd2ee0 3e3d2031 2e302020 20202026 26203c20 >= 1.0 && < \n+ 0x00bd2ef0 312e312c 0a202020 206d746c 20202020 1.1,. mtl \n+ 0x00bd2f00 20202020 20202020 20202020 20202020 \n+ 0x00bd2f10 2020203e 3d203220 20202020 20202626 >= 2 &&\n+ 0x00bd2f20 203c2032 2e332c0a 20202020 736e6170 < 2.3,. snap\n+ 0x00bd2f30 20202020 20202020 20202020 20202020 \n+ 0x00bd2f40 20202020 20203e3d 20312e30 20202020 >= 1.0 \n+ 0x00bd2f50 20262620 3c20312e 322c0a20 20202073 && < 1.2,. s\n+ 0x00bd2f60 6e61702d 636f7265 20202020 20202020 nap-core \n+ 0x00bd2f70 20202020 20202020 203e3d20 312e3020 >= 1.0 \n+ 0x00bd2f80 20202020 2626203c 20312e31 2c0a2020 && < 1.1,. \n+ 0x00bd2f90 2020736e 61702d73 65727665 72202020 snap-server \n+ 0x00bd2fa0 20202020 20202020 20202020 3e3d2031 >= 1\n+ 0x00bd2fb0 2e302020 20202026 26203c20 312e322c .0 && < 1.2,\n+ 0x00bd2fc0 0a202020 20736e61 702d6c6f 61646572 . snap-loader\n+ 0x00bd2fd0 2d737461 74696320 20202020 2020203e -static >\n+ 0x00bd2fe0 3d20312e 30202020 20202626 203c2031 = 1.0 && < 1\n+ 0x00bd2ff0 2e312c0a 20202020 74657874 20202020 .1,. text \n+ 0x00bd3000 20202020 20202020 20202020 20202020 \n+ 0x00bd3010 20203e3d 20302e31 31202020 20262620 >= 0.11 && \n+ 0x00bd3020 3c20312e 332c0a20 20202074 696d6520 < 1.3,. time \n+ 0x00bd3030 20202020 20202020 20202020 20202020 \n+ 0x00bd3040 20202020 203e3d20 312e3120 20202020 >= 1.1 \n+ 0x00bd3050 2626203c 20312e39 2c0a2020 2020786d && < 1.9,. xm\n+ 0x00bd3060 6c68746d 6c202020 20202020 20202020 lhtml \n+ 0x00bd3070 20202020 20202020 3e3d2030 2e312020 >= 0.1 \n+ 0x00bd3080 20202026 26203c20 302e330a 0a202069 && < 0.3.. i\n+ 0x00bd3090 6620666c 61672864 6576656c 6f706d65 f flag(developme\n+ 0x00bd30a0 6e74290a 20202020 6275696c 642d6465 nt). build-de\n+ 0x00bd30b0 70656e64 733a0a20 20202020 20736e61 pends:. sna\n+ 0x00bd30c0 702d6c6f 61646572 2d64796e 616d6963 p-loader-dynamic\n+ 0x00bd30d0 203e3d20 312e3020 2626203c 20312e31 >= 1.0 && < 1.1\n+ 0x00bd30e0 0a202020 20637070 2d6f7074 696f6e73 . cpp-options\n+ 0x00bd30f0 3a202d44 44455645 4c4f504d 454e540a : -DDEVELOPMENT.\n+ 0x00bd3100 20202020 2d2d2049 6e206465 76656c6f -- In develo\n+ 0x00bd3110 706d656e 74206d6f 64652c20 73706565 pment mode, spee\n+ 0x00bd3120 64206973 20616c72 65616479 20676f69 d is already goi\n+ 0x00bd3130 6e672074 6f207375 66666572 2c20736f ng to suffer, so\n+ 0x00bd3140 20736b69 700a2020 20202d2d 20746865 skip. -- the\n+ 0x00bd3150 2066616e 6379206f 7074696d 697a6174 fancy optimizat\n+ 0x00bd3160 696f6e20 666c6167 732e2020 41646469 ion flags. Addi\n+ 0x00bd3170 74696f6e 616c6c79 2c206469 7361626c tionally, disabl\n+ 0x00bd3180 6520616c 6c0a2020 20202d2d 20776172 e all. -- war\n+ 0x00bd3190 6e696e67 732e2020 54686520 68696e74 nings. The hint\n+ 0x00bd31a0 206c6962 72617279 20646f65 736e2774 library doesn't\n+ 0x00bd31b0 20676976 6520616e 206f7074 696f6e20 give an option \n+ 0x00bd31c0 746f2065 78656375 74650a20 2020202d to execute. -\n+ 0x00bd31d0 2d20636f 6d70696c 65642063 6f646520 - compiled code \n+ 0x00bd31e0 7768656e 20746865 72652077 65726520 when there were \n+ 0x00bd31f0 616c736f 20776172 6e696e67 732c2073 also warnings, s\n+ 0x00bd3200 6f206469 7361626c 696e670a 20202020 o disabling. \n+ 0x00bd3210 2d2d2077 61726e69 6e677320 616c6c6f -- warnings allo\n+ 0x00bd3220 77732071 7569636b 65722077 6f726b66 ws quicker workf\n+ 0x00bd3230 6c6f772e 0a202020 20676863 2d6f7074 low.. ghc-opt\n+ 0x00bd3240 696f6e73 3a202d74 68726561 64656420 ions: -threaded \n+ 0x00bd3250 2d770a20 20656c73 650a2020 20206966 -w. else. if\n+ 0x00bd3260 20696d70 6c286768 63203e3d 20362e31 impl(ghc >= 6.1\n+ 0x00bd3270 322e3029 0a202020 20202067 68632d6f 2.0). ghc-o\n+ 0x00bd3280 7074696f 6e733a20 2d746872 65616465 ptions: -threade\n+ 0x00bd3290 64202d57 616c6c20 2d667761 726e2d74 d -Wall -fwarn-t\n+ 0x00bd32a0 61627320 2d66756e 626f782d 73747269 abs -funbox-stri\n+ 0x00bd32b0 63742d66 69656c64 73202d4f 320a2020 ct-fields -O2. \n+ 0x00bd32c0 20202020 20202020 20202020 20202020 \n+ 0x00bd32d0 202d666e 6f2d7761 726e2d6f 72706861 -fno-warn-orpha\n+ 0x00bd32e0 6e73202d 666e6f2d 7761726e 2d756e75 ns -fno-warn-unu\n+ 0x00bd32f0 7365642d 646f2d62 696e640a 20202020 sed-do-bind. \n+ 0x00bd3300 656c7365 0a202020 20202067 68632d6f else. ghc-o\n+ 0x00bd3310 7074696f 6e733a20 2d746872 65616465 ptions: -threade\n+ 0x00bd3320 64202d57 616c6c20 2d667761 726e2d74 d -Wall -fwarn-t\n+ 0x00bd3330 61627320 2d66756e 626f782d 73747269 abs -funbox-stri\n+ 0x00bd3340 63742d66 69656c64 73202d4f 320a2020 ct-fields -O2. \n+ 0x00bd3350 20202020 20202020 20202020 20202020 \n+ 0x00bd3360 202d666e 6f2d7761 726e2d6f 72706861 -fno-warn-orpha\n+ 0x00bd3370 6e730a00 68746d6c 207b0a20 20207061 ns..html {. pa\n+ 0x00bd3380 6464696e 673a2030 3b0a2020 206d6172 dding: 0;. mar\n+ 0x00bd3390 67696e3a 20303b0a 20202062 61636b67 gin: 0;. backg\n+ 0x00bd33a0 726f756e 642d636f 6c6f723a 20236666 round-color: #ff\n+ 0x00bd33b0 66666666 3b0a2020 20666f6e 742d6661 ffff;. font-fa\n+ 0x00bd33c0 6d696c79 3a205665 7264616e 612c2048 mily: Verdana, H\n+ 0x00bd33d0 656c7665 74696361 2c207361 6e732d73 elvetica, sans-s\n+ 0x00bd33e0 65726966 3b0a7d0a 626f6479 207b0a20 erif;.}.body {. \n+ 0x00bd33f0 20207061 6464696e 673a2030 3b0a2020 padding: 0;. \n+ 0x00bd3400 206d6172 67696e3a 20303b0a 7d0a6120 margin: 0;.}.a \n+ 0x00bd3410 7b0a2020 20746578 742d6465 636f7261 {. text-decora\n+ 0x00bd3420 74696f6e 3a20756e 6465726c 696e653b tion: underline;\n+ 0x00bd3430 0a7d0a61 203a686f 76657220 7b0a2020 .}.a :hover {. \n+ 0x00bd3440 20637572 736f723a 20706f69 6e746572 cursor: pointer\n+ 0x00bd3450 3b0a2020 20746578 742d6465 636f7261 ;. text-decora\n+ 0x00bd3460 74696f6e 3a20756e 6465726c 696e653b tion: underline;\n+ 0x00bd3470 0a7d0a69 6d67207b 0a202020 626f7264 .}.img {. bord\n+ 0x00bd3480 65723a20 6e6f6e65 3b0a7d0a 23636f6e er: none;.}.#con\n+ 0x00bd3490 74656e74 207b0a20 20207061 6464696e tent {. paddin\n+ 0x00bd34a0 672d6c65 66743a20 31656d3b 0a7d0a23 g-left: 1em;.}.#\n+ 0x00bd34b0 696e666f 207b0a20 2020666f 6e742d73 info {. font-s\n+ 0x00bd34c0 697a653a 20363025 3b0a7d0a 002e2f73 ize: 60%;.}.../s\n+ 0x00bd34d0 74617469 632f7363 7265656e 2e637373 tatic/screen.css\n 0x00bd34e0 002e2f73 6e61706c 6574732f 68656973 ../snaplets/heis\n 0x00bd34f0 742f7465 6d706c61 74657300 2e2f736e t/templates../sn\n 0x00bd3500 61706c65 74732f68 65697374 002e2f73 aplets/heist../s\n 0x00bd3510 6e61706c 65747300 2e2f7374 61746963 naplets../static\n 0x00bd3520 007b2d23 204c414e 47554147 45204f76 .{-# LANGUAGE Ov\n 0x00bd3530 65726c6f 61646564 53747269 6e677320 erloadedStrings \n 0x00bd3540 232d7d0a 6d6f6475 6c65204d 61696e20 #-}.module Main \n@@ -2098,79 +2098,79 @@\n 0x00bd3720 20287772 69746542 5320226d 75737420 (writeBS \"must \n 0x00bd3730 73706563 69667920 6563686f 2f706172 specify echo/par\n 0x00bd3740 616d2069 6e205552 4c22290a 20202020 am in URL\"). \n 0x00bd3750 20202020 20207772 69746542 53207061 writeBS pa\n 0x00bd3760 72616d0a 002e2f73 72632f4d 61696e2e ram.../src/Main.\n 0x00bd3770 68730070 6c616365 686f6c64 65720a00 hs.placeholder..\n 0x00bd3780 2e2f6c6f 672f706c 61636568 6f6c6465 ./log/placeholde\n- 0x00bd3790 72003a73 6574202d 69737263 0a3a7365 r.:set -isrc.:se\n- 0x00bd37a0 74202d68 6964652d 7061636b 61676520 t -hide-package \n- 0x00bd37b0 4d6f6e61 64436174 6368494f 2d6d746c MonadCatchIO-mtl\n- 0x00bd37c0 0a3a7365 74202d68 6964652d 7061636b .:set -hide-pack\n- 0x00bd37d0 61676520 6d6f6e61 64732d66 640a3a73 age monads-fd.:s\n- 0x00bd37e0 6574202d 584f7665 726c6f61 64656453 et -XOverloadedS\n- 0x00bd37f0 7472696e 67730a00 2e2f2e67 68636900 trings.../.ghci.\n- 0x00bd3800 4e616d65 3a202020 20202020 20202020 Name: \n- 0x00bd3810 20202020 2070726f 6a6e616d 650a5665 projname.Ve\n- 0x00bd3820 7273696f 6e3a2020 20202020 20202020 rsion: \n- 0x00bd3830 20202030 2e310a53 796e6f70 7369733a 0.1.Synopsis:\n- 0x00bd3840 20202020 20202020 20202020 50726f6a Proj\n- 0x00bd3850 65637420 53796e6f 70736973 20486572 ect Synopsis Her\n- 0x00bd3860 650a4465 73637269 7074696f 6e3a2020 e.Description: \n- 0x00bd3870 20202020 20202050 726f6a65 63742044 Project D\n- 0x00bd3880 65736372 69707469 6f6e2048 6572650a escription Here.\n- 0x00bd3890 4c696365 6e73653a 20202020 20202020 License: \n- 0x00bd38a0 20202020 20416c6c 52696768 74735265 AllRightsRe\n- 0x00bd38b0 73657276 65640a41 7574686f 723a2020 served.Author: \n- 0x00bd38c0 20202020 20202020 20202020 41757468 Auth\n- 0x00bd38d0 6f720a4d 61696e74 61696e65 723a2020 or.Maintainer: \n- 0x00bd38e0 20202020 20202020 6d61696e 7461696e maintain\n- 0x00bd38f0 65724065 78616d70 6c652e63 6f6d0a53 er@example.com.S\n- 0x00bd3900 74616269 6c697479 3a202020 20202020 tability: \n- 0x00bd3910 20202020 45787065 72696d65 6e74616c Experimental\n- 0x00bd3920 0a436174 65676f72 793a2020 20202020 .Category: \n- 0x00bd3930 20202020 20205765 620a4275 696c642d Web.Build-\n- 0x00bd3940 74797065 3a202020 20202020 20202053 type: S\n- 0x00bd3950 696d706c 650a4361 62616c2d 76657273 imple.Cabal-vers\n- 0x00bd3960 696f6e3a 20202020 2020203e 3d312e32 ion: >=1.2\n- 0x00bd3970 0a0a4578 65637574 61626c65 2070726f ..Executable pro\n- 0x00bd3980 6a6e616d 650a2020 68732d73 6f757263 jname. hs-sourc\n- 0x00bd3990 652d6469 72733a20 7372630a 20206d61 e-dirs: src. ma\n- 0x00bd39a0 696e2d69 733a204d 61696e2e 68730a0a in-is: Main.hs..\n- 0x00bd39b0 20204275 696c642d 64657065 6e64733a Build-depends:\n- 0x00bd39c0 0a202020 20626173 65202020 20202020 . base \n- 0x00bd39d0 20202020 20202020 20202020 2020203e >\n- 0x00bd39e0 3d203420 20202020 2626203c 20352c0a = 4 && < 5,.\n- 0x00bd39f0 20202020 62797465 73747269 6e672020 bytestring \n- 0x00bd3a00 20202020 20202020 20202020 20203e3d >=\n- 0x00bd3a10 20302e39 2e312026 26203c20 302e3131 0.9.1 && < 0.11\n- 0x00bd3a20 2c0a2020 20206d74 6c202020 20202020 ,. mtl \n- 0x00bd3a30 20202020 20202020 20202020 20202020 \n- 0x00bd3a40 3e3d2032 20202020 20262620 3c20332c >= 2 && < 3,\n- 0x00bd3a50 0a202020 20736e61 702d636f 72652020 . snap-core \n- 0x00bd3a60 20202020 20202020 20202020 2020203e >\n- 0x00bd3a70 3d20312e 30202020 2626203c 20312e31 = 1.0 && < 1.1\n- 0x00bd3a80 2c0a2020 2020736e 61702d73 65727665 ,. snap-serve\n- 0x00bd3a90 72202020 20202020 20202020 20202020 r \n- 0x00bd3aa0 3e3d2031 2e302020 20262620 3c20312e >= 1.0 && < 1.\n- 0x00bd3ab0 320a0a20 20696620 696d706c 28676863 2.. if impl(ghc\n- 0x00bd3ac0 203e3d20 362e3132 2e30290a 20202020 >= 6.12.0). \n- 0x00bd3ad0 6768632d 6f707469 6f6e733a 202d7468 ghc-options: -th\n- 0x00bd3ae0 72656164 6564202d 57616c6c 202d6677 readed -Wall -fw\n- 0x00bd3af0 61726e2d 74616273 202d6675 6e626f78 arn-tabs -funbox\n- 0x00bd3b00 2d737472 6963742d 6669656c 6473202d -strict-fields -\n- 0x00bd3b10 4f320a20 20202020 20202020 20202020 O2. \n- 0x00bd3b20 20202020 2d666e6f 2d776172 6e2d756e -fno-warn-un\n- 0x00bd3b30 75736564 2d646f2d 62696e64 0a202065 used-do-bind. e\n- 0x00bd3b40 6c73650a 20202020 6768632d 6f707469 lse. ghc-opti\n- 0x00bd3b50 6f6e733a 202d7468 72656164 6564202d ons: -threaded -\n- 0x00bd3b60 57616c6c 202d6677 61726e2d 74616273 Wall -fwarn-tabs\n- 0x00bd3b70 202d6675 6e626f78 2d737472 6963742d -funbox-strict-\n- 0x00bd3b80 6669656c 6473202d 4f320a00 2e2f666f fields -O2.../fo\n- 0x00bd3b90 6f2e6361 62616c00 2e2f7372 63002e2f o.cabal../src../\n+ 0x00bd3790 72004e61 6d653a20 20202020 20202020 r.Name: \n+ 0x00bd37a0 20202020 20202070 726f6a6e 616d650a projname.\n+ 0x00bd37b0 56657273 696f6e3a 20202020 20202020 Version: \n+ 0x00bd37c0 20202020 20302e31 0a53796e 6f707369 0.1.Synopsi\n+ 0x00bd37d0 733a2020 20202020 20202020 20205072 s: Pr\n+ 0x00bd37e0 6f6a6563 74205379 6e6f7073 69732048 oject Synopsis H\n+ 0x00bd37f0 6572650a 44657363 72697074 696f6e3a ere.Description:\n+ 0x00bd3800 20202020 20202020 2050726f 6a656374 Project\n+ 0x00bd3810 20446573 63726970 74696f6e 20486572 Description Her\n+ 0x00bd3820 650a4c69 63656e73 653a2020 20202020 e.License: \n+ 0x00bd3830 20202020 20202041 6c6c5269 67687473 AllRights\n+ 0x00bd3840 52657365 72766564 0a417574 686f723a Reserved.Author:\n+ 0x00bd3850 20202020 20202020 20202020 20204175 Au\n+ 0x00bd3860 74686f72 0a4d6169 6e746169 6e65723a thor.Maintainer:\n+ 0x00bd3870 20202020 20202020 20206d61 696e7461 mainta\n+ 0x00bd3880 696e6572 40657861 6d706c65 2e636f6d iner@example.com\n+ 0x00bd3890 0a537461 62696c69 74793a20 20202020 .Stability: \n+ 0x00bd38a0 20202020 20204578 70657269 6d656e74 Experiment\n+ 0x00bd38b0 616c0a43 61746567 6f72793a 20202020 al.Category: \n+ 0x00bd38c0 20202020 20202020 5765620a 4275696c Web.Buil\n+ 0x00bd38d0 642d7479 70653a20 20202020 20202020 d-type: \n+ 0x00bd38e0 2053696d 706c650a 43616261 6c2d7665 Simple.Cabal-ve\n+ 0x00bd38f0 7273696f 6e3a2020 20202020 203e3d31 rsion: >=1\n+ 0x00bd3900 2e320a0a 45786563 75746162 6c652070 .2..Executable p\n+ 0x00bd3910 726f6a6e 616d650a 20206873 2d736f75 rojname. hs-sou\n+ 0x00bd3920 7263652d 64697273 3a207372 630a2020 rce-dirs: src. \n+ 0x00bd3930 6d61696e 2d69733a 204d6169 6e2e6873 main-is: Main.hs\n+ 0x00bd3940 0a0a2020 4275696c 642d6465 70656e64 .. Build-depend\n+ 0x00bd3950 733a0a20 20202062 61736520 20202020 s:. base \n+ 0x00bd3960 20202020 20202020 20202020 20202020 \n+ 0x00bd3970 203e3d20 34202020 20202626 203c2035 >= 4 && < 5\n+ 0x00bd3980 2c0a2020 20206279 74657374 72696e67 ,. bytestring\n+ 0x00bd3990 20202020 20202020 20202020 20202020 \n+ 0x00bd39a0 3e3d2030 2e392e31 20262620 3c20302e >= 0.9.1 && < 0.\n+ 0x00bd39b0 31312c0a 20202020 6d746c20 20202020 11,. mtl \n+ 0x00bd39c0 20202020 20202020 20202020 20202020 \n+ 0x00bd39d0 20203e3d 20322020 20202026 26203c20 >= 2 && < \n+ 0x00bd39e0 332c0a20 20202073 6e61702d 636f7265 3,. snap-core\n+ 0x00bd39f0 20202020 20202020 20202020 20202020 \n+ 0x00bd3a00 203e3d20 312e3020 20202626 203c2031 >= 1.0 && < 1\n+ 0x00bd3a10 2e312c0a 20202020 736e6170 2d736572 .1,. snap-ser\n+ 0x00bd3a20 76657220 20202020 20202020 20202020 ver \n+ 0x00bd3a30 20203e3d 20312e30 20202026 26203c20 >= 1.0 && < \n+ 0x00bd3a40 312e320a 0a202069 6620696d 706c2867 1.2.. if impl(g\n+ 0x00bd3a50 6863203e 3d20362e 31322e30 290a2020 hc >= 6.12.0). \n+ 0x00bd3a60 20206768 632d6f70 74696f6e 733a202d ghc-options: -\n+ 0x00bd3a70 74687265 61646564 202d5761 6c6c202d threaded -Wall -\n+ 0x00bd3a80 66776172 6e2d7461 6273202d 66756e62 fwarn-tabs -funb\n+ 0x00bd3a90 6f782d73 74726963 742d6669 656c6473 ox-strict-fields\n+ 0x00bd3aa0 202d4f32 0a202020 20202020 20202020 -O2. \n+ 0x00bd3ab0 20202020 20202d66 6e6f2d77 61726e2d -fno-warn-\n+ 0x00bd3ac0 756e7573 65642d64 6f2d6269 6e640a20 unused-do-bind. \n+ 0x00bd3ad0 20656c73 650a2020 20206768 632d6f70 else. ghc-op\n+ 0x00bd3ae0 74696f6e 733a202d 74687265 61646564 tions: -threaded\n+ 0x00bd3af0 202d5761 6c6c202d 66776172 6e2d7461 -Wall -fwarn-ta\n+ 0x00bd3b00 6273202d 66756e62 6f782d73 74726963 bs -funbox-stric\n+ 0x00bd3b10 742d6669 656c6473 202d4f32 0a002e2f t-fields -O2.../\n+ 0x00bd3b20 666f6f2e 63616261 6c003a73 6574202d foo.cabal.:set -\n+ 0x00bd3b30 69737263 0a3a7365 74202d68 6964652d isrc.:set -hide-\n+ 0x00bd3b40 7061636b 61676520 4d6f6e61 64436174 package MonadCat\n+ 0x00bd3b50 6368494f 2d6d746c 0a3a7365 74202d68 chIO-mtl.:set -h\n+ 0x00bd3b60 6964652d 7061636b 61676520 6d6f6e61 ide-package mona\n+ 0x00bd3b70 64732d66 640a3a73 6574202d 584f7665 ds-fd.:set -XOve\n+ 0x00bd3b80 726c6f61 64656453 7472696e 67730a00 rloadedStrings..\n+ 0x00bd3b90 2e2f2e67 68636900 2e2f7372 63002e2f ./.ghci../src../\n 0x00bd3ba0 6c6f6700 48656c70 006d6169 6e3a4d61 log.Help.main:Ma\n 0x00bd3bb0 696e2e48 656c7000 6c696272 61726965 in.Help.librarie\n 0x00bd3bc0 732f6261 73652f44 6174612f 44617461 s/base/Data/Data\n 0x00bd3bd0 2e687300 44617461 2e446174 61006261 .hs.Data.Data.ba\n 0x00bd3be0 73650066 726f6d4a 75737400 7061636b se.fromJust.pack\n 0x00bd3bf0 00446174 612e5465 78742e54 65787400 .Data.Text.Text.\n 0x00bd3c00 67756e66 6f6c6400 73706c69 744f6e00 gunfold.splitOn.\n"}, {"source1": "readelf --wide --decompress --hex-dump=.data {}", "source2": "readelf --wide --decompress --hex-dump=.data {}", "unified_diff": "@@ -117,108 +117,108 @@\n 0x00c04720 da46c000 00000000 10840100 00000000 .F..............\n 0x00c04730 00000000 00000000 70840100 00000000 ........p.......\n 0x00c04740 00000000 00000000 d0840100 00000000 ................\n 0x00c04750 00000000 00000000 d487b900 4847c000 ............HG..\n 0x00c04760 3847c000 00000000 cc99b900 5947c000 8G..........YG..\n 0x00c04770 35e2c800 00000000 30850100 00000000 5.......0.......\n 0x00c04780 00000000 00000000 90850100 00000000 ................\n- 0x00c04790 00000000 00000000 d487b900 8847c000 .............G..\n- 0x00c047a0 7847c000 00000000 cc99b900 9947c000 xG...........G..\n- 0x00c047b0 6a47c000 00000000 f0850100 00000000 jG..............\n- 0x00c047c0 00000000 00000000 50860100 00000000 ........P.......\n- 0x00c047d0 00000000 00000000 b0860100 00000000 ................\n- 0x00c047e0 00000000 00000000 d487b900 d847c000 .............G..\n- 0x00c047f0 c847c000 00000000 10870100 00000000 .G..............\n- 0x00c04800 00000000 00000000 70870100 00000000 ........p.......\n- 0x00c04810 00000000 00000000 d487b900 0848c000 .............H..\n- 0x00c04820 f847c000 00000000 d0870100 00000000 .G..............\n- 0x00c04830 00000000 00000000 30880100 00000000 ........0.......\n- 0x00c04840 00000000 00000000 d487b900 3848c000 ............8H..\n- 0x00c04850 2848c000 00000000 90880100 00000000 (H..............\n- 0x00c04860 00000000 00000000 f0880100 00000000 ................\n- 0x00c04870 00000000 00000000 d487b900 6848c000 ............hH..\n- 0x00c04880 5848c000 00000000 50890100 00000000 XH......P.......\n- 0x00c04890 00000000 00000000 b0890100 00000000 ................\n- 0x00c048a0 00000000 00000000 d487b900 9848c000 .............H..\n- 0x00c048b0 8848c000 00000000 108a0100 00000000 .H..............\n- 0x00c048c0 00000000 00000000 708a0100 00000000 ........p.......\n- 0x00c048d0 00000000 00000000 d487b900 c848c000 .............H..\n- 0x00c048e0 b848c000 00000000 d08a0100 00000000 .H..............\n- 0x00c048f0 00000000 00000000 308b0100 00000000 ........0.......\n- 0x00c04900 00000000 00000000 d487b900 f848c000 .............H..\n- 0x00c04910 e848c000 00000000 908b0100 00000000 .H..............\n- 0x00c04920 00000000 00000000 f08b0100 00000000 ................\n+ 0x00c04790 00000000 00000000 f0850100 00000000 ................\n+ 0x00c047a0 00000000 00000000 d487b900 9847c000 .............G..\n+ 0x00c047b0 8847c000 00000000 50860100 00000000 .G......P.......\n+ 0x00c047c0 00000000 00000000 b0860100 00000000 ................\n+ 0x00c047d0 00000000 00000000 d487b900 c847c000 .............G..\n+ 0x00c047e0 b847c000 00000000 10870100 00000000 .G..............\n+ 0x00c047f0 00000000 00000000 70870100 00000000 ........p.......\n+ 0x00c04800 00000000 00000000 d487b900 f847c000 .............G..\n+ 0x00c04810 e847c000 00000000 d0870100 00000000 .G..............\n+ 0x00c04820 00000000 00000000 30880100 00000000 ........0.......\n+ 0x00c04830 00000000 00000000 d487b900 2848c000 ............(H..\n+ 0x00c04840 1848c000 00000000 90880100 00000000 .H..............\n+ 0x00c04850 00000000 00000000 f0880100 00000000 ................\n+ 0x00c04860 00000000 00000000 d487b900 5848c000 ............XH..\n+ 0x00c04870 4848c000 00000000 50890100 00000000 HH......P.......\n+ 0x00c04880 00000000 00000000 b0890100 00000000 ................\n+ 0x00c04890 00000000 00000000 d487b900 8848c000 .............H..\n+ 0x00c048a0 7848c000 00000000 108a0100 00000000 xH..............\n+ 0x00c048b0 00000000 00000000 708a0100 00000000 ........p.......\n+ 0x00c048c0 00000000 00000000 d487b900 b848c000 .............H..\n+ 0x00c048d0 a848c000 00000000 d08a0100 00000000 .H..............\n+ 0x00c048e0 00000000 00000000 308b0100 00000000 ........0.......\n+ 0x00c048f0 00000000 00000000 d487b900 e848c000 .............H..\n+ 0x00c04900 d848c000 00000000 908b0100 00000000 .H..............\n+ 0x00c04910 00000000 00000000 f08b0100 00000000 ................\n+ 0x00c04920 00000000 00000000 508c0100 00000000 ........P.......\n 0x00c04930 00000000 00000000 d487b900 2849c000 ............(I..\n- 0x00c04940 1849c000 00000000 508c0100 00000000 .I......P.......\n- 0x00c04950 00000000 00000000 b08c0100 00000000 ................\n- 0x00c04960 00000000 00000000 108d0100 00000000 ................\n- 0x00c04970 00000000 00000000 708d0100 00000000 ........p.......\n- 0x00c04980 00000000 00000000 d08d0100 00000000 ................\n- 0x00c04990 00000000 00000000 308e0100 00000000 ........0.......\n- 0x00c049a0 00000000 00000000 908e0100 00000000 ................\n- 0x00c049b0 00000000 00000000 d487b900 a849c000 .............I..\n- 0x00c049c0 9849c000 00000000 cc99b900 b949c000 .I...........I..\n- 0x00c049d0 35e2c800 00000000 d487b900 a849c000 5............I..\n- 0x00c049e0 b847c000 00000000 cc99b900 d949c000 .G...........I..\n- 0x00c049f0 aa47c000 00000000 cc99b900 e947c000 .G...........G..\n- 0x00c04a00 ea49c000 00000000 cc99b900 1948c000 .I...........H..\n- 0x00c04a10 fa49c000 00000000 cc99b900 4948c000 .I..........IH..\n- 0x00c04a20 0a4ac000 00000000 cc99b900 7948c000 .J..........yH..\n- 0x00c04a30 1a4ac000 00000000 cc99b900 a948c000 .J...........H..\n- 0x00c04a40 2a4ac000 00000000 cc99b900 d948c000 *J...........H..\n- 0x00c04a50 3a4ac000 00000000 cc99b900 0949c000 :J...........I..\n+ 0x00c04940 1849c000 00000000 b08c0100 00000000 .I..............\n+ 0x00c04950 00000000 00000000 108d0100 00000000 ................\n+ 0x00c04960 00000000 00000000 708d0100 00000000 ........p.......\n+ 0x00c04970 00000000 00000000 d08d0100 00000000 ................\n+ 0x00c04980 00000000 00000000 308e0100 00000000 ........0.......\n+ 0x00c04990 00000000 00000000 908e0100 00000000 ................\n+ 0x00c049a0 00000000 00000000 d487b900 9849c000 .............I..\n+ 0x00c049b0 8849c000 00000000 cc99b900 a949c000 .I...........I..\n+ 0x00c049c0 35e2c800 00000000 d487b900 9849c000 5............I..\n+ 0x00c049d0 7847c000 00000000 cc99b900 c949c000 xG...........I..\n+ 0x00c049e0 6a47c000 00000000 cc99b900 a947c000 jG...........G..\n+ 0x00c049f0 da49c000 00000000 cc99b900 d947c000 .I...........G..\n+ 0x00c04a00 ea49c000 00000000 cc99b900 0948c000 .I...........H..\n+ 0x00c04a10 fa49c000 00000000 cc99b900 3948c000 .I..........9H..\n+ 0x00c04a20 0a4ac000 00000000 cc99b900 6948c000 .J..........iH..\n+ 0x00c04a30 1a4ac000 00000000 cc99b900 9948c000 .J...........H..\n+ 0x00c04a40 2a4ac000 00000000 cc99b900 c948c000 *J...........H..\n+ 0x00c04a50 3a4ac000 00000000 cc99b900 f948c000 :J...........H..\n 0x00c04a60 4a4ac000 00000000 f08e0100 00000000 JJ..............\n 0x00c04a70 00000000 00000000 508f0100 00000000 ........P.......\n 0x00c04a80 00000000 00000000 d487b900 784ac000 ............xJ..\n 0x00c04a90 684ac000 00000000 cc99b900 894ac000 hJ...........J..\n- 0x00c04aa0 ca49c000 00000000 cc99b900 894ac000 .I...........J..\n- 0x00c04ab0 5a4ac000 00000000 cc99b900 3949c000 ZJ..........9I..\n- 0x00c04ac0 aa4ac000 00000000 cc99b900 894ac000 .J...........J..\n- 0x00c04ad0 1a47c000 00000000 b08f0100 00000000 .G..............\n- 0x00c04ae0 00000000 00000000 10900100 00000000 ................\n- 0x00c04af0 00000000 00000000 d487b900 e84ac000 .............J..\n- 0x00c04b00 d84ac000 00000000 cc99b900 f94ac000 .J...........J..\n- 0x00c04b10 9a4ac000 00000000 cc99b900 f94ac000 .J...........J..\n- 0x00c04b20 ba4ac000 00000000 cc99b900 f94ac000 .J...........J..\n- 0x00c04b30 ca4ac000 00000000 70900100 00000000 .J......p.......\n- 0x00c04b40 00000000 00000000 d0900100 00000000 ................\n- 0x00c04b50 00000000 00000000 d487b900 484bc000 ............HK..\n- 0x00c04b60 384bc000 00000000 cc99b900 594bc000 8K..........YK..\n- 0x00c04b70 0a4bc000 00000000 d487b900 484bc000 .K..........HK..\n- 0x00c04b80 4849c000 00000000 cc99b900 794bc000 HI..........yK..\n- 0x00c04b90 1a4bc000 00000000 d487b900 484bc000 .K..........HK..\n- 0x00c04ba0 2847c000 00000000 cc99b900 994bc000 (G...........K..\n- 0x00c04bb0 2a4bc000 00000000 30910100 00000000 *K......0.......\n+ 0x00c04aa0 ba49c000 00000000 cc99b900 894ac000 .I...........J..\n+ 0x00c04ab0 5a4ac000 00000000 cc99b900 894ac000 ZJ...........J..\n+ 0x00c04ac0 1a47c000 00000000 b08f0100 00000000 .G..............\n+ 0x00c04ad0 00000000 00000000 10900100 00000000 ................\n+ 0x00c04ae0 00000000 00000000 d487b900 d84ac000 .............J..\n+ 0x00c04af0 c84ac000 00000000 cc99b900 e94ac000 .J...........J..\n+ 0x00c04b00 9a4ac000 00000000 d487b900 d84ac000 .J...........J..\n+ 0x00c04b10 0849c000 00000000 cc99b900 094bc000 .I...........K..\n+ 0x00c04b20 aa4ac000 00000000 d487b900 d84ac000 .J...........J..\n+ 0x00c04b30 2847c000 00000000 cc99b900 294bc000 (G..........)K..\n+ 0x00c04b40 ba4ac000 00000000 70900100 00000000 .J......p.......\n+ 0x00c04b50 00000000 00000000 d0900100 00000000 ................\n+ 0x00c04b60 00000000 00000000 d487b900 584bc000 ............XK..\n+ 0x00c04b70 484bc000 00000000 cc99b900 694bc000 HK..........iK..\n+ 0x00c04b80 fa4ac000 00000000 cc99b900 694bc000 .J..........iK..\n+ 0x00c04b90 1a4bc000 00000000 cc99b900 3949c000 .K..........9I..\n+ 0x00c04ba0 8a4bc000 00000000 cc99b900 694bc000 .K..........iK..\n+ 0x00c04bb0 3a4bc000 00000000 30910100 00000000 :K......0.......\n 0x00c04bc0 00000000 00000000 cc99b900 b84bc000 .............K..\n- 0x00c04bd0 35e2c800 00000000 cc99b900 5849c000 5...........XI..\n- 0x00c04be0 ca4bc000 00000000 cc99b900 6849c000 .K..........hI..\n- 0x00c04bf0 da4bc000 00000000 cc99b900 7849c000 .K..........xI..\n+ 0x00c04bd0 35e2c800 00000000 cc99b900 4849c000 5...........HI..\n+ 0x00c04be0 ca4bc000 00000000 cc99b900 5849c000 .K..........XI..\n+ 0x00c04bf0 da4bc000 00000000 cc99b900 6849c000 .K..........hI..\n 0x00c04c00 ea4bc000 00000000 90910100 00000000 .K..............\n 0x00c04c10 00000000 00000000 cc99b900 084cc000 .............L..\n 0x00c04c20 ca4bc000 00000000 d487b900 1a4cc000 .K...........L..\n- 0x00c04c30 6a4bc000 00000000 d487b900 1a4cc000 jK...........L..\n+ 0x00c04c30 7a4bc000 00000000 d487b900 1a4cc000 zK...........L..\n 0x00c04c40 aa4bc000 00000000 cc99b900 084cc000 .K...........L..\n- 0x00c04c50 fa4bc000 00000000 cc99b900 8849c000 .K...........I..\n+ 0x00c04c50 fa4bc000 00000000 cc99b900 7849c000 .K..........xI..\n 0x00c04c60 4a4cc000 00000000 d487b900 5a4cc000 JL..........ZL..\n- 0x00c04c70 8a4bc000 00000000 f0910100 00000000 .K..............\n+ 0x00c04c70 9a4bc000 00000000 f0910100 00000000 .K..............\n 0x00c04c80 00000000 00000000 58920100 00000000 ........X.......\n 0x00c04c90 f0920100 00000000 90930100 00000000 ................\n 0x00c04ca0 28940100 00000000 00000000 00000000 (...............\n 0x00c04cb0 7c449a00 8b4cc000 914cc000 a24cc000 |D...L...L...L..\n 0x00c04cc0 00000000 50940100 4c17b900 c64cc000 ....P...L....L..\n 0x00c04cd0 f642c000 03000000 00000000 00000000 .B..............\n 0x00c04ce0 b072bb00 d887c400 847bc400 d845c000 .r.......{...E..\n 0x00c04cf0 3846c000 e845c000 00000000 5072bb00 8F...E......Pr..\n 0x00c04d00 9843c000 e04cc000 00000000 5072bb00 .C...L......Pr..\n 0x00c04d10 f4cbc400 4441c000 00000000 00000000 ....DA..........\n 0x00c04d20 b072bb00 d442c000 184cc000 a84bc000 .r...B...L...K..\n 0x00c04d30 9046c000 0c4dc000 00000000 00000000 .F...M..........\n- 0x00c04d40 9072bb00 884bc000 584cc000 e841c000 .r...K..XL...A..\n+ 0x00c04d40 9072bb00 984bc000 584cc000 e841c000 .r...K..XL...A..\n 0x00c04d50 204dc000 00000000 00000000 00000000 M..............\n- 0x00c04d60 7072bb00 684bc000 d841c000 404dc000 pr..hK...A..@M..\n+ 0x00c04d60 7072bb00 784bc000 d841c000 404dc000 pr..xK...A..@M..\n 0x00c04d70 00000000 5072bb00 c841c000 604dc000 ....Pr...A..`M..\n 0x00c04d80 00000000 00000000 00000000 00000000 ................\n 0x00c04d90 b072bb00 8462c500 e4ccc000 b0cbc000 .r...b..........\n 0x00c04da0 1846c000 744dc000 00000000 5072bb00 .F..tM......Pr..\n 0x00c04db0 9843c000 904dc000 00000000 5072bb00 .C...M......Pr..\n 0x00c04dc0 fc4cc000 ac4dc000 00000000 00000000 .L...M..........\n 0x00c04dd0 a4980100 2459c500 b841c000 bc4dc000 ....$Y...A...M..\n"}, {"source1": "readelf --wide --decompress --hex-dump=.got {}", "source2": "readelf --wide --decompress --hex-dump=.got {}", "unified_diff": "@@ -15,28 +15,28 @@\n 0x00cd3254 0c75bb00 5499b900 d442c000 bcc7c700 .u..T....B......\n 0x00cd3264 e442c000 f442c000 e9b4bc00 eeb4bc00 .B...B..........\n 0x00cd3274 28b5bc00 60b5bc00 a0b5bc00 ddb5bc00 (...`...........\n 0x00cd3284 f7b5bc00 0ab6bc00 1bb6bc00 62b6bc00 ............b...\n 0x00cd3294 b1b6bc00 cdb6bc00 ddb6bc00 e4b6bc00 ................\n 0x00cd32a4 c845c000 847bc400 d845c000 2846c000 .E...{...E..(F..\n 0x00cd32b4 9843c000 7846c000 3846c000 05b7bc00 .C..xF..8F......\n- 0x00cd32c4 34fabc00 47fabc00 b6fbbc00 c6fbbc00 4...G...........\n- 0x00cd32d4 2d00bd00 7903bd00 8e03bd00 c410bd00 -...y...........\n- 0x00cd32e4 d210bd00 5724bd00 9a24bd00 c224bd00 ....W$...$...$..\n- 0x00cd32f4 9625bd00 ba25bd00 7527bd00 9a27bd00 .%...%..u'...'..\n- 0x00cd3304 8228bd00 a828bd00 e728bd00 0c29bd00 .(...(...(...)..\n- 0x00cd3314 9729bd00 c029bd00 3a2bbd00 622bbd00 .)...)..:+..b+..\n- 0x00cd3324 bb2cbd00 cf2cbd00 e134bd00 fc34bd00 .,...,...4...4..\n+ 0x00cd32c4 74b8bc00 84b8bc00 b3fbbc00 c6fbbc00 t...............\n+ 0x00cd32d4 2d00bd00 7903bd00 8e03bd00 1317bd00 -...y...........\n+ 0x00cd32e4 4924bd00 5724bd00 2b25bd00 4f25bd00 I$..W$..+%..O%..\n+ 0x00cd32f4 3726bd00 5d26bd00 e826bd00 1127bd00 7&..]&...&...'..\n+ 0x00cd3304 5027bd00 7527bd00 3029bd00 5529bd00 P'..u'..0)..U)..\n+ 0x00cd3314 cf2abd00 f72abd00 3a2bbd00 622bbd00 .*...*..:+..b+..\n+ 0x00cd3324 7433bd00 cd34bd00 e134bd00 fc34bd00 t3...4...4...4..\n 0x00cd3334 0d35bd00 1835bd00 2135bd00 6537bd00 .5...5..!5..e7..\n- 0x00cd3344 7337bd00 8037bd00 9237bd00 f837bd00 s7...7...7...7..\n- 0x00cd3354 0038bd00 8c3bbd00 983bbd00 9e3bbd00 .8...;...;...;..\n+ 0x00cd3344 7337bd00 8037bd00 9237bd00 1e3bbd00 s7...7...7...;..\n+ 0x00cd3354 2a3bbd00 903bbd00 983bbd00 9e3bbd00 *;...;...;...;..\n 0x00cd3364 a43bbd00 884cc000 904cc000 984cc000 .;...L...L...L..\n 0x00cd3374 c44cc000 f4cbc400 b452c500 d04dc000 .L.......R...M..\n 0x00cd3384 c84cc000 3041c000 e4ccc000 b0cbc000 .L..0A..........\n- 0x00cd3394 884bc000 584cc000 684bc000 184cc000 .K..XL..hK...L..\n+ 0x00cd3394 984bc000 584cc000 784bc000 184cc000 .K..XL..xK...L..\n 0x00cd33a4 a84bc000 ec4dc000 ac3ec000 144ec000 .K...M...>...N..\n 0x00cd33b4 204ec000 384ec000 b462c000 8c0e6300 N..8N...b....c.\n 0x00cd33c4 744ec000 2063c000 a40e6300 98960d00 tN.. c....c.....\n 0x00cd33d4 844ec000 984ec000 24030d00 20cec400 .N...N..$... ...\n 0x00cd33e4 6098c200 b04ec000 b84ec000 c04ec000 `....N...N...N..\n 0x00cd33f4 c84ec000 a44fc000 944fc000 b44fc000 .N...O...O...O..\n 0x00cd3404 282cc900 2c64c000 7464c000 a4dea700 (,..,d..td......\n"}]}]}]}]}]}
Login:
Password:<\n+ 0x00bd2a10 2f74643e 3c74643e 3c696e70 75742074 /td>
.