[Haskell-cafe] Why Haskell is beautiful to the novice
Rustom Mody
rustompmody at gmail.com
Tue Sep 1 17:53:19 UTC 2015
On Mon, Aug 31, 2015 at 1:57 PM, Alexey Muranov <alexey.muranov at gmail.com>
wrote:
> On 31 août 2015, at 06:11, Richard A. O'Keefe <ok at cs.otago.ac.nz> wrote:
>
> > Sorry, cliekd the wrong button.
> > If you had troubled to read the Wikipedia article with care,
> > you'd have seen this right at the beginning:
> >
> > In computer science, a function or expression is
> > VVVVVVVVVVVVVVVVVVVVVVVV
> > said to have a side effect if, in addition to returning
> > ^^^^^^^^^^^^^^^^^^^^^^^^
> > a value, it also modifies some state or has an observable
> > interaction with calling functions or the outside world.
> >
> > You have a function, whose purported effect is to return a
> > value. "IN ADDITION TO" that, it has "A SUBSIDIARY CONSEQUENCE",
> > "A SECONDARY RESULT".
>
> In my opinion, with such interpretation there can be no documented side
> effects: if some effect is documented, it is purported (an probably used by
> someone), so not secondary.
>
>
I think this argument represents a generation gap:
Those brought up on Pascal will find it obvious what Richard (is trying)
to say:
- a function either just returns a value or has side-effects
- a procedure has effects -- nothing 'on the side' here.
Unfortunately C screwed up a whole generation by removing this distinction
from our thinking ontologies
And the languages that have followed C are often worse eg python's None
return is more ambiguous than C's void return
eg. Ive found experienced python programmers dont understand that the
'procedure' appellation can only be applied to to functions that ALWAYS
return None
One could say that Haskell's monadic types reinstates Pascal's dichotomy
More on this here:
http://blog.languager.org/2015/06/functional-programming-moving-target.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20150901/df62b695/attachment.html>
More information about the Haskell-Cafe
mailing list