1      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None =BHJKM1.None   None$HM#Get the original Wai Request object Read a header  Read a cookie!LTries to dected the preferred format of the response using the Accept header"Get the raw request body#Parse the request body as json$FParse the request body as json and fails with 500 status code on error%Get uploaded files&Get all request params'nRead a request param. Spock looks in route captures first, then in POST variables and at last in GET variables(Like '., but outputs an error when a param is missing)Set a response status*9Set a response header. Overwrites already defined headers+AAbort the current action and jump the next one matching the route,Redirect to a given url-If the Spock application is used as a middleware, you can use this to pass request handeling to the underlying application. If Spock is not uses as a middleware, or there is no underlying application this will result in 404 error..EModify the vault (useful for sharing data between middleware and app)/Query the vault01Set a cookie living for a given number of seconds1%Set a cookie living until a specific 2Send a  ByteString$ as response body. Provide your own  Content-Type3 Send a lazy  ByteString$ as response body. Provide your own  Content-Type4?Send text as a response body. Content-Type will be "text/plain"5>Send a text as response body. Content-Type will be "text/html"6Send a file as response7>Send json as response. Content-Type will be "application/json"8tBasic authentification provide a title for the prompt and a function to validate user and password. Usage example: get "/my-secret-page" $ requireBasicAuth "Secret Page" (\user pass -> return (user == "admin" && pass == "1234")) $ do html "This is top secret content. Login using that secret code I provided ;-)" !"#$%&'()*+,-./012345678' !"#$%&'()*+,-./012345678 !"#$%&'()*+,-./012345678None &6:=BHKM ;CSafeActions are actions that need to be protected from csrf attacks</The body of the safe action. Either GET or POSTAGive you access to a database connectin from the connection pool. The connection is released back to the pool once the function terminates.BRRead the application's state. If you wish to have mutable state, you could use a  from the STM packge.Get the session managerH%Configuration for the session managerOjYou can feed Spock with either a connection pool, or instructions on how to build a connection pool. See RRMThe ConnBuilder instructs Spock how to create or close a database connection.WfIf Spock should take care of connection pooling, you need to configure it depending on what you need.\{The SpockAction is the monad of all route-actions. You have access to the database, session and state of your application.AInside the SpockAllM monad, you may define routes and middleware.N9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\I9:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\ 9:;<=>?@ABCDEFGHIJKLMNOQPRSTUVWXYZ[\None24=BK]Read the heart of Spock. This is useful if you want to construct your own monads that work with runQuery and getState using "runSpockIO"^WRun an action inside of Spocks core monad. This allows you to use runQuery and getState]^]^]^ None$03HM9None !"$(3BHM_9Run a Spock application. Basically just a wrapper aroung Warp.run.`WConvert a middleware to an application. All failing requests will result in a 404 pagea}Get the current users sessionId. Note that this ID should only be shown to it's owner as otherwise sessions can be hijacked.bWrite to the current session. Note that all data is stored on the server. The user only reciedes a sessionId to be identified.cModify the stored sessiondRead the stored sessionenGlobally delete all existing sessions. This is useful for example if you want to require all users to reloginfASimple session persisting configuration. DO NOT USE IN PRODUCTION_`abcdefS !"#$%&'()*+,-./0123456789:=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefS_`\ !"#$%&'()*,+01234567-./OQPRSTUVWXYZ[=>?@AB8HIJKLMNDEFG9fadbce]^:C_`abcdef None $=HKMRun a spock application using the warp server, a given db storageLayer and an initial state. Spock works with database libraries that already implement connection pooling and with those that don't come with it out of the box. For more see the O type.eRun a raw spock server on a defined port. If you don't need a custom base monad you can just supply  as lift function.None !"$(3BHMiCreate a spock application using a given db storageLayer and an initial state. Spock works with database libraries that already implement connection pooling and with those that don't come with it out of the box. For more see the O type. Use runSpock to run the app or  spockAsApp to create a Wai.ApplicationjACreate a raw spock application with custom underlying monad Use runSpock to run the app or  spockAsApp to create a Wai.Applicationk6Specify an action that will be run when the HTTP verb  and the given route matchl6Specify an action that will be run when the HTTP verb  and the given route matchm6Specify an action that will be run when the HTTP verb  and the given route matchn6Specify an action that will be run when the HTTP verb  and the given route matcho6Specify an action that will be run when the HTTP verb  and the given route matchp6Specify an action that will be run when the HTTP verb  and the given route matchqMSpecify an action that will be run when a HTTP verb and the given route matchrSpecify an action that will be run when a HTTP verb matches but no defined route matches. The full path is passed as an arguments%Define a subcomponent. Usage example: subcomponent "site" $ do get "home" homeHandler get ("misc" <> var) $ -- ... subcomponent "admin" $ do get "home" adminHomeHandler The request "site6home" will be routed to homeHandler and the request "admin(home" will be routed to adminHomeHandlertHook wai middleware into SpockunWire up a safe action: Safe actions are actions that are protected from csrf attacks. Here's a usage example: newtype DeleteUser = DeleteUser Int deriving (Hashable, Typeable, Eq) instance SafeAction Connection () () DeleteUser where runSafeAction (DeleteUser i) = do runQuery $ deleteUserFromDb i redirect "/user-list" get "/user-details/:userId" $ do userId <- param' "userId" deleteUrl <- safeActionPath (DeleteUser userId) html $ "Click <a href='" <> deleteUrl <> "'>here</a> to delete user!"CNote that safeActions currently only support GET and POST requests.vCombine two path componentsghijklmnopqrstuvt  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv!ihjg v sklmnopqr t;<ughijklmnopqrstuvNone !"$3BHMzCreate a spock application using a given db storageLayer and an initial state. Spock works with database libraries that already implement connection pooling and with those that don't come with it out of the box. For more see the O type. Use runSpock to run the app or  spockAsApp to create a Wai.Application{ACreate a raw spock application with custom underlying monad Use runSpock to run the app or  spockAsApp to create a Wai.Application|&Combine two route components safely "foo" <> " bar" ===> "foo bar" "foo"  // "bar" ===> "foo bar" "foo  // " bar" ===> "foo/bar"}6Specify an action that will be run when the HTTP verb  and the given route match~6Specify an action that will be run when the HTTP verb  and the given route match6Specify an action that will be run when the HTTP verb  and the given route match6Specify an action that will be run when the HTTP verb  and the given route match6Specify an action that will be run when the HTTP verb  and the given route match6Specify an action that will be run when the HTTP verb  and the given route matchMSpecify an action that will be run when a HTTP verb and the given route matchSpecify an action that will be run when a HTTP verb matches but no defined route matches. The full path is passed as an argument%Define a subcomponent. Usage example: subcomponent "/site" $ do get "/home" homeHandler get "/misc/:param" $ -- ... subcomponent "/admin" $ do get "/home" adminHomeHandler The request site4home will be routed to homeHandler and the request admin'home will be routed to adminHomeHandlerHook wai middleware into SpocknWire up a safe action: Safe actions are actions that are protected from csrf attacks. Here's a usage example: newtype DeleteUser = DeleteUser Int deriving (Hashable, Typeable, Eq) instance SafeAction Connection () () DeleteUser where runSafeAction (DeleteUser i) = do runQuery $ deleteUserFromDb i redirect "/user-list" get "/user-details/:userId" $ do userId <- param' "userId" deleteUrl <- safeActionPath (DeleteUser userId) html $ "Click <a href='" <> deleteUrl <> "'>here</a> to delete user!"CNote that safeActions currently only support GET and POST requests.wxyz{|}~p  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefwxyz{|}~zy{xw|}~ ;<wxyz{|}~           !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRRSTUUVWXYZ[\]^^_`abbcdefghijklmnopqrstuvwxyz{|}~qrstuvwxyz{|}~HQ }~{|qq Spock-0.7.6.0Web.Spock.SafeWeb.Spock.SharedWeb.Spock.Internal.UtilWeb.Spock.SimpleWeb.Spock.Internal.WireWeb.Spock.Internal.CoreActionWeb.Spock.Internal.TypesWeb.Spock.Internal.Monad!Web.Spock.Internal.SessionManagerWeb.Spock.Internal.Corehttp-types-0.8.5Network.HTTP.Types.MethodGETPOSTHEADPUTDELETETRACECONNECTOPTIONSPATCH StdMethodreroute-0.2.2.1Web.Routing.SafeRouting renderRouterootstaticvarPathActionT UploadedFileuf_nameuf_contentTypeuf_tempLocationClientPreferredFormat PrefUnknownPrefTextPrefHTMLPrefXMLPrefJSON mimeMappingdetectPreferredFormat mapReqHeadersrequestheadercookiepreferredFormatbodyjsonBody jsonBody'filesparamsparamparam' setStatus setHeaderjumpNextredirectmiddlewarePass modifyVault queryVault setCookie setCookie'bytes lazyBytestexthtmlfilejsonrequireBasicAuth SessionId WebStateM SafeAction runSafeActionHasSpock SpockConn SpockState SpockSessionrunQuerygetStateWebStateSessionPersistCfgspc_load spc_store SessionCfg sc_cookieName sc_sessionTTLsc_sessionIdEntropysc_emptySession sc_persistCfg PoolOrConnPCConnPCPool ConnBuilder cb_createConncb_destroyConncb_poolConfigurationPoolCfg pc_stripespc_resPerStripepc_keepOpenTime SpockAction getSpockHeart runSpockIOrunSpock spockAsApp getSessionId writeSession modifySession readSessionclearAllSessionsreadShowSessionPersistSpockTSpockMspockspockTgetpostheadputdeletepatch hookRoutehookAny subcomponent middlewaresafeActionPath SpockRoute SpockAllT runActionTActionInteruptActionMiddlewarePass ActionDone ActionError ActionTryNextActionRedirect ResponseStaters_responseHeaders rs_statusrs_responseBody ResponseBodyResponseRedirect ResponseLBS ResponseFile RequestInfo ri_request ri_paramsri_queryParamsri_files ri_vaultIfVaultIfvi_modifyVault vi_lookupKeyrespStateToResponse errorResponsenotFound invalidReq serverErrormiddlewareToAppmakeActionEnvironmentremoveUploadedFiles applyAction handleRequestbuildMiddleware$fMonadTransActionT$fErrorActionInterupt$fHashableStdMethod time-1.4.2Data.Time.Clock.UTCUTCTimebase GHC.Conc.SyncTVar getSessMgr SpockAllMSessionManagersm_getSessionIdsm_readSessionsm_writeSessionsm_modifySessionsm_clearAllSessions sm_middlewaresm_addSafeActionsm_lookupSafeActionsm_removeSafeAction UserSessionsSessionsess_idsess_validUntil sess_datasess_safeActionsWStMunWStM runWebStateMSafeActionHashSafeActionStore sas_forward sas_reversePackedSafeActionunpackSafeAction web_dbConnweb_sessionMgr web_state $fShowSession$fMonadBaseControlIOWebStateM$fMonadBaseIOWebStateM$fEqPackedSafeAction$fHashablePackedSafeActionwebM runQueryImpl getStateImplgetSessMgrImpl$fHasSpockWebStateM $fHasSpocktcreateSessionManagergetSessionIdImplmodifySessionBasereadSessionBaseaddSafeActionImpllookupSafeActionImplremoveSafeActionImplreadSessionImplwriteSessionImplmodifySessionImplsessionMiddlewarenewSessionImplloadSessionImpldeleteSessionImplclearAllSessionsImplhousekeepSessions createSession randomHashspockAll spockAllTGHC.BaseidWeb.Routing.AbstractRouter runSpockThookSafeActions$fMonadTransSpockT _unSpockRoute