> Any thumb rule for using arrays? I'm expecting access to be 
> O(1), it is right?

In GHC, yes.

> Need to have a set of data, and I just want to get random 
> elements from that 
> Set, arrays seem like a good solution... am I right?

If you're building it once and doing lots of access, then Haskell arrays
are a good choice.

> DiffArrays... aren't they supposed to be just like Arrays 
> expect for the (//) 
> behaviour (and accum and accumArray....), If so, why is there no Show 
> instance for them? Or Functor instance?

We added the Show instances post-5.02.2, but they are still missing
Functor and Read instances.  Thanks for pointing this out; I'll take a
look before the next release.

> Unboxed types... Ghci
> > f n  =  3# 
> loads ok and,
> Test> :t f
> forall t. t -> PrelGHC.Int#
> 
> nice... now this:
> > f :: Int -> Int#
> > f n  =  3# 
> when trying to load I get:
> 
> Test.hs:3: Type constructor or class not in scope: `Int#'
> Failed, modules loaded: none.
> What  am I missing here? Tried Int#, PrelGHC.Int... nothing worked...
> and Ghci also didn't know about (+#) either... 

The type constructor Int# isn't in scope (there's a clue in the error
message: GHC used PrelGHC.Int# rather than the unqualified form, because
it isn't in scope).  Int# and the other unboxed primitives types and
operations can be imported from module GlaExts in package lang
(recommended) or PrelGHC (fragile).

HTH, HAND,
        Simon

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to