Add genArray
4 unresolved threads
4 unresolved threads
a quite useful function that I was missing when working with
Data.Array
recently.
Merge request reports
Activity
CLC’s opinion queried at https://github.com/haskell/core-libraries-committee/issues/96
added 4 commits
-
c9022bbe...8517a07b - 3 commits from branch
master
- 779dec7c - Merge branch 'master' into 'wip/joachim/genArray'
-
c9022bbe...8517a07b - 3 commits from branch
29 29 array, -- :: (Ix a) => (a,a) -> [(a,b)] -> Array a b 30 30 listArray, -- :: (Ix a) => (a,a) -> [b] -> Array a b 31 31 accumArray, -- :: (Ix a) => (b -> c -> b) -> b -> (a,a) -> [(a,c)] -> Array a b 32 genArray, -- :: (Ix a) => (a,a) -> (a -> b) -> Array a b changed this line in version 5 of the diff
193 193 listArray (l,u) es = 194 194 let n = safeRangeSize (l,u) 195 195 in unsafeArray (l,u) (zip [0 .. n - 1] es) 196 -- changed this line in version 5 of the diff
193 193 listArray (l,u) es = 194 194 let n = safeRangeSize (l,u) 195 195 in unsafeArray (l,u) (zip [0 .. n - 1] es) 196 -- 197 -- | Constructs an immutable array using a generator function. 198 genArray :: (IArray a e, Ix i) => (i,i) -> (i -> e) -> a i e 199 genArray (l,u) f = listArray (l,u) $ map f $ range (l,u) Fair enough. Perhaps it was originally imagined that this module be imported unqualified, before we had Data.Vector, Data.Map, Data.Set etc. exporting clashing names. If you import it qualified, then e.g.
Array.genArray
becomes a bit redundant.I also don't have a strong opinion on this. I just wish to see the function added to the API.
added 8 commits
-
779dec7c...0b6a11a5 - 5 commits from branch
master
- 8c9d5bd7 - Remove nonexistent export
- 8f916ce4 - Mark as inline
- 751c8fcc - Merge branch 'master' into wip/joachim/genArray
Toggle commit list-
779dec7c...0b6a11a5 - 5 commits from branch
What is the "export issue" that is preventing it from being merged?
GHC.Arr
doesn't havegenArray
, see commit !13 (8c9d5bd7)
Please register or sign in to reply