google-research / dex-lang

Research language for array processing in the Haskell/ML family
BSD 3-Clause "New" or "Revised" License
1.58k stars 107 forks source link

Split up primops into groups so they can be allowed/denied at the group level #1182

Closed dougalm closed 1 year ago

dougalm commented 1 year ago

I initially tried giving IR predicates to each primop individually. Unfortunately, that means we have to pattern-match on every allowable primop when we do an IR-changing transformation, so that GHC knows that you've handled all the required cases. Previously we could have a fallback case, but that no longer typechecks. With the grouped design, you still have to pattern-match on each top-level case, but you can handle entire subtrees generically.