Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,390
    • Issues 4,390
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 375
    • Merge Requests 375
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15391

Closed
Open
Opened Jul 16, 2018 by Edward Z. Yang@ezyangDeveloper

Maybe ghc-pkg register should unregister packages with "incompatible" signatures

Consider the following situation:

  1. I register package 'p-0.1-inplace' instantiated with 'P = base:Data.Map'
  2. I register package 'p-0.1-inplace' instantiated with 'P = base:Control.Monad'

Even though the IPID of these two packages is the same, we clearly want to keep both of them in the database. This thus motivates the following lines in ghc-pkg

     removes = [ RemovePackage p
               | not multi_instance,
                 p <- packages db_to_operate_on,
                 mungedId p == mungedId pkg,
                 -- Only remove things that were instantiated the same way!
                 instantiatedWith p == instantiatedWith pkg ]

OK... now consider the following situation

  1. I register package 'p-0.1-inplace' instantiated with 'P = base:Data.Map'
  2. I register package 'p-0.1-inplace', instantiated with nothing (I have edited 'p' such that it has no more signatures)

So... ghc-pkg is going to keep both of these packages (per the logic above). But is that really what we want? Now the package database is in a half-consistent state, where the instances of 'p-0.1-inplace' are not consistent with the number of holes they are supposed to have. So let us suggest an invariant:

INVARIANT: All packages which have the same IPID in a package database are self-consistent with each other.

OK, so given this invariant, what do we have to do in step 2? It would seem that when we get a prospective package to register, we must *find all packages which are incompatible with it*, and remove them from the package database. So, given a package with a set of holes H, we must remove all packages with holes H' such that H = H'

I'm not completely convinced this is a good idea. Usually ghc-pkg only removes a single package in response to a new registration, and this behavior could result in lots of packages getting unregistered, more than you might expect. On the other hand, if you think of the package database in a more hierarchical manner, it makes sense that changing the root registration would invalidate all the children.

Trac metadata
Trac field Value
Version 8.4.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component ghc-pkg
Test case
Differential revisions
BlockedBy
Related
Blocking
CC int-index
Operating system
Architecture
Assignee
Assign to
9.2.1
Milestone
9.2.1
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#15391