Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,248
    • Issues 5,248
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 573
    • Merge requests 573
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16457
Closed
Open
Issue created Mar 18, 2019 by Matthew Pickering@mpickeringDeveloper

`Bytes` and `mkBytes` needs to be reconsidered

Ryan alerted me to the dubious nature of Bytes and BytesPrimL in TemplateHaskell.

Bytes contains a ForeignPtr. If someone makes this ForeignPtr in another package then when the user tries to run the splice in their program, surely they will dereference this pointer and it will point to nothing?

The intention behind the API is that the ForeignPtr is created in the same splice (on the host) as the Bytes value but this is not enforced in anyway.

To do this, probably a new effect should be added to Q rather than this stuff with directly manipulating a ForeignPtr.

It also has to be considered how to make Bytes work with Lift. The current instance is wrong for the same reason.

https://github.com/mgsloan/th-orphans/blob/709ed88ffd21e9d1ca97b36fcf0c992acbfe871a/src/Language/Haskell/TH/Instances.hs#L532-L541

Edited Mar 19, 2019 by Matthew Pickering
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking