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,844
    • Issues 4,844
    • 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
  • #10346

Closed
Open
Created Apr 23, 2015 by Simon Peyton Jones@simonpjDeveloper

Cross-module SpecConstr

Type-class specialisation now happens flawlessly across modules. That is, if I define

module DefineF where
   f :: Num a => a -> a
   {-# INLINEABLE f #-}
   f x = ...f x'....

then modules that import DefineF and call f at some particular type (say Int) will generate a specialised copy of f's code.

But this does not happen for SpecConstr; we only specialise a function for calls made in the same module. For example:

module M where
  {-# INLINABLE foo #-}
  foo True  y     = y
  foo False (a,b) = foo True (a+b,b)

module X where
  import M
  bar = ...(foo (x,y))...

Here foo is called with an explicit (x,y) argument in module X, and we'd like to !SpecConstr it, as it would be if the call was in module M.

All the infrastructure is in place to allow cross-module SpecConstr; it just hasn't been done yet. This ticket is to record the idea.

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