Re:What's wrong with Object-Oriented Programming and Functio...
by hisham_hm on Tuesday November 12, 2013 @08:58AM
(#6717813)
> You could have a strict Haskell-like language that manages effects in the same way, indeed such languages exist.
I'm unaware of any strict purely functional language with monads. Could you give an example? Thanks!
Re:What's wrong with Object-Oriented Programming and Functio...
by DanWaterworth on Tuesday November 12, 2013 @09:00AM
(#6717824)
Idris is one example.
Re:What's wrong with Object-Oriented Programming and Functio...
by freyrs3 on Tuesday November 12, 2013 @02:19PM
(#6720184)
Disciple[1], and I believe "Mu" Haskell ( the Standard Chartered dialect ) though I don't know for sure because it's not open source.
Re:What's wrong with Object-Oriented Programming and Functio...
by pron on Tuesday November 12, 2013 @08:34AM
(#6717673)
Isn't the side effect returned as an IO type which is later evaluated by the runtime? (I'm talking about Haskell)
Re:What's wrong with Object-Oriented Programming and Functio...
by DanWaterworth on Tuesday November 12, 2013 @09:01AM
(#6717832)
Yes, but you can create the thing of type `IO a` strictly.
Re:What's wrong with Object-Oriented Programming and Functio...
by pron on Tuesday November 12, 2013 @09:03AM
(#6717843)
Yes, but when are they executed? When is the byte written to the file?
Re:What's wrong with Object-Oriented Programming and Functio...
by DanWaterworth on Tuesday November 12, 2013 @09:21AM
(#6717926)
Well, you certainly can't start executing until the `IO a` thing has been evaluated, but there aren't any other constraints.
Something that can confuse people (and I'm not sure if this is the case with you or not) is that an `IO a` may/probably will contain a closure. So evaluation and execution are interleaved, but not because of laziness.
Re:What's wrong with Object-Oriented Programming and Functio...
by dllthomas on Wednesday November 13, 2013 @12:03PM
(#6726530)
Closures can be a way of implementing laziness, so I'm not sure you've shown it's "not because of laziness" - though certainly it's not because the language is lazy by default.
Re:What's wrong with Object-Oriented Programming and Functio...
by quchen on Tuesday November 12, 2013 @09:41AM
(#6718054)
You can picture functions with the IO type as something to compose a program out of. This program is then run by runtime system of your implementation, and that's "when the byte is written".
Here's a nice explanation of Haskell IO: http://stackoverflow.com/questions/13536761/what-other-ways-...
This is actually not true. Lazy evaluation forced Haskell to stay pure, but it is purity that provides the tools for constraining effects. You could have a strict Haskell-like language that manages effects in the same way, indeed such languages exist.