Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • 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 4,843
    • Issues 4,843
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14770

Closed
Open
Created Feb 06, 2018 by TheKing01@trac-TheKing01

Allow static pointer expressions to have static pointer free variables

Static pointer expressions can not have free variables. For example:

addPointers :: StaticPtr Int -> StaticPtr Int -> StaticPtr Int
addPointers x y = static (deRefStaticPtr x + deRefStaticPtr y)

would be invalid, since x and y are free variables. My proposal would be to make this code sample valid. In particular, my proposal is to allow free variables in static expressions if the free variables of the type StaticPtr a for some type a.

Let's say that m n are Static pointers to integers. The serialized form would of addPointers m n would be:

A pointer to the code deRefStaticPtr x + deRefStaticPtr y

The serialized form of m, associated with x.

The serialized form of n, associated with y.

When this is sent over the wire and dereferenced, the other machine would

Find m and n's pointers

Find the code deRefStaticPtr x + deRefStaticPtr y

Evaluate deRefStaticPtr x + deRefStaticPtr y, substituting m's value for x, and n's value for y.

The reason this feature would be useful is would let the user modify and combine static pointers.

You might ask "why not let the user create a GADT to do that (like in https://hackage.haskell.org/package/distributed-static-0.3.8/docs/Control-Distributed-Static.html\#t:Static)?" The reason is that then it won't fuse (with recreating every fusion rule for that GADT). For example, if m is static 7 and n is static 3, then addPointers m n can fuse to static 11.

This is more important then it seems. For example, say you have composePointers :: StaticPtr (a -> b) -> StaticPtr (b -> c) -> StaticPtr (a -> c), and you compose a bunch of pointers. With the GADTS, every composePointers would be its own node, but with GHC support, it would probably fuse.

In general, dealing with a GADT requires a lot of "glue code" that can be eliminated with GHC support. I'm not sure if this proposal makes a performance difference (it probably makes it more efficient), but it would make code more elegant, cutting out all the glue code.

Trac metadata
Trac field Value
Version 8.2.2
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking