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

  • Popa D
N/ACitations
Citations of this article
1Readers
Mendeley users who have this article in their library.

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

CITATION STYLE

APA

Popa, D. (2008). Direct Modular Evaluation of Expressions using the Monads and Type Classes in Haskell. STUDII ŞI CERCETĂRI ŞTIINŢIFICE, 18, 233–248.

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free