MFlow 0.2.0.8 → 0.2.0.9
raw patch · 4 files changed
+28/−14 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ MFlow.Forms: runFlowConf :: (FormInput view, MonadIO m) => FlowM view m a -> m a
Files
- MFlow.cabal +9/−10
- src/MFlow/Forms.hs +1/−1
- src/MFlow/Forms/Internals.hs +14/−0
- src/MFlow/Wai.hs +4/−3
MFlow.cabal view
@@ -1,5 +1,5 @@ name: MFlow-version: 0.2.0.8+version: 0.2.0.9 cabal-version: >=1.6 build-type: Simple license: BSD3@@ -15,8 +15,8 @@ potentially that makes the MFlow architecture scalable. . These processes are stopped and restarted by the- application server on demand, including its execution state. Therefore session management- is automatic. State consistence and transactions are given by the TCache package.+ application server on demand, including the execution state (if the Wokflow monad is used.+ Therefore session management is automatic. State consistence and transactions are given by the TCache package. . The processes interact trough widgets, that are an extension of formlets with additional applicative combinators, formatting, link management, callbacks, modifiers, caching,@@ -28,22 +28,21 @@ Bindings for hack, and hsp >= 0.8, are not compiled by Hackage, and do not appear, but are included in the package files. To use them, add then to the exported modules and execute cabal install .- The previous release add transparent back button management, cached widgets, callbacks, modifiers, heterogeneous formatting, AJAX,+ It is designed for applications that can be run with no deployment with runghc in order+ to speed up the development process. see "Web application in a tweet": http://haskell-web.blogspot.com.es/2013/05/a-web-application-in-tweet.html+ .+ The previous release (0.1) add transparent back button management, cached widgets, callbacks, modifiers, heterogeneous formatting, AJAX, and WAI integration. .- This version add better WAI integration, higher level dynamic Widgets, content management, multilanguage, blaze-html support,+ This version (0.2) add 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.- .- It is designed for applications that can be run with no deployment with runghc in order- to speed up the development process.+ This version (0.2.0.9) add the runFlowConf primitive . See "MFlow.Forms" for details . Although still it is experimental, it is being used in at least one future commercial project. So I have te commitment to continue its development. There are many examples in the documentation and in the package.- .- In this release preventGoingBack was added . To do: .
src/MFlow/Forms.hs view
@@ -185,7 +185,7 @@ , flatten, normalize -- * Running the flow monad -,runFlow,runFlowOnce,runFlowIn,MFlow.Forms.Internals.step, goingBack,breturn, preventGoingBack+,runFlow,runFlowOnce,runFlowIn,runFlowConf,MFlow.Forms.Internals.step, goingBack,breturn, preventGoingBack -- * Setting parameters ,setHeader
src/MFlow/Forms/Internals.hs view
@@ -42,6 +42,9 @@ import Control.Monad.Identity import Data.List import System.IO.Unsafe+import Control.Concurrent.MVar++ instance Serialize a => Serializable a where serialize= runW . showp deserialize= runR readp@@ -627,6 +630,7 @@ where loop f t= f t >>= \t -> loop f t + -- | Clears the environment clearEnv :: MonadState (MFlowState view) m => m () clearEnv= do@@ -661,6 +665,16 @@ where runFlow1 f t= evalStateT (runBackT . runFlowM $ f) mFlowState0{mfToken=t,mfEnv= tenv t} -- >>= return . fromFailBack -- >> return ()++-- | to unlift a FlowM computation. useful for executing the configuration generated by runFLowIn+-- outside of a web application+runFlowConf :: (FormInput view, MonadIO m) + => FlowM view m a -> m a +runFlowConf f = do+ q <- liftIO newEmptyMVar -- `debug` (i++w++u)+ qr <- liftIO newEmptyMVar+ let t= Token "" "" "" [] q qr+ evalStateT (runBackT . runFlowM $ f ) mFlowState0{mfToken=t} >>= return . fromFailBack -- >> return ()
src/MFlow/Wai.hs view
@@ -100,7 +100,7 @@ Just ck -> ck:retcookies1 -} - input <- case parseMethod $ requestMethod req1 of + input <- case parseMethod $ requestMethod req1 of Right POST -> if lookup ("Content-Type") httpreq1 == Just "application/x-www-form-urlencoded" then do inp <- liftIO $ runResourceT (requestBody req1 $$ CList.consume) @@ -110,13 +110,14 @@ Right GET -> let tail1 s | s==SB.empty =s tail1 xs= SB.tail xs in return . urlDecode $ SB.unpack . tail1 $ rawQueryString req1 -- !> (SB.unpack $ rawQueryString req1) - x -> return [] + x -> return []+ let req = case retcookies of [] -> req1{requestHeaders= mkParams (input ++ cookies) ++ requestHeaders req1} -- !> "REQ" _ -> req1{requestHeaders= mkParams ((flow, flowval): input ++ cookies) ++ requestHeaders req1} -- !> "REQ" - (resp',th) <- liftIO $ msgScheduler req -- !> (show $ requestHeaders req) + (resp',th) <- liftIO $ msgScheduler req -- !> (show $ requestHeaders req) let resp= case (resp',retcookies) of (_,[]) -> resp'