[Haskell-cafe] Re: Mutable but boxed arrays?

2007-09-06 Thread Simon Marlow

Ketil Malde wrote:

On Wed, 2007-09-05 at 20:37 +0200, Henning Thielemann wrote:
Can someone explain me, why there are arrays with mutable but boxed 
elements?


I, on the other hand, have always wondered why the strict arrays are
called unboxed, rather than, well, strict?  Strictness seems to be
their observable property, while unboxing is just an (admittedly
important) implementation optimization.  I imagine that it'd be at least
as easy to implement the strictness as the unboxedness for non-GHC
compilers, and thus increase compatibility.


You're quite right, that was a mistake, we should have called them strict 
arrays.  Hugs implements the unboxed arrays without any kind of unboxing, I 
believe.


Cheers,
Simon
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Mutable but boxed arrays?

2007-09-06 Thread Josef Svenningsson
On 9/6/07, Simon Marlow [EMAIL PROTECTED] wrote:
 Ketil Malde wrote:
  I, on the other hand, have always wondered why the strict arrays are
  called unboxed, rather than, well, strict?  Strictness seems to be
  their observable property, while unboxing is just an (admittedly
  important) implementation optimization.  I imagine that it'd be at least
  as easy to implement the strictness as the unboxedness for non-GHC
  compilers, and thus increase compatibility.

 You're quite right, that was a mistake, we should have called them strict
 arrays.  Hugs implements the unboxed arrays without any kind of unboxing, I
 believe.

Any chance of a Data.Array.Strict and deprecating Data.Array.Unboxed?

Cheers,

/Josef
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Mutable but boxed arrays?

2007-09-06 Thread apfelmus

Henning Thielemann wrote:

I'll see, if I understand it.

  do writeArray arr 0 2
 x - readArray arr 0
 writeArray arr 0 (x+x)

If 'arr' is an STArray, the 'arr' will contain the unevaluated 
expression 2+2 as zeroth element and with type STUArray it will 
contain the evaluated 4 ?


Exactly. Put differently,

  writeArray :: STUArray - ..

is strict in the third argument whereas

  writeArray :: STArray  - ..

is not.

Regards,
apfelmus

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe