diprism / perpl

The PERPL Compiler
MIT License
10 stars 5 forks source link

Fixes #109 by tracking which define type parameters are robust #115

Closed colin-mcd closed 1 year ago

colin-mcd commented 1 year ago

Specifically, this change implements the following:

We can talk about this tomorrow if it's unclear in any way

davidweichiang commented 1 year ago

Edge case:

data MyBool a = MyFalse | MyTrue;
define double = \x. (x, case x of MyFalse -> False | MyTrue -> True); -- error
--define double = \x. (x, x); -- no error
define b : MyBool (() -> ()) = MyTrue;
double b

I would perfectly fine with just not allowing a datatype to ignore a type parameter.

davidweichiang commented 1 year ago

Three possible outcomes: (1) make the first line an error (2) first line is okay, both definitions of double are errors (3) first line is okay, both definitions of double are okay

davidweichiang commented 1 year ago

Cf. #75 for the change that caused the 2nd definition of double to become allowed.

All in all, I think I mildly lean towards (3). Type inference is supposed to find the most general type and \forall a . MyBool a is more general than \forall a robust . MyBool a.

davidweichiang commented 1 year ago

I'll go ahead and merge this, too, to make the merge with #118 easier.