snap -package:gi-gtk

Top-level package for the Snap Web Framework This is the top-level package for the official Snap Framework libraries. It includes:
  • The Snaplets API
  • Snaplets for sessions, authentication, and templates
To get started, issue the following sequence of commands:
$ cabal install snap snap-templates
$ mkdir myproject
$ cd myproject
$ snap init
If you have trouble or any questions, see our FAQ page (http://snapframework.com/faq) or the documentation (http://snapframework.com/docs). Note: since version 1.0, the "snap" executable program for generating starter projects is provided by the snap-templates package.
Event source with a single occurrence at time 0. The value of the event is obtained by sampling the input at that time.
Snap is the Monad that user web handlers run in. Snap gives you:
  1. Stateful access to fetch or modify an HTTP Request.
    printRqContextPath :: Snap () printRqContextPath =
    writeBS . rqContextPath =<< getRequest
    
  2. Stateful access to fetch or modify an HTTP Response.
    printRspStatusReason :: Snap ()
    printRspStatusReason = writeBS . rspStatusReason
    =<< getResponse 
  3. Failure / Alternative / MonadPlus semantics: a Snap handler can choose not to handle a given request, using empty or its synonym pass, and you can try alternative handlers with the <|> operator:
    a :: Snap String a =
    pass b :: Snap String b = return "foo" c :: Snap String c = a
    <|> b -- try running a, if it fails then try b
    
  4. Convenience functions (writeBS, writeLBS, writeText, writeLazyText, addToOutput) for queueing output to be written to the Response, or for streaming to the response using io-streams:
    example ::
    (OutputStream Builder -> IO (OutputStream
    Builder)) -> Snap () example streamProc = do writeBS
    "I'm a strict bytestring" writeLBS "I'm a lazy bytestring"
    writeText "I'm strict text" addToOutput streamProc
    
  5. Early termination: if you call finishWith:
    a :: Snap ()
    a = do modifyResponse $ setResponseStatus 500 "Internal
    Server Error" writeBS "500 error" r <- getResponse
    finishWith r 
    then any subsequent processing will be skipped and the supplied Response value will be returned from runSnap as-is.
  6. Access to the IO monad through a MonadIO instance:
    a :: Snap () a = liftIO fireTheMissiles
    
  7. The ability to set or extend a timeout which will kill the handler thread after N seconds of inactivity (the default is 20 seconds):
    a :: Snap () a = setTimeout 30 
  8. Throw and catch exceptions using a MonadBaseControl instance:
    import Control.Exception.Lifted
    (SomeException, throwIO, catch) foo :: Snap ()
    foo = bar `catch` (e::SomeException) -> baz where bar =
    throwIO FooException 
  9. Log a message to the error log:
    foo :: Snap () foo =
    logError "grumble." 
You may notice that most of the type signatures in this module contain a (MonadSnap m) => ... typeclass constraint. MonadSnap is a typeclass which, in essence, says "you can get back to the Snap monad from here". Using MonadSnap you can extend the Snap monad with additional functionality and still have access to most of the Snap functions without writing lift everywhere. Instances are already provided for most of the common monad transformers (ReaderT, WriterT, StateT, etc.).
Snap is the Monad that user web handlers run in. Snap gives you:
  1. Stateful access to fetch or modify an HTTP Request.
    printRqContextPath :: Snap () printRqContextPath =
    writeBS . rqContextPath =<< getRequest
    
  2. Stateful access to fetch or modify an HTTP Response.
    printRspStatusReason :: Snap ()
    printRspStatusReason = writeBS . rspStatusReason
    =<< getResponse 
  3. Failure / Alternative / MonadPlus semantics: a Snap handler can choose not to handle a given request, using empty or its synonym pass, and you can try alternative handlers with the <|> operator:
    a :: Snap String a =
    pass b :: Snap String b = return "foo" c :: Snap String c = a
    <|> b -- try running a, if it fails then try b
    
  4. Convenience functions (writeBS, writeLBS, writeText, writeLazyText, addToOutput) for queueing output to be written to the Response, or for streaming to the response using io-streams:
    example ::
    (OutputStream Builder -> IO (OutputStream
    Builder)) -> Snap () example streamProc = do writeBS
    "I'm a strict bytestring" writeLBS "I'm a lazy bytestring"
    writeText "I'm strict text" addToOutput streamProc
    
  5. Early termination: if you call finishWith:
    a :: Snap ()
    a = do modifyResponse $ setResponseStatus 500 "Internal
    Server Error" writeBS "500 error" r <- getResponse
    finishWith r 
    then any subsequent processing will be skipped and the supplied Response value will be returned from runSnap as-is.
  6. Access to the IO monad through a MonadIO instance:
    a :: Snap () a = liftIO fireTheMissiles
    
  7. The ability to set or extend a timeout which will kill the handler thread after N seconds of inactivity (the default is 20 seconds):
    a :: Snap () a = setTimeout 30 
  8. Throw and catch exceptions using a MonadBaseControl instance:
    import Control.Exception.Lifted
    (SomeException, throwIO, catch) foo :: Snap ()
    foo = bar `catch` (e::SomeException) -> baz where bar =
    throwIO FooException 
  9. Log a message to the error log:
    foo :: Snap () foo =
    logError "grumble." 
You may notice that most of the type signatures in this module contain a (MonadSnap m) => ... typeclass constraint. MonadSnap is a typeclass which, in essence, says "you can get back to the Snap monad from here". Using MonadSnap you can extend the Snap monad with additional functionality and still have access to most of the Snap functions without writing lift everywhere. Instances are already provided for most of the common monad transformers (ReaderT, WriterT, StateT, etc.).
This module provides convenience exports of the modules most commonly used when developing with the Snap Framework. For documentation about Snaplets, see Snap.Snaplet. For the core web server API, see Snap.Core.
Snap integration for the WebSockets library
Modifies a PackageDescription by appending a snapshot number corresponding to the given date.
Modifies a Version by appending a snapshot number corresponding to the given date.
Snap: A Haskell Web Framework (core interfaces and types) Snap is a simple and fast web development framework and server written in Haskell. For more information or to download the latest version, you can visit the Snap project website at http://snapframework.com/. This library contains the core definitions and types for the Snap framework, including:
  1. Primitive types and functions for HTTP (requests, responses, cookies, post/query parameters, etc)
  2. A monad for programming web handlers called "Snap", which allows:
  • Stateful access to the HTTP request and response objects
  • Monadic failure (i.e. MonadPlus/Alternative instances) for declining to handle requests and chaining handlers together
  • Early termination of the computation if you know early what you want to return and want to prevent further monadic processing
Quick start: The Snap monad and HTTP definitions are in Snap.Core.
Constructs a url relative to the current snaplet.
A web server for the Snap Framework Snap is a simple and fast web development framework and server written in Haskell. For more information or to download the latest version, you can visit the Snap project website at http://snapframework.com/. The Snap HTTP server is a high performance web server library written in Haskell. Together with the snap-core library upon which it depends, it provides a clean and efficient Haskell programming interface to the HTTP protocol.
A short string describing the Snap server version
Take an atomic snapshot of the current state of the virtual file system.
Event source with a single occurrence at or as soon after (local) time tEv as possible. The value of the event is obtained by sampling the input a that time.
Takes a "snapshot" of the input and terminates immediately with the input value as the result. No time passes; therefore, the following must hold:
snapT >> snapT = snapT
If true assures no duplicates are returned, or objects missed, which were present at both the start and end of the query's execution (even if the object were updated). If an object is new during the query, or deleted during the query, it may or may not be returned, even with snapshot mode. Note that short query responses (less than 1MB) are always effectively snapshotted. Default = False
Move the point to inside the viewable region
Move the visible region to include the point
A formal conversion from signals to signal generators, which effectively allows for retrieving the current value of a previously created signal within a generator. This includes both signals defined in an external scope as well as those created earlier in the same generator. It can be modelled by the following function:
snapshot s t_start s_input = s t_start
A formal conversion from signals to signal generators, which effectively allows for retrieving the current value of a previously created signal within a generator. This includes both signals defined in an external scope as well as those created earlier in the same generator. In the model, it corresponds to the identity function.