vector icon indicating copy to clipboard operation
vector copied to clipboard

Add uniquely named type aliases for each Vector type to `Data.Vector.Generic`

Open merijn opened this issue 5 years ago • 7 comments

This would let people more easily write code dealing with multiple Vector types without needing to do a qualified import from a different module for each type, just to get the type in scope. Some of my code has 7 lines of Vector imports just to bring different types into scope. Having unique alias for each in Data.Vector.Generic would solve that issue

merijn avatar Apr 05 '19 12:04 merijn

I agree that this would be useful. Anyone else's opinions on whether or not they would think this is useful?

Bikeshedding: What is your opinion on the names? What are others' opinions on the names?

Once we've sorted that out, I think a PR would be great.

chessai avatar May 11 '19 19:05 chessai

I’ll hash this out with merijn sometime later this summer. It’s not a public mural ;)

On Sat, May 11, 2019 at 3:05 PM chessai [email protected] wrote:

I agree that this would be useful. Anyone else's opinions on whether or not they would think this is useful?

Bikeshedding: What is your opinion on the names? What are others' opinions on the names?

Once we've sorted that out, I think a PR would be great.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/haskell/vector/issues/240#issuecomment-491536345, or mute the thread https://github.com/notifications/unsubscribe-auth/AAABBQQO3S74ZM7Q2RF5ORLPU4KIZANCNFSM4HD3L4DQ .

cartazio avatar May 12 '19 01:05 cartazio

to be clear, i'd rather avoid large bikesheddings,

cartazio avatar May 12 '19 02:05 cartazio

and do the person who posted to this ticket and deleted their comment: i'm the maintainer :P

cartazio avatar May 12 '19 02:05 cartazio

strawman:

BoxedIVec/BoxedMVec -- Data.Vector/Data.Vector.Mutable UnboxedIVec / UnboxedMVec -- Data.Vector.Unboxed CStructIVec / CStructMVec -- Data.Vector Storable

the last one is because the Vector use of storable is really about Pinned arrays (on or off heap) via foreign pointers to interact with Arrays of C compatible struct style data (we could call it )

an alternative for unboxed could be SOAIVec and SOAMVec, but that just seems terrible, even though Struct of Array IS a correct term of them.

theres some realted issues of the current punning between the Vector type class and Vector types,which wasn't the case in vector major versions 0.1 and 0.2, but came into play later

cartazio avatar May 12 '19 02:05 cartazio

I'd err on the side of being explicit and recycling existing naming.

What about just using e.g

    StorableVector / MStorableVector
    BoxedVector / MBoxedVector
    PrimitiveVector / MPrimitiveVector

They are more verbose, yes. But that way there isn't any name mangling.

The only thing that has to have a "made up" name is BoxedVector as Boxed doesn't show up anywhere else.

ekmett avatar Jun 06 '19 01:06 ekmett

Sounds viable to me.

On Wed, Jun 5, 2019 at 9:31 PM Edward Kmett [email protected] wrote:

I'd err on the side of being explicit and recycling existing naming.

What about just using e.g

StorableVector / MStorableVector
BoxedVector / MBoxedVector
PrimitiveVector / MPrimitiveVector

They are more verbose, yes. But that way there isn't any name mangling.

The only thing that has to have a "made up" name is BoxedVector as Boxed doesn't show up anywhere else.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/haskell/vector/issues/240?email_source=notifications&email_token=AAABBQU2HLZTB7VZA7U5G63PZBSG3A5CNFSM4HD3L4D2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXBPBXQ#issuecomment-499314910, or mute the thread https://github.com/notifications/unsubscribe-auth/AAABBQWY7TMKHLB4HIF6CDDPZBSG3ANCNFSM4HD3L4DQ .

cartazio avatar Jun 06 '19 13:06 cartazio