Proxima Home
Gallery
Download
Documentation
Proxima Client
Proxima Server
Proxima Engine
Building an editor
User manual
Publications
Contribute
Bug reporting
Oblomov Systems
Center
Home
Courses
People
Projects
Page
Edit Page
Rename Page
Attach File
Printable
Wiki Source
More ...
Web
Recent Changes
Notify Service
News
Page Index
Search
More ...
Wiki
About TWiki
Text Formatting
Registration
Change Password
Reset Password
Users
Groups
Log In
or
Register
Evaluation And Reduction Sheets
Proxima
The evaluation and reduction sheets (=$instantiation/src/Evaluator.hs= and =$instantiation/src/Reducer.hs=) specify how the document is mapped onto the enriched document and back. Both sheets are Haskell modules, which must declare an instance of a multi-parameter type class (resp. =EvaluationSheet= and =ReductionSheet=). For the evaluation sheet, the class is: <verbatim> class EvaluationSheet doc enr clip | doc -> clip where evaluationSheet :: LayerStateEval doc clip -> DocumentLevel doc clip -> EnrichedDocLevel enr doc -> EditDocument' doc enr node clip token -> DocumentLevel doc clip -> IO (EditEnrichedDoc' doc enr node clip token, LayerStateEval doc clip, DocumentLevel doc clip) evaluationSheetSimpleIO :: LayerStateEval doc clip -> doc -> enr -> doc -> IO (enr, LayerStateEval doc clip, doc) evaluationSheetSimple :: LayerStateEval doc clip -> doc -> enr -> doc -> (enr, LayerStateEval doc clip, doc) evaluationSheetSimplest :: doc -> enr </verbatim> In order to declare an instance, it is only necessary to define one of the member functions. The simplest option is to declare the function =evaluationSheetSimples=, which directly maps the document on the enriched document. A bit more powerful is =evaluationSheetSimple=, which also defines a mapping from document to enriched document, but it gets the layer state and the old values of the document and the enriched document as additional parameters. Besides the enriched document, the function also returns the updated layer state and the new value for the document. An IO version of this function is =evaluationSheetSimpleIO=. Finally, =evaluationSheet= is the most powerful as it gets all parameters that exist at the evaluation layer. It is not very likely, however that this function will be needed. For the reduction sheet, the situation is dual, with the exception that =reductionSheet= does not get the edit operation parameter, since this will always be a =SetEnr= (in the evaluation sheet, it may be either =SetDoc'= or =EvaluateDoc'=). The class is: <verbatim> class ReductionSheet doc enr clip | doc -> clip where reductionSheet :: LayerStateEval doc clip -> EnrichedDocLevel enr doc -> DocumentLevel doc clip -> EnrichedDocLevel enr doc -> IO (EditDocument doc enr node clip token, LayerStateEval doc clip, EnrichedDocLevel enr doc) reductionSheetSimpleIO :: LayerStateEval doc clip -> enr -> doc -> enr -> IO (doc, LayerStateEval doc clip, enr) reductionSheetSimple :: LayerStateEval doc clip -> enr -> doc -> enr -> (doc, LayerStateEval doc clip, enr) reductionSheetSimplest :: enr -> doc </verbatim> -- Main.MartijnSchrage - 23 Jan 2008