From a485577545e32816aede2b692415d349ac754179 Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Wed, 6 Apr 2016 17:46:32 +0200 Subject: [PATCH] update' --- long/long.tex | 71 +++++++++++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/long/long.tex b/long/long.tex index 7bcc377..44900db 100644 --- a/long/long.tex +++ b/long/long.tex @@ -5,8 +5,8 @@ \section{Introduction} \subsection{Setting and objective} -\emph{Monads for functional programming} was initially published in -\emph{Program Design Calculi} which was a collection of lecture notes +\emph{Monads for functional programming} was initially published by P.\ Wadler +in \emph{Program Design Calculi} which was a collection of lecture notes accompanying the \emph{Marktoberdorf} summer school in 1992. Later it was reissued in \emph{Springer}s \emph{Advanced Functional Programming} book which presents the tutorials from a spring school situated in Sweden in 1995. @@ -56,9 +56,9 @@ functional programming world. \subsection{\emph{Expression problem}} In this review we will show one of the examples given to illustrate the meaning and usage the monadic pattern. The code snippets in the original paper -supposedly are \emph{haskell} however they are not all valid. Thus the +supposedly are \emph{Haskell} however they are not all valid. Thus the following snippets have been translated to valid -\emph{Clean}~\footnote{\url{http://clean.cs.ru.nl}} +\emph{Clean}~\footnote{\url{http://clean.cs.ru.nl}}. \paragraph{Simple evaluator} Say we have a simple evaluator where an expression is either an integer or a @@ -162,38 +162,49 @@ eval (Div t u) = eval t >>= \a->eval u >>= \b->tick >>= \_->unit (a/b) \end{CleanCode} \subsection{Evidence} -Besides the example shown above Wadler shows also shows the usefulness of -monads in a setting where you use lists, arrays and recursive descent parsers. -These examples show the flexibility and ease that monads bring. Especially for -input/output the monadic pattern is useful. If one wants to capture -side-effects, instead of reimplementing every function for the particular side -effects you can just write the monadic operations and let the monads handle the -rest. - -Even after more than 20 years the monadic pattern is used throughout the -functional programming world and is incorporated in all the functional -programming languages used by the academic and by everyday programmers such as -\emph{Haskell} and \emph{Clean}. +Besides the example shown above, Wadler shows also shows the usefulness of +monads for lists, arrays and recursive descent parsers. While these examples +strengthen the proposed solution they do not necessarily provide extra or +stronger proof and are thus not treated here. + +Especially for input/output the monadic pattern is useful. If one wants to +capture side-effects, instead of reimplementing every function for the +particular side effects you can just write the monadic operations and let the +monads handle the rest. + +Even after more than 20 years the monadic pattern has proven to be very useful. +For example in the programming language \emph{Haskell} all the input and output +are handled using a specialized monadic structure. Monadic constructions are +also incorporated in the standard library/prelude of pure functional languages +such as \emph{Haskell} and \emph{Clean}. Even in impure languages the +constructions turns out to be useful and thus monadic structures are available +as library options or extensions in languages such as \emph{Scheme}, +\emph{Perl}, \emph{Python}, \emph{Scala} and many more. \section{Analysis} \subsection{Writing style} -The paper has been written for (under)-graduate students and thus it is -extremely readable. Even with no particular domain knowledge the paper is very -clear. The author tackles the expression problem, arrays as a state and parsers -which are classical problems in the functional programming field. Even when the -reader has little knowledge of functional programming those problems are -familiar and are effective in illustrating the power of monads. +The paper/lecture notes has been written for (under)-graduate students and thus +it is extremely readable. Even with no particular domain knowledge in the paper +is very clear. There is a gradual buildup in complexity which results in an +easy read for the reader. + +To make the point clear the author tackles the expression problem, arrays as a +state and parsers which all are classical problems in the functional +programming field. Even when the reader has little knowledge of functional +programming those problems are likely to be familiar and are become effective +in illustrating the power of monads. \subsection{Discussion} -Within the time frame of publishing these are near perfect publication, however -in hindsight there are some things that could be improved upon. +Within the time frame and setting in which the paper is published this is a +very good publication. However in hindsight there are some things that could be +improved upon. -The language use is sometimes a bit informal and possibly even fluffy. However, -the fact that these were originally lecture notes for a summer school clear -this issue up. +The language used is sometimes a bit informal and possibly even fluffy. +However, the fact that these were originally lecture notes for a summer school +clear this issue up. -Secondly the section about parsers is quite big and not might not be necessary -for illustrating the power of monads. The contents of this section could very -well be a paper on its own. +Secondly, the section about parsers is quite big and could very well be a paper +on its own. The approach and definitions in the parser example are significantly +different than in the previous examples and therefore. \end{document} -- 2.20.1