Skip to content

make Data.DList trustworthy#31

Closed
int-e wants to merge 1 commit into
spl:masterfrom
int-e:trust
Closed

make Data.DList trustworthy#31
int-e wants to merge 1 commit into
spl:masterfrom
int-e:trust

Conversation

@int-e

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

Copy link
Copy Markdown

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

int-e commented Jul 29, 2017

Copy link
Copy Markdown
Author

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

spl commented Jan 19, 2018

Copy link
Copy Markdown
Owner

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