ghc
ghc copied to clipboard
Easier recursive aliases
trafficstars
The game plan is:
- All variables are annotated with a list
[(Name, Mult)]corresponding to the usage environment of their left-hand side. - This is in addition to the multiplicity annotation, but the intention is that, eventually, lambda-bound variables receive a only a multiplicity, and let-bound variables only a usage environment annotation (sharing the same field).
- This needs to be maintained throughout core-to-core passes (whenever one creates a lambda-bound binder, and in case-of-case for join points (which was the initial motivation)).
- I haven't tried to be efficient.
- Possibly other things I forget.
Small failing testcase, with -O -dcore-lint:
module Base where
data Map = Bin Int !Map | Tip
go :: Map -> Map
go Tip = Bin 0 Tip
go (Bin _ r) = Bin 0 (go r)
This passes with -fno-worker-wrapper, likely the same cause as why the build fails in MkIface.
I've marked the comments about CoVar as "resolved" since they'll be handled at https://gitlab.haskell.org/ghc/ghc/merge_requests/2268.