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

Mark Data.Text.Internal as Safe Haskell #539

Open
phadej opened this issue Oct 19, 2023 · 3 comments
Open

Mark Data.Text.Internal as Safe Haskell #539

phadej opened this issue Oct 19, 2023 · 3 comments

Comments

@phadej
Copy link
Contributor

phadej commented Oct 19, 2023

E.g. Simon Marlow said to me

I think you might have a different interpretation of "Module encapsulation" than the intended one. Safe Haskell only promises that the semantics of abstraction are respected, it doesn't promise that you can't see the representation of a datatype by importing it from some other module.

So I don't see a reason for Data.Text.Internal to not be marked as Trustworthy module. E.g. containers Data.Set.Internal is trustworthy. And I'd expect that libraries bundles with GHC do the Safe Haskell stuff the same (and right) way if they have any Safe Haskell annotations at all.

@phadej phadej changed the title Mark Data.Text.Internal as Safe Haskell. Mark Data.Text.Internal as Safe Haskell Oct 19, 2023
@Bodigrim
Copy link
Contributor

Sorry, in my view Safe Haskell has negative utility, and I'm not looking forward to increase future maintenance burden by marking Data.Text.Internal as "safe", even if according to some definition at the moment it is.

(Is there was a way to opt out of Safe-Inferred without explicitly marking as Unsafe?)

@phadej
Copy link
Contributor Author

phadej commented Oct 20, 2023

Is there was a way to opt out of Safe-Inferred without explicitly marking as Unsafe?

Fix haddock to say None (i.e. inferred unsafe), as it did in https://hackage.haskell.org/package/text-1.2.3.0/docs/Data-Text-Internal.html. https://gitlab.haskell.org/ghc/ghc/-/issues/19604

@phadej
Copy link
Contributor Author

phadej commented Nov 28, 2023

To clarify, the haddock showin Safe-inferred is a bug, and gives completely wrong impression:

Prelude> :set -XSafe
Prelude> import Data.Text.Internal

<no location info>: error: [GHC-44360]
    Data.Text.Internal: Can't be safely imported!
    The module itself isn't safe.

The Data.Tet.Internal cannot be safely imported, it's unsafe. And IMHO it would be better to explicitly mark it as Unsafe for time being, until haddock bug is fixed (or Safe Haskell is removed from GHC, whichever happens first).

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