Skip to content

type CoreExpr = Expr Id is semantically wrong

(This is just a nit, but one that could easily cause confusion for newcomers.) The CoreExpr type is defined as

data Expr b
  = Var   Id
  | Lit   Literal
  | App   (Expr b) (Arg b)
  | Lam   b (Expr b)
  | Let   (Bind b) (Expr b)
  | Case  (Expr b) b Type [Alt b]
  | Cast  (Expr b) CoercionR
  | Tick  CoreTickish (Expr b)
  | Type  Type
  | Coercion Coercion
type CoreExpr = Expr Id

Note that Expr Id instantiates b to Id everywhere. But clearly, lambdas also bind type or coercion variables. Similarly for Let, I think.

So I propose

type CoreExpr = Expr Var

instead.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information