I'm not sure I follow you? The compiler can't reorder the two updates
or do them in parallel (IO is not a commutative monad). You might tell
the compiler this explicitly, but then are you writing lower and lower
level code, further removed from the functional paradigm.
Edsko
On 4 Nov 2009, at 15:27, David Leimbach wrote:
On Wed, Nov 4, 2009 at 7:11 AM, Edsko de Vries
<edskodevr...@gmail.com> wrote:
On 4 Nov 2009, at 13:36, Alberto G. Corona wrote:
Artyom.
I know what uniqueness means. What I meant is that the context in
which uniqueness is used, for imperative sequences:
(y, s')= proc1 s x
(z, s'')= proc2 s' y
.....
is essentially the same sequence as if we rewrite an state monad to
make the state explicit. When the state is the "world" state, then
it is similar to the IO monad.
Yes, as long as there is a single thing that is being updated
there's little difference between the state monad and a unique type.
But uniqueness typing is more general. For instance, a function
which updates two arrays
f (arr1, arr2) = (update arr1 0 'x', update arr2 0 'y')
is easily written in functional style in Clean, whereas in Haskell
we need to sequentialize the two updates:
f (arr1, arr2)
= do writeArray arr1 0 'x'
writeArray arr2 0 'y'
Those sequential updates can be run concurrently on both, just with
different syntax though right?
You can find a more detailed comparison in my thesis (https://www.cs.tcd.ie/Edsko.de.Vries/pub/MakingUniquenessTypingLessUnique-screen.pdf
, Section 2.8.7).
-Edsko
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe