The MFlow package

[Tags: bsd3, library]

MFlow is a web framework that turns the mess of web programming from handlers and configuration files back into sane and normal programming. Your code is the website.

The goals of MFlow are. ~~~ -Inverting back the inversion of control of web applications and turn web programming into ordinary, intuitive, imperative-like programming.

How navigation works ~~~ MFlow solves the problem of re-inversion of control by using a different approach, routes are expressed as normal monadic Haskell code in the FlowM monad, local links point to alternative routes within this monadic computation, this means any GET page is directly reachable by means of a RESTful URL.

At any moment the flow can respond to the back button or to any RESTful path that the user may paste in the navigation bar. If the procedure is waiting for another different page, the FlowM monad backtrack until the paths partially match. From this position on the execution goes forward until the rest of the paths match. Thus, no matter the previous state of the server process it will recover the state of execution appropriate for the request. This way the server process is virtually stateless for any GET request. It is also possible to store a session state, which may backtrack or not, when the navigation goes back and forth. MFlow keeps it all in sync, synchronization between server state and web browser state is supported out-of-the-box.

When the state matters, and user interactions can last for long period of time, such are shopping carts etc., MFlow uses a log for thread state persistence. The server process shuts itself down after a programmer defined timeout, once a new request of the same user arrives, the log is used to recover the process state. There is no need to store a snapshot of every continuation, just the result of each step. This solves the problem of fat state snapshots and give a very lightweight way to handle state.

Data tier ~~~ State consistency and transactions are handled by the TCache package.


It is data cache within the STM monad (Software Transactional Memory), serialization and deserialization of data is programmer defined. TCache can adapt to any database, default persistence in files comes out of the box for rapid development purposes, but you can switch to a variety of backends when needed, see the database examples for more details.

Widgets ~~~ The processes interact through widgets, which are an extension of formlets with additional applicative combinators, formatting, link management, callbacks, modifiers, caching, and AJAX. All of it is coded in pure Haskell and you use pure Haskell to make your own widgets. Each widget return statically typed data, they can dynamically modify themselves using AJAX internally (just prefix it with auto refresh), are auto-contained: they may include their own JavaScript code, server code and client code in a single pure Haskell procedure that can be combined with other widgets with no other configuration.

To combine widgets, applicative combinators are used. Widgets with dynamic behaviors that use the monadic syntax and callbacks. When you combine widgets, everything is type checked and making large websites by gluing together small reusable building blocks is the entire aim of the MFlow project.

Modularity ~~~ The interfaces and communications are abstract and there are bindings for blaze-HTML, HSP, Text.XHtml, ByteString, Hack, and WAI. So it can be extended to non web based architectures.

Bindings for hack, and HSP >= 0.8, are not installed by default, but are included in the package files. To use them, add them to the exported modules and execute cabal install

It is designed for applications that can be run with no deployment with runghc in order to speed up the development process. see

Features ~~~

Changelog ~~~ compatibility with ghc 7.10 added rawSend

The version add compatibility with GHC 7.8

The version 0.4.5 composable HTTP caching, lazy load, caching datasets in the browser HTTP cache

The version 0.4.0 add encrypted cookies, secure sessions, add REST web services, fixes UTF8 errors, pageFlow fixes, add onBacktrack, compensate

The version 0.3.3 run with wai 2.0

The version 0.3.2 add runtime templates. It also add witerate and dField, two modifiers for single page development. dField creates a placeholder for a widget that is updated via implicit AJAX by witerate.

The version 0.3.1 included:

The version 0.3 added: - RESTful URLs:

The version 0.2 added better WAI integration, higher level dynamic Widgets, content management, multilanguage, blaze-HTML support, stateful Ajax for server-side control, user-defined data in sessions and widget requirements for automatic installation of scripts, CSS and server flows.

The version 0.1 had transparent back button management, cached widgets, callbacks, modifiers, heterogeneous formatting, AJAX, and WAI integration.

See MFlow.Forms for details

To do:


Versions0.0.0, 0.0.1, 0.0.2, 0.0.3, 0.0.4, 0.0.5,,,,,,,,,,,,,,,,,,,,,,,,,, 0.3.3, 0.4.0, 0.4.1, 0.4.2, 0.4.4, 0.4.5,,,,,,,,,,,,,,
Change logNone available
Dependenciesbase (>4.0 && <5), blaze-html, blaze-markup, bytestring, case-insensitive, clientsession, conduit, conduit-extra, containers, directory, extensible-exceptions, http-types, monadloc, mtl, old-time, parsec, pwstore-fast, random, RefSerialize, resourcet, stm (>2), TCache, text, time, transformers, utf8-string, vector, wai, wai-extra, warp, warp-tls, Workflow [details]
AuthorAlberto Gómez Corona
CategoryWeb, Application Server
Bug tracker
Source repositoryhead: git clone
UploadedMon Sep 21 11:05:45 UTC 2015 by AlbertoCorona
DistributionsNixOS:, Stackage:
Downloads9487 total (423 in last 30 days)
0 []
StatusDocs available [build log]
Last success reported on 2015-09-21 [all 1 reports]




Maintainers' corner

For package maintainers and hackage trustees