[Haskell-cafe] Re[2]: strict Haskell dialect
Bulat Ziganshin
bulatz at HotPOP.com
Sat Feb 11 08:34:37 EST 2006
Hello Wolfgang,
Saturday, February 11, 2006, 3:17:12 PM, you wrote:
>> each and every monadic operation is a function!
WJ> What do you mean with "monadic operatation"? (>>=), (>>) and return are, of
WJ> course, functions but an I/O action like getChar is *not* a function. Also a
WJ> list is not a function but a value of the list monad.
>> type "IO a" is really "RealWorld -> (RealWorld,a)"
WJ> This representation is just there to help people understand what I/O is but
WJ> actually, IO a is a type which is not implementable in ordinary Haskell and
WJ> therefore cannot be a function. In addition, RealWorld -> (RealWorld,a) as
WJ> an explanation of what IO a is has its limitations. If we run an I/O action,
WJ> we aren't just interested in the final state but also in intermediate states.
{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
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.
--
Best regards,
Bulat mailto:bulatz at HotPOP.com
More information about the Haskell-Cafe
mailing list