WIP: Convert many primops into `foreign import prims`
We have a bunch of outline only primops which are just foreign calls. This PR goes after a wide swath of them, picking up where !1330 (closed) left off.
I am opening this PR now because I am curious about some preliminatory feedback. I mostly like the way the haskell syntax works and the work is split per phase. Trees that grow is joy to use in greenfield syntax to divide up the work. I am not so sure about the Core syntax. It seems like there are too many datatypes with no nice or clear division of labor, and I am just making the problem worse. But, of course, this could always be a sign I misunderstood the purpose of things and now am muddying it up in a different way.
to-do list:
-
Draft of compiler type checks -
Add info to all phases of haskell syntax and core -
parser
-
-
Do lexer changes? Should we have proper "contextual" (special id) keywords instead of just rename hacks? -
Double check structs - Do we need
ForeignImplDecl
or just stick it inCCallSpec
?
- Do we need
-
Preserve locations into GhcTc
-
Relax type enforcement since polymorphism and a bunch of other stuff is allowed for foreign import prim
unlike the other foreign imports. -
Probably cut commutability since neither GHC nor the primops being moved use it. It would be better to just use {-# RULES #-}
anyways. -
Fix foreign import prim
s to actually use new stuff
-
are either individually buildable or squashed -
have commit messages which describe what they do (referring to Notes and tickets using #NNNN
syntax when appropriate) -
have added source comments describing your change. For larger changes you likely should add a Note and cross-reference it from the relevant places. -
add a testcase to the testsuite. -
replace this message with a description motivating your change
If you have any questions don't hesitate to open your merge request and inquire
in a comment. If your patch isn't quite done yet please do add prefix your MR
title with WIP:
.