Skip to content
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 instance Consumable/Dupable/Movable for ByteString and Text #412

Open
Bodigrim opened this issue Apr 13, 2022 · 1 comment
Open

Add instance Consumable/Dupable/Movable for ByteString and Text #412

Bodigrim opened this issue Apr 13, 2022 · 1 comment

Comments

@Bodigrim
Copy link

linear-base already depends on bytestring (via hashable) and text. It would be awesome to provide Consumable, Dupable and Movable instances for ByteString and Text, because they cannot be defined in respective packages. I could have used them in https://github.com/Bodigrim/linear-builder/

@aspiwack
Copy link
Member

I'm a bit swamped right now, but I just had a look. I think both can work indeed: their data is entirely unpacked, and doesn't contain thunks. There is just a thunk at toplevel, so we can use something like

Unsafe.toLinear $ \s -> s `seq` Ur s

as the implementation of move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants