Re: [stack] What does "concatenative" actually mean?
Rodney D Price <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <OF3F7370A5.52012048-ON8725756E.00668145-8725756E.006874B4@mck.us.ray.com> |
Haskell *does* need a monad to do I/O. The essential difference between "read" having a stack shape of F -> F O, and Haskell's IO monad, is that the Haskell IO monad is guaranteed to confine any side effects to the IO monad; that is, the result of an IO operation will always have a type of the form IO <something>. And there's no way any result depending on an I/O operation can avoid having type IO <something>. There's no escape from the IO monad in Haskell. Lacking a static type system, Joy offers no such guarantee. Cat, OTOH, has a Hindley-Milner static type system. Perhaps Cat could do monads. -Rod William Tanksley scripsit: > The truly pure functional languages, like Haskell, have a mathematical > model for state-changing effects, like objects and I/O. The problem is > that purely functional languages don't express what order their > operations will occur in; they just tell the computer what operations to > do, and let the compiler figure out the best order. So Haskell provides > a mathematical construct called a "monad". Monads can mathematically > only be evaluated in order, so the compiler receives enough information > to know what order to execute your code in. You don't really need monads: they are just a convenience, because it would be painful to thread state through every function in your program just in case a callee wants to use some of it; see http://lambda-the-ultimate.org/node/1155#comment-12726 for details. In Joy, the equivalent of the I/O monad is the simple fact that "read" has a stack shape of F -> F O, preserving the F object on the stack. -- One Word to write them all, John Cowan <[email protected]> One Access to find them, http://www.ccil.org/~cowan One Excel to count them all, And thus to Windows bind them. --Mike Champion [Non-text portions of this message have been removed]