Sign up & Download
Sign in

Direct Modular Evaluation of Expressions using the Monads and Type Classes in Haskell

by Dan Popa
STUDII ŞI CERCETĂRI ŞTIINŢIFICE ()

Abstract

During last decade, the expression evaluators and the list monad had attracted both mathematicians (especially from the field of Category Theory) and computer scientists. For the last group, the main kind of applications comes from the field of DSL interpretation. As a consequence of our research, we are able to introduce a new kind of modular tree-less expression evaluator, which can be build by importing modular components into a main Haskell program. In order to keep the parser of the DSL modular, parser combinators from ParseLib [Hutton G., Meijer E., (1998) ] was used. In order to keep the source and the implicit syntax tree modular we have replace the data constructors by regular functions over the list monad, inspired by an idea from Haskell Report [Peyton Jones S. (editor) (2002)]: data constructors are in fact just simple functions. This gave us the idea of the replacement of data constructors with functions over monadic actions called by us pseudoconstructors. The modular evaluator was written in do-notation, on the idea that expressions should evaluate them-self nor by the help of an interpret- function as in some papers like [Sheard T.; Benaissa Z. ; Pasalic E. (1999)] and others. As a consequence, the useful data declarations which usually appears in DSL implementations are completely missing, shortening the source and reducing the work of the programmer. A new vision of monadic semantics is now introduced. The semantics is not a function:interp :: Term -> Environment -> Monad but more likely a sort of Monad -> Monad -> ... Monad specification in contrast with the papers [Wadler P. (1992-1995)] .

Cite this document (BETA)

Readership Statistics

1 Reader on Mendeley
by Discipline
 
by Academic Status
 
100% Lecturer

Sign up today - FREE

Mendeley saves you time finding and organizing research. Learn more

  • All your research in one place
  • Add and import papers easily
  • Access it anywhere, anytime

Start using Mendeley in seconds!

Already have an account? Sign in