Skip to content

Allow unsaturated applications of runRW#

Ben Gamari requested to merge wip/T18291 into master

46720997 recently enabled simplification of runRW# and in the process gave it a few more special properties. Among these is a Core Lint check which rejects any unsaturated applications of runRW#. However, this is problematic as such applications can occur in real code. For instance, the desugared Core of Data.Primitive.Array.runArray# from the primitive package contains:

case ($) (runRW# @_ @_) (\s -> ...) of ...

Clearly this link check is too strict. That's not all: CorePrep also has a check which panics on unsaturated applications.

To fix this we simply remove both of these checks. runRW# has a perfectly reasonable Haskell binding which will get called if we produce code for the unsaturated application in the normal way.

Fixes #18291 (closed).

Edited by Ben Gamari

Merge request reports