Closed chessai closed 5 years ago
Unfortunately, the optimal implementation of these is different depending on the type of array. There’s no way to create an Array without initializing all the elements, but there is a way to create a PrimArray without doing so. Currently, I’m actually doing the wrong thing for UnliftedArray. That is, the current implementation is suboptimal. In the next major version bump of this library, I would like to quit exposing the typeclass entirely, So the distinction of what’s the type class method and what’s not will vanish ( from a user facing perspective anyway)
why do you want to un-expose the typeclass? do you not foresee users creating their own instances? i guess it's not very likely since most useful array types are built on top of GHC built-tins.
Other than the instance for SmallArray that’s currently missing, what other instance could possibly be written?
yeah, i don't really see any. so i agree now. i'd like version 0.4 to include haddock cleanups/other stuff included in the other issues i've opened today. they shouldn't be hard to implement, just tedious.
i'm not really sure why they are in the typeclass instead of implemented as top-level functions. can you really do better than just allocating a {1,2,3}-element array, writing to it, then freezing it?
furthermore,
doubleton
andtripleton
are unusual from an API standpoint. by "unusual" i mean they are not likely to be found in any given data-structure-focused API. i don't think we should necessarily remove them, but i certainly don't think they should be in the typeclass.