Open rightfold opened 5 years ago
Actually, yes, I think it is better to just bake this into ByteString. Otherwise the API has to be duplicated which is annoying.
That would make it AJI-incompatible with the existing version, since coercing to Buffer no longer works. But I think that's worth it; people should use unsafeFreeze and unsafeThaw, really.
To facilitate efficient programming, there should be the following module. This should reduce the amount of copying of data. Like the Data.ByteString module, it should export many useful functions, and document their time complexities (which should never be worse here than there, I think).
The Haskell bytestring package also does this (although it's built into ByteString there, maybe we should also do that in this package). See also: D, Go, Rust, Swift.