Array copy primops

Johan Tibell johan.tibell at gmail.com
Tue Feb 1 16:15:05 CET 2011


Hi,

Something struck me today. Look at the type signature for cloneArray#

    cloneArray# :: Array#   a -> Int# -> Int# -> State# s -> (# State#
s, Array# a #)

Does cloneArray# really have to take and return a `State# s`? It seems
perfectly fine to float this expression around. It needs to be marked
as expensive to not duplicate it but otherwise I don't see why not.

Does the same apply to any of the other primops? Should some of them
have their state tokens stripped?

It would be nice if we could resolve this before submitting the
patches [1] (which are otherwise ready).

Johan

1. http://hackage.haskell.org/trac/ghc/ticket/4928#comment:5



More information about the Cvs-ghc mailing list