Opened 3 years ago

Last modified 18 months ago

#9724 new feature request

reexport IsList class from a trustworthy module

Reported by: int-e Owned by:
Priority: normal Milestone:
Component: Core Libraries Version: 7.8.3
Keywords: SafeHaskell Cc: core-libraries-committee@…, eir@…, oerjan, dterei, ekmett
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:



GHC's Safe Haskell extension relies to a large extent on inferring safety of modules automatically. As a concrete example, data-default used to be inferred safe.

This is no longer the case, because dlist-0.7.1 added an IsList instance for difference lists. The only way to do that currently is to import the relevant parts of GHC.Exts, and that module is not safe.

Of course the resulting non-safety of the Data.DList module can be fixed by adding a TrustWorthy pragma to the module and trusting the dlist package. But that is unsatisfactory, because there is nothing unsafe about providing an instance for the IsList class. This issue is bound to pop up in other packages as well.

Proposed Solution

(this is one of many possibilities)

Add a GHC.Exts.Safe module that is marked TrustWorthy and reexports the IsList class, and possibly other things from GHC.Exts that are safe to use.

Change History (4)

comment:1 Changed 3 years ago by goldfire

Cc: eir@… added

I agree that this deserves some attention. I always feel dirty importing GHC.Exts, and the non-dirty things from there should have other places to be pulled from. I'm specifically thinking of Constraint, but I'm sure there are things other than just IsList and Constraint that should find new homes.

comment:2 Changed 2 years ago by oerjan

Cc: oerjan added

comment:3 Changed 22 months ago by thomie

Owner: ekmett deleted

comment:4 Changed 18 months ago by thomie

Cc: dterei ekmett added
Keywords: SafeHaskell added
Note: See TracTickets for help on using tickets.