[Haskell-cafe] Re[2]: strict Haskell dialect

John Meacham john at repetae.net
Tue Feb 14 19:48:58 EST 2006


On Sat, Feb 11, 2006 at 04:34:37PM +0300, Bulat Ziganshin wrote:
> {putStr "a"} is a function, which receives previous world state and
> returns updated world state where "a" is written to the terminal. it's
> an _essential_ part of monadic way to I/O

not true. there are actually several ways to implement IO. There is a
paper about it somewhere that explores various methods, but I can't seem
to find it, does anyone know which one i am thinking of? I know it at
least explores the state and continuation versions as well as some that
don't use monads I thought. It was either part of a general paper on
monads or something specific to doing IO...

> in the list comprehension, filters also use value of current list
> element. if filter don't use this element value, it can be computed
> prior to comprehesion to speed the things up
> 
> >> and the same for any other monad. concept of the monad by itself means
> >> carrying "hidden" state from one monadic operation to the next.
> 
> WJ> That's too specific.  A list, for example, doesn't have to do anything with 
> WJ> state and [a] is not represented as a function.

or even the trivial Identity monad certainly has no state. The maybe
monad doesn't either. it carries no extra state with it, but rather
allows one to discard later computations. the reader monad has no state
but rather distributes a value commutativly to its subcomputations. The
State monad is just one of many very useful monads. A monad is precisely
anything that satisfies the monad laws.

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Haskell-Cafe mailing list