-
Notifications
You must be signed in to change notification settings - Fork 12
/
MFlow.cabal
216 lines (210 loc) · 13.2 KB
/
MFlow.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: MFlow
version: 0.4.6.0
cabal-version: >=1.8
build-type: Simple
license: BSD3
license-file: LICENSE
maintainer: [email protected]
stability: experimental
bug-reports: https://github.com/agocorona/MFlow/issues
synopsis: stateful, RESTful web framework
description: 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.
.
-At the same time, maintaining for the programmer all the freedom that they have in web applications. MFlow keeps out of your way.
.
-For scalability-sensitive applications, no fat state snapshots that other continuation-based frameworks need to cope with these two previous requirements. State replication and horizontal scalability are central to MFlow's philosophy.
.
-For REST advocates, MFlow maintains the elegant notation of REST URLs and the statelessness of GET requests.
.
-For expert Haskell programmers, reuse of already existing web libraries and techniques is trivial.
.
-For beginner programmers and for software engineers, MFlow provides a high level DSL of reusable and self contained widgets for the user interface, and multipage procedures that work together provided that they statically typecheck with zero configuration.
.
-For highly interactive applications, MFlow gives dynamic widgets that have their own behaviors in the page and they communicate without the need of explicit JavaScript programming.
.
-No deployment, speed up the development process. see <http://haskell-web.blogspot.com.es/2013/05/a-web-application-in-tweet.html>
.
.
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.
.
www.hackage.haskell.org/package/TCache
.
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 <http://haskell-web.blogspot.com.es/2013/05/a-web-application-in-tweet.html>
.
.
Features
~~~
.
-Push widgets: http://haskell-web.blogspot.com.es/2013/07/maxwell-smart-push-counter.html
.
-Complete execution traces for errors: http://haskell-web.blogspot.com.es/2013/07/automatic-error-trace-generation-in.html
.
-RESTful URLs: http://haskell-web.blogspot.com.es/2013/07/the-web-navigation-monad.html
.
-Automatic, independent refreshing of widgets via Ajax. (see http://haskell-web.blogspot.com.es/2013/06/and-finally-widget-auto-refreshing.html)
.
-Besides applicative syntax (declarative-like) each widget can use the monadic syntax (imperative-like) so widgets can express their own behavior and can run its own independent page flow. (see http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html)
.
-Per-widget callbacks, used in page flows, that change the rendering of the widget (see http://haskell-web.blogspot.com.es/2013/06/callbacks-in-mflow.html)
.
-Widgets in modal and non modal dialogues (using jQuery dialog)
.
-Other jQuery widgets as MFlow widgets
.
-WAI integration
.
-Content management and multilanguage
.
-blaze-html support
.
-Ajax
.
-User-defined data in sessions
.
-Widget requirements for automatic installation of scripts, CSS and server flows.
.
-Transparent back button management
.
-Cached widgets
.
-Callbacks
.
-Lazy load of widgets
.
-Web Services
.
.
Changelog
~~~
.
0.4.5.10 compatibility with ghc 7.10
.
0.4.5.8 added rawSend
.
The version 0.4.5.4 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.
www.haskell-web.blogspot.com.es/2013/11/more-composable-elements-for-single.html
.
The version 0.3.1 included:
.
- Push widgets: 'http://haskell-web.blogspot.com.es/2013/07/maxwell-smart-push-counter.html'
.
- Complete execution traces for errors: 'http://haskell-web.blogspot.com.es/2013/07/automatic-error-trace-generation-in.html'
.
The version 0.3 added:
- RESTful URLs: 'http://haskell-web.blogspot.com.es/2013/07/the-web-navigation-monad.html'
.
- Automatic independent refreshing of widgets via Ajax. (see 'http://haskell-web.blogspot.com.es/2013/06/and-finally-widget-auto-refreshing.html')
.
- Page flows: Monadic widgets that can express his own behavior and can run its own independent page flow. (see http://haskell-web.blogspot.com.es/2013/06/the-promising-land-of-monadic-formlets.html)
.
- Widget callbacks, used in page flows, that change the rendering of the widget (see http://haskell-web.blogspot.com.es/2013/06/callbacks-in-mflow.html)
.
- Widgets in modal and non modal dialogues (using jQuery dialog)
.
- Other jQuery widgets as MFlow widgets
.
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:
.
-Clustering
.
category: Web, Application Server
author: Alberto Gómez Corona
data-dir: ""
extra-source-files: src/MFlow/Hack.hs
src/MFlow/Hack/Response.hs
src/MFlow/Hack/XHtml.hs
src/MFlow/Hack/XHtml/All.hs src/MFlow/Forms/HSP.hs
src/MFlow/Forms/XHtml.hs
src/MFlow/Wai/XHtml/All.hs
source-repository head
type: git
location: http://github.com/agocorona/MFlow
library
build-depends: Workflow , transformers , mtl ,
extensible-exceptions , base >4.0 && <5,
bytestring , containers , RefSerialize , TCache ,
stm >2, time, old-time , vector , directory ,
utf8-string , wai , wai-extra, resourcet, case-insensitive ,
http-types , conduit ,conduit-extra, text , parsec , warp ,
warp-tls , random , blaze-html , blaze-markup ,
monadloc, clientsession, pwstore-fast
exposed-modules: MFlow MFlow.Wai.Blaze.Html.All MFlow.Forms
MFlow.Forms.Admin MFlow.Cookies MFlow.Wai
MFlow.Forms.Blaze.Html MFlow.Forms.Test
MFlow.Forms.Widgets MFlow.Forms.Internals
MFlow.Forms.WebApi MFlow.Forms.Cache
exposed: True
buildable: True
hs-source-dirs: src .
other-modules: MFlow.Wai.Response
build-tools: cpphs
--executable demos-blaze
-- build-depends: MFlow , RefSerialize , TCache ,
-- tcache-AWS , directory , Workflow , base ,
-- blaze-html , bytestring , containers , mtl ,
-- old-time , stm , text , transformers , vector ,
-- hamlet , shakespeare, monadloc , aws , network , hscolour ,
-- persistent-template , persistent-sqlite , persistent ,
-- conduit , http-conduit , monad-logger , safecopy ,
-- time, acid-state, data-default
-- main-is: demos-blaze.hs
-- buildable: True
-- hs-source-dirs: Demos
-- other-modules: TestREST ShopCart AjaxSample TraceSample IncreaseString IncreaseInt
-- AutoCompList ListEdit AutoComplete Menu RuntimeTemplates
-- LoginSample CheckBoxes Multicounter MFlowPersistent
-- Combination Options ContentManagement Database
-- PreventGoingBack Counter MCounter PushDecrease
-- Dialog PushSample Grid Radio Actions
-- SumView AcidState SearchCart
-- InitialConfig GenerateForm GenerateFormUndo GenerateFormUndoMsg WebService
-- LazyLoad CachingDataset
-- ghc-options: -iDemos -threaded -rtsopts