Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
  • Matthew Pickering's avatar
    421beb3f
    driver: Convert runPipeline to use a free monad · 421beb3f
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    This patch converts the runPipeline function to be implemented in terms
    of a free monad rather than the previous CompPipeline.
    
    The advantages of this are three-fold:
    
    1. Different parts of the pipeline can return different results, the
    limits of runPipeline were being pushed already by !5555, this opens up
    futher fine-grainedism of the pipeline.
    2. The same mechanism can be extended to build-plan at the module level
    so the whole build plan can be expressed in terms of one computation
    which can then be treated uniformly.
    3. The pipeline monad can now be interpreted in different ways, for
    example, you may want to interpret the `TPhase` action into the monad
    for your own build system (such as shake). That bit will probably
    require a bit more work, but this is a step in the right directin.
    
    There are a few more modules containing useful functions for interacting
    with the pipelines.
    
    * GHC.Driver.Pipeline: Functions for building pipelines at a high-level
    * GHC.Driver.Pipeline.Execute: Functions for providing the default
    interpretation of TPhase, in terms of normal IO.
    * GHC.Driver.Pipeline.Phases: The home for TPhase, the typed phase data
    type which dictates what the phases are.
    * GHC.Driver.Pipeline.Monad: Definitions to do with the TPipelineClass
    and MonadUse class.
    
    Hooks consumers may notice the type of the `phaseHook` has got
    slightly more restrictive, you can now no longer control the
    continuation of the pipeline by returning the next phase to execute but
    only override individual phases. If this is a problem then please open
    an issue and we will work out a solution.
    
    -------------------------
    Metric Decrease:
        T4029
    -------------------------
    421beb3f
    History
    driver: Convert runPipeline to use a free monad
    Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
    This patch converts the runPipeline function to be implemented in terms
    of a free monad rather than the previous CompPipeline.
    
    The advantages of this are three-fold:
    
    1. Different parts of the pipeline can return different results, the
    limits of runPipeline were being pushed already by !5555, this opens up
    futher fine-grainedism of the pipeline.
    2. The same mechanism can be extended to build-plan at the module level
    so the whole build plan can be expressed in terms of one computation
    which can then be treated uniformly.
    3. The pipeline monad can now be interpreted in different ways, for
    example, you may want to interpret the `TPhase` action into the monad
    for your own build system (such as shake). That bit will probably
    require a bit more work, but this is a step in the right directin.
    
    There are a few more modules containing useful functions for interacting
    with the pipelines.
    
    * GHC.Driver.Pipeline: Functions for building pipelines at a high-level
    * GHC.Driver.Pipeline.Execute: Functions for providing the default
    interpretation of TPhase, in terms of normal IO.
    * GHC.Driver.Pipeline.Phases: The home for TPhase, the typed phase data
    type which dictates what the phases are.
    * GHC.Driver.Pipeline.Monad: Definitions to do with the TPipelineClass
    and MonadUse class.
    
    Hooks consumers may notice the type of the `phaseHook` has got
    slightly more restrictive, you can now no longer control the
    continuation of the pipeline by returning the next phase to execute but
    only override individual phases. If this is a problem then please open
    an issue and we will work out a solution.
    
    -------------------------
    Metric Decrease:
        T4029
    -------------------------
Code owners
Assign users and groups as approvers for specific file changes. Learn more.