Skip to content

De-duplicating buildInplaceUnpackedPackage and buildAndInstallUnpackedPackage  #9499

Closed

Description

@alt-romes

It seems that there are a lot of things in common between buildInplaceUnpackedPackage and buildAndInstallUnpackedPackage, however, there is also a lot of duplication between the two.

In my opinion, it would be better to factor the common bits (not changing any behaviour... best effort) and have a single function for both (similar) use cases. The subtle bugs due to the duplication and not doing things uniformly for the two situations seems much worse than possibly incurring a regression in the behaviour change, especially going forward.

Activity

  1. andreabedini commented on Dec 7, 2023

    @andreabedini
    Collaborator

    Yes, absolutely, but let's make sure we factor out common functionality (as you say) rather than jumble them toghether. I see many cases where "different things" are forced through a same code path leaving up with a bunch of case-splitting at the bottom. I.e.

    f :: A -> IO ()
    f = ... (a lot of duplication)
    
    g :: B -> IO ()
    g = ... (a lot of duplication)
    

    ends up being "simplified" as

    fg :: Either A B -> IO ()
    fg ab = do
      ...
      case ab of
       A -> ...
       B -> ...
      ...
      case ab of
       A -> ...
       B -> ...
      ...
    

    rather than e.g.

    f :: A -> IO ()
    f = do
      common1
      specific
      common2
      specific
    
    g :: B -> IO ()
    g = do
      common1
      specific
      common2
      specific
    

    I am sure this is what you have in mind. I just needed to get this out of my chest 😂

  2. added 2 commits that reference this issue on Dec 15, 2023
    a8eb4d9
    531e5e2
  3. self-assigned this
    on Dec 18, 2023
  4. added 3 commits that reference this issue on Jan 5, 2024
    594cd02
    9a5f0fc
    d6506db
  5. added a commit that references this issue on Jan 8, 2024
    0503a67
  6. added a commit that references this issue on Jan 8, 2024
    f70fc98
  7. added a commit that references this issue on Apr 22, 2024
    c67b64f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions