Skip to content

Mark Data.Text.Internal as Safe Haskell #539

Open

Description

@phadej

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.

Activity

  1. changed the title [-]Mark Data.Text.Internal as Safe Haskell.[/-] [+]Mark Data.Text.Internal as Safe Haskell[/+] on Oct 19, 2023
  2. Bodigrim commented on Oct 19, 2023

    @Bodigrim
    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?)

  3. phadej commented on Oct 20, 2023

    @phadej
    ContributorAuthor

    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

  4. phadej commented on Nov 28, 2023

    @phadej
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions