Skip to content

Allow pushing of strict contexts into runRW# continuations

Ben Gamari requested to merge wip/runRW into master

This contains my work on top of @simonpj's prototype wip/T17760-runRW.

This is a proof of concept, in progress. It treats

runRW# (\s. e)

specially in three ways

  • In the simplifier, we transform

      K[ runRW# rr ty (\s. body) ]
      -->  runRW rr' ty' (\s. K[ body ])

    where K is a context

  • In Lint, join points are allowed to occur inside the continuation:

      join j x = rhs
      in runRW# (\s. case ... of
                       A -> j 1
                       B -> ...
                       C -> J 2)

    Very much as they can occur in other join points.

  • In OccurAnal, we infer join points using the same rule

We get much better optimisation as a result.

Edited by Ben Gamari

Merge request reports