Skip to content

Conversation

@treeowl
Copy link
Contributor

@treeowl treeowl commented Oct 20, 2020

  • Use a newtype to hide the unrestricted ByteArray
    underneath.

  • Mark Data.Primitive.Unlifted.Class as Trustworthy. TODO:
    Discuss whether it's okay to do that without similarly changing
    the PrimArray instance.

Closes #22

@treeowl
Copy link
Contributor Author

treeowl commented Oct 20, 2020

The remaining question is PrimArray. There are two approaches:

  1. Consider PrimArray an inherently unsafe thing we just shouldn't worry about.
  2. Imagine that someone could write a Trustworthy module exporting PrimArray, hiding all the unsafe things, and defining safe indexing functions. If we take that approach, then we need to use a similar trick to ShortText, or refrain from making the .Class module Trustworthy. I really want to make the .Class module Trustworthy, because that seems like the Right Thing.

* Use a newtype to hide the unrestricted `ByteArray`
  underneath.

* Mark `Data.Primitive.Unlifted.Class` as `Trustworthy`. TODO:
  Discuss whether it's okay to do that without similarly changing
  the `PrimArray` instance.

Closes haskell-primitive#22
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

Successfully merging this pull request may close these issues.

The PrimUnlifted ShortText instance is unsafe

1 participant