úÎ_¬ZO+      !"#$%&'()* Safe-Infered +,-./01234 +,-./0123+.-,/01234None$0 = silent, 1(def) = startup banner Warp 5 "6789:;<=>?@ABCDEFGHIJKLMNO6789:;<=>?@ABCDEFGHIJK8769:;<=>?@CBADEFGHIJKLMNO Safe-InferedMinimum implemention:   Take a P value and parse it as a, or fail with a message. 5Default implementation parses comma-delimited lists. 9 parseParamList t = mapM parseParam (T.split (== ',') t) -Throw an exception, which can be caught with  . Uncaught exceptions  turn into HTTP 500 responses. EAbort execution of this action and continue pattern matching routes. # Like an exception, any code after   is not executed. JAs an example, these two routes overlap. The only way the second one will $ ever run is if the first one calls  .  get "/foo/:number" $ do  n <- param "number" ! unless (all isDigit n) $ next  text "a number"   get "/foo/:bar" $ do  bar <- param "bar"  text "not a number" Catch an exception thrown by  . 2 raise "just kidding" `rescue` (\msg -> text msg) cRedirect to given URL. Like throwing an uncatchable exception. Any code after the call to redirect  will not be run.  " redirect "http://www.google.com" OR  redirect "/foo/bar" Get the Q object. Get the request body. eParse the request body as a JSON object and return it. Raises an exception if parse is unsuccessful. QGet a parameter. First looks in captures, then form data, then query parameters. , Raises an exception which can be caught by   if parameter is not found.  If parameter is found, but R% fails to parse to the correct type,   is called. > This means captures are somewhat typed, in that a route won't match if a correctly typed  capture cannot be parsed. Useful for creating - instances for things that already implement S. Ex: 5 instance Parsable Int where parseParam = readEither .Set the HTTP response status. Default is 200. YSet one of the response headers. Will override any previously set value for that header. $ Header names are case-insensitive. *Set the body of the response to the given P value. Also sets " Content-Type"  header to "text/plain". *Set the body of the response to the given P value. Also sets " Content-Type"  header to "text/html". "Send a file as the response. Doesn' t set the " Content-Type" header, so you probably " want to do that on your own with . PSet the body of the response to the JSON encoding of the given value. Also sets " Content-Type"  header to " application/json". /Set the body of the response to a Source. Doesn' t set the  " Content-Type"1 header, so you probably want to do that on your  own with . TAChecks if parameter is present and is null-valued, not a literal '()'.  If the URI requested is: '/ foo?bar=()&baz' then baz will parse as (), where bar will not. UOverrides default   to parse String.  V WXYZ[\TU]^ V  V WXYZ[\TU]^ Safe-Infered ;An action (executed when a route matches) can either be an  computation, or I a function with an argument for each capture in the route. For example:  ' get "/lambda/:foo/:bar" $ \ a b -> do  text $ mconcat [a,b] is elaborated by Scotty to:  get "/lambda/:foo/:bar" $ do  a <- param "foo"  b <- param "bar"  text $ mconcat [a,b] get = " _ post = " ` put = " a  delete = " b 6Add a route that matches regardless of the HTTP verb. !QSpecify an action to take if nothing else is found. Note: this _always_ matches, 2 so should generally be the last route specified. "Define a route with a c, P# value representing the path spec,  and a body () which modifies the response.  ' addroute GET "/" $ text "beam me up!" NThe path spec can include values starting with a colon, which are interpreted  as captures7. These are named wildcards that can be looked up with .   addroute GET "/foo/:bar" $ do  v <- param "bar"  text v (curl http://localhost:3000/foo/something something#+Match requests using a regular expression. ) Named captures are not yet supported.   get (regex "^/f(.*)r$") $ do  path <- param "0"  cap <- param "1" 8 text $ mconcat ["Path: ", path, "\nCapture: ", cap] "curl http://localhost:3000/foo/barPath: /foo/barCapture: oo/ba$HStandard Sinatra-style route. Named captures are prepended with colons. M This is the default route type generated by OverloadedString routes. i.e.  ! get (capture "/foo/:bar") $ ... and  $ {-# LANGUAGE OverloadedStrings #-}  ...  get "/foo/:bar" $ ... are equivalent. %CBuild a route based on a function which can match using the entire Q object.  d' indicates the route does not match. A e value indicates Q a successful match, optionally returning a list of key-value pairs accessible  by .  S get (function $ \req -> Just [("version", T.pack $ show $ httpVersion req)]) $ do  v <- param "version"  text v curl http://localhost:3000/HTTP/1.1&PBuild a route that requires the requested path match exactly, without captures.  !"#$%&fg  !"#$%& !"#$%&fg Safe-Infered'0Run a scotty application using the warp server. (GRun a scotty application using the warp server, passing extra options. )%Turn a scotty application into a WAI h, which can be  run with any WAI handler. *HUse given middleware. Middleware is nested such that the first declared O is the outermost middleware (it has first dibs on the request and last action < on the response). Every middleware is run on each request. '()*+  !"#$%&'()*+')(*" !$#%&  '()*i       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHGIJKLLMNOPQRSTUVWXYZ[\][^_`abcdefghijklmklnkloklpklq[rs[rtuvXYwx scotty-0.4.4 Web.ScottyWeb.Scotty.UtilWeb.Scotty.TypesWeb.Scotty.ActionWeb.Scotty.Route RoutePatternActionMParamScottyMOptionsverbosesettingsParsable parseParamparseParamListraisenextrescueredirectrequestbodyjsonDataparam readEitherstatusheadertexthtmlfilejsonsourceActiongetpostputdeletematchAnynotFoundaddrouteregexcapturefunctionliteralscotty scottyOpts scottyApp middlewareContent ContentSource ContentFileContentBuilderlazyTextToStrictByteStringstrictByteStringToLazyText setContent setHeader setStatus$fDefaultResponse warp-1.2.2Network.Wai.Handler.WarpSettingsFunctionLiteralCaptureAMrunAM ActionEnvEnvgetReq getParamsgetBody ActionErrorNextRedirectSrunS ScottyState middlewaresroutes addMiddlewareaddRoute$fIsStringRoutePattern$fErrorActionError$fDefaultScottyState$fDefaultOptions text-0.11.2.2Data.Text.Lazy.InternalText wai-1.2.0.3 Network.WaiRequestbase Text.ReadreadGHC.ReadRead $fParsable()$fParsableChar runAction$fParsableInteger $fParsableInt$fParsableFloat$fParsableDouble$fParsableBool $fParsable[]$fParsableByteString$fParsableTexthttp-types-0.6.11Network.HTTP.TypesGETPOSTPUTDELETE StdMethod Data.MaybeNothingJust $fAction(->)$fActionActionM Application