[Haskell-cafe] What's the deal with Clean?
Edsko de Vries
edskodevries at gmail.com
Wed Nov 4 10:11:58 EST 2009
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'
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
More information about the Haskell-Cafe
mailing list