-
Notifications
You must be signed in to change notification settings - Fork 12
Add explicit Safe Haskell annotations #6
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
base: master
Are you sure you want to change the base?
Conversation
Add explicit Safe/Trustworthy annotations to every module. Move the writeByteString function from Blaze.ByteString.Builder.ByteString to Blaze.ByteString.Builder.Internal.Write because it uses rather unsafe functions compared to the rest of the module and fits better in the unsafe context of the latter module. This makes it possible to mark the former module Safe. There is no impact on the public API (if you consider the Internal modules private).
|
Looks promising, though we do need to use CPP to support some older versions of GHC. (See the travis build...) I'm a little unsettled by the |
|
The difference between The reason I moved Perhaps the rationale is best declared with the practical ramifications: If I didn't move I hope this explains the rationale a bit better 😄 Regarding guarding the pragmas with CPP: It seems that the failure is due to GHC 7.0 not supporting Safe Haskell. However, GHC 7.0 is a bit old these days - would you consider dropping support for GHC 7.0, or is that too bold? |
|
Forgive my lack of understanding of safe haskell, but my point is, If it isn't any such mechanism, then this feels like safety-laundering, which admittedly is something more of a problem with safe haskell (i.e. it being unsound) than with bytestring-builder. With regard to GHC 7.0, if it were another package, maybe, but since this is a compatibility package, I'm inclined to keep GHC 7.0 support going for the time being. |
|
I'm definitely not an expert on Safe Haskell internals, but my understanding is that a reexport doesn't make a declaration part of another module, so On a different note, I'm not yet sure whether the I will add the required CPP magic for GHC 7.0. |
|
I'd have to review but I kinda doubt that And perhaps I need to dig into safe haskell a bit, but it seems to me, if you aren't going to trust |
Blaze.ByteString.Builer.Internal.Write should be marked Unsafe since it makes it easy to shoot yourself in the foot.
Add CPP logic guarding the SafeHaskel statements. Only expose Safe or Trustworthy pragmas for GHC >= 7.2. Only expose Unsafe pragmas for GHC >= 7.4.
Add changelog for 0.4.1.0 and bump version in the cabal file.
|
I marked Internal.Write unsafe, added the required CPP logic (let's see if GHC 7.0/7.2 on Travis likes it) and boldly added a changelog entry and bumped the version to 0.4.1.0. |
Add CPP logic left out in an earlier commit.
|
Maintenance moved to https://github.com/blaze-builder/blaze-builder |
Add explicit Safe/Trustworthy annotations to every module.
Move the writeByteString function from
Blaze.ByteString.Builder.ByteStringto
Blaze.ByteString.Builder.Internal.Writebecause it uses rather unsafefunctions compared to the rest of the module and fits better in the
unsafe context of the latter module. This makes it possible to mark the former
module Safe. There is no impact on the public API (if you consider the Internal
modules private).