UMinho Haskell Libraries (1.0)ContentsIndex
Control.ModelViewController
Portability portable
Stability experimental
Maintainer joost.visser@di.uminho.pt
Contents
Representation
Create a full online application.
Create parts.
Creating specific views.
Description
A framework for the Model-View-Controller design pattern. In particular, this module allows easy constructions of on-line applications that offer a simple menu structure for manipulation of an underlying model.
Synopsis
data Controller model = Controller {
initModel :: (FileReference -> IO model)
modelOperations :: [(String, ModelOperation model)]
modelViews :: [(String, ModelView model)]
}
data ModelOperation model = forall p l v h . (ConnectCGI p l v h, InputHandle h) => MO l (model -> p) (model -> v -> model)
data ModelView' model = forall p l v h . (ConnectCGI p l v h, InputHandle h) => MV' l (model -> p) (model -> v -> WithHTML () CGI ())
data ModelView model = MV (model -> WithHTML () CGI ())
mvc :: (Read model, Show model) => Controller model -> CGI ()
menuQuery :: (Read model, Show model) => Controller model -> model -> (String, ModelView model) -> CGI ()
mkMenuButtons :: (Read model, Show model) => Controller model -> model -> [(String, ModelView model)] -> [(String, ModelOperation model)] -> [(String, CGI ())]
mkView :: (String, ModelView model) -> model -> WithHTML () CGI ()
graphView :: String -> (model -> String) -> ModelView model
Representation
data Controller model
The type of controllers parameterized by the type of models.
Constructors
Controller
initModel :: (FileReference -> IO model)Action to initialize the model.
modelOperations :: [(String, ModelOperation model)]List of operations on the model.
modelViews :: [(String, ModelView model)]List of views on the model.
data ModelOperation model
The type of operations on the model.
Constructors
forall p l v h . (ConnectCGI p l v h, InputHandle h) => MO l (model -> p) (model -> v -> model)
data ModelView' model
The type of views on the model.
Constructors
forall p l v h . (ConnectCGI p l v h, InputHandle h) => MV' l (model -> p) (model -> v -> WithHTML () CGI ())
data ModelView model
Constructors
MV (model -> WithHTML () CGI ())
Create a full online application.
mvc :: (Read model, Show model) => Controller model -> CGI ()
Create application for a model and its controller.
Create parts.
menuQuery
:: (Read model, Show model)
=> Controller modelController
-> modelCurrent model
-> (String, ModelView model)Selected view
-> CGI ()Main application window.
Create the main application window with menu and selected view.
mkMenuButtons :: (Read model, Show model) => Controller model -> model -> [(String, ModelView model)] -> [(String, ModelOperation model)] -> [(String, CGI ())]
Create menu buttons for continuation to other views.
mkView :: (String, ModelView model) -> model -> WithHTML () CGI ()
Create a view on the model.
Creating specific views.
graphView
:: StringLabel
-> (model -> String)create dot string from model
-> ModelView model
View a graph generated from the current model.
Produced by Haddock version 0.6