Add a createT analogue for arrays
David Feuer
david.feuer at gmail.com
Sun Mar 11 06:29:25 UTC 2018
The vector package offers
createT :: Traversable t
=> (forall s. ST s (t (MVector s a)))
-> t (Vector a)
This is a generalization of create, which is very similar to runSTArray in
the array package. I suggest we add functions
runSTArrays :: Traversable t
=> (forall s. ST s (t (STArray s i e)))
-> t (Array i e)
runSTUArrays :: Traversable t
=> (forall s. ST s (t (STUArray s i e)))
-> t (UArray i e)
Why do I think it's worth the trouble? While it's occasionally useful to
create multiple arrays of the same type in one go, I think the Maybe and
(a,) Traversable instances, and their compositions, are likely more
important. I can use (a,) to record some extra information while building
an array. I can use Maybe to give up and not produce an array. And the
compositions let me do both in different ways.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20180311/c46c5fb1/attachment-0001.html>
More information about the Libraries
mailing list