Skip to content
  • Rodrigo Mesquita's avatar
    2decb0e7
    Refactor the core component building logic · 2decb0e7
    Rodrigo Mesquita authored
    1. Refactors the duplicated `buildExtraSources` function from `gbuild` and
        `buildOrReplLib` into a standalone monadic computation in the context of
        building a component. This refactor allows
        us to share the code for building an extra source amongst the two
        functions.
    
    2. Creates a new module Distribution.Simple.GHC.Build.Modules which, in the
        same spirit as ...GHC.Build.ExtraModules, defines an action which builds
        all the Haskell modules of the component being built.
    
        This function clarifies and re-implements the logic of building Haskell
        modules in the different possible ways, while accounting for
        Template Haskell special "way requirements", which was previously
        duplicated in a non-obvious manner in gbuild and buildOrReplLib.
    
        The Note [Building Haskell modules accounting for TH] in that module
        explains the big picture, and the implementation is re-done in light of
        it.
    
    3. Re-work the linker invocations, focusing on preserving existing
    behaviour before simplifying or fixing bugs any further.
    
    Fixes #9389.
    2decb0e7
    Refactor the core component building logic
    Rodrigo Mesquita authored
    1. Refactors the duplicated `buildExtraSources` function from `gbuild` and
        `buildOrReplLib` into a standalone monadic computation in the context of
        building a component. This refactor allows
        us to share the code for building an extra source amongst the two
        functions.
    
    2. Creates a new module Distribution.Simple.GHC.Build.Modules which, in the
        same spirit as ...GHC.Build.ExtraModules, defines an action which builds
        all the Haskell modules of the component being built.
    
        This function clarifies and re-implements the logic of building Haskell
        modules in the different possible ways, while accounting for
        Template Haskell special "way requirements", which was previously
        duplicated in a non-obvious manner in gbuild and buildOrReplLib.
    
        The Note [Building Haskell modules accounting for TH] in that module
        explains the big picture, and the implementation is re-done in light of
        it.
    
    3. Re-work the linker invocations, focusing on preserving existing
    behaviour before simplifying or fixing bugs any further.
    
    Fixes #9389.
Loading