-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Elem" type synonym #102
Comments
I discovered a neat workaround for this problem (put the Elem definition in its own signature) so this is less pressing. |
I could be convinced. I'd like to see the whole signature ideally. Would that also live in the bytestring package? |
@ezyang what about |
The signature couldn't live in the bytestring package (though it could live in the repo) because you'd want to be able to depend on it directly, but you can only have one public library per package ;) Here's an excerpt of the signature I have (I may decide to rename
The |
#219 added an IsList instance to |
I would love to have an enthusiastic user of Backpack to push this forward. I do not use Backpack myself, and I do not want to add such things speculatively, without knowing that this is really helpful for users. |
Admittedly, I haven't used backpacks seriously other than bytes-builder-shootout. I can imagine that, if |
I'm not referencing to a slow adoption of Backpack here. The thing is that I have very little idea how Backpack works (today). Is this change required for backpackisation? Is it enough? Could someone demonstrate backpack signatures, built against forked |
It's not required for Backpack-ization, but without it, I have to make a "bytestring-backpack" package that provides the bytestring module reexported PLUS the extra Elem type synonym. It just makes everything marginally more difficult to use. |
@ezyang thanks, understood. Could you possibly draft a backpack signature, assuming that there is |
@ezyang could you possibly suggest other improvements to I wonder what is better: just add a type synonym |
It's not necessary to replace the signatures with Elem; Backpack can match even in the presence of type synonyms. https://github.com/haskell-backpack/backpack-str/blob/master/str-bytestring/Str/ByteString.hs shows the full set of "extra goop" I added to make the signatures line up. I'm not sure I'd recommend putting all of them in base, but it should give you some sense for what I found I needed to smooth over. |
I'd like to write some Backpack signatures which help smooth over the difference between Char8 and Word8 ByteStrings; however, in order to write the signature, I need to declare a new type "data Elem" to parametrize over the element type of the ByteString:
In order for a module to implement this signature, it needs to export Elem. So this is very disappointing, which is the literal Data.ByteString from bytestring doesn't implement this signature.
Could we make it implement it? Yes, very easily: just add a type synonym
type Elem = Char/Word8
to each of the ByteString modules. Done. Can we? (It's an easy patch but I have to convince you guys to take it.)The text was updated successfully, but these errors were encountered: