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

make Data.DList trustworthy #31

Closed
wants to merge 1 commit into from
Closed

make Data.DList trustworthy #31

wants to merge 1 commit into from

Conversation

int-e
Copy link

@int-e int-e commented Jun 11, 2017

Safety of Data.DList is not inferred because of the use of GHC.Exts,
but the IsList class is safe to use, so the module can be trusted.

Safety of Data.DList is not inferred because of the use of GHC.Exts,
but the IsList class is safe to use, so the module can be trusted.
@int-e
Copy link
Author

int-e commented Jul 29, 2017

I guess I have not explained why this is useful. Safe Haskell provides a mechanism for delivering on the promise that pure functions don't have side effects nor break the type system, by marking functions like unsafePerformIO or unsafeCoerce that break this promise as unsafe, and disallowing the use of unsafe functions in Safe code. This is useful for sandboxes like lambdabot's Haskell evaluation.

Unfortunately, this is done on a module level, so the GHC.Exts module is unsafe (for example, it exports unsafeCoerce#) is unsafe. The way it's used in Data.DList is perfectly safe though. Safe Haskell allows marking modules that are safe despite importing unsafe modules as TrustWorthy. If the package is trusted, then trustworthy modules can be used by Safe code.

So this patch serves a niche purpose but it also should not incur any maintenance effort, whereas currently anyone running a lambdabot instance who wants to provide access to dlist has to patch the dlist package.

@spl spl closed this in 0478d9a Jan 19, 2018
@spl
Copy link
Owner

spl commented Jan 19, 2018

Apologies for the delayed response. This will be released in v0.8.0.4.

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.

2 participants