On Mon, Jan 18, 2010 at 6:37 AM, Viktor Cerovski
<[email protected]> wrote:
> That's true and important to emphasize: to fully use monads
> in the Haskell sense of the word, we need a language that
> supports what Haskell does: typed lambda calculus and
> parametric types to begin with, or something equivalent to
> that.
>
> So I'm not trying to define Haskell monads in J settings, that,
> as I gather from surfing the web, seems to me impossible to
> properly do in any of the other "standard" languages (the list is
> long), but only to find an example of some operations that could
> be considered as instances of Haskell monads.
...
> Monads are considerably more tricky, because at first
> glance, they are trying to solve a problem that does not even
> appear as a problem in imperative languages.

Personally, I have been deeply suspicious of Monads.

First, they are often represented in a way that I feel is
confusing.  For example, consider this misleading
statement from today's Wikipedia:

   The primary uses of monads in functional programming
   are to express input/output (I/O) operations and changes
   in state without using language features that introduce
   side effects.

Conceptually speaking a Monad will let you take a pure
function F and produce a new "function except with side
effects" FS which is based on F.

In other words, monads are a language feature which
allows people to write Haskell programs which use
side effects -- and this should be trivially obvious since
I/O is a canonical example of a side effect.  Yet, false
statements such as that which I found in the wikipedia
pervade writeups on Monads.

Second, current Monad implementations seem to be
intrinsically wedded to "type systems".  And type systems
impose the illusion and sometimes constraint that function
domains should be related in the contexts where that does
not really fit the application.

(I will agree that type systems can sometimes be useful,
but given they way people usually use them -- and represent
them -- I feel they invite unnecessary complexities.)

> Once this has been accomplished, however, there is
> suddenly a powerful way of talking about various types
> of programs, be they sequential or not.

Simplicity is powerful.

As things currently stand, I feel that Monads are too
complex for a language like J.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to