Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plus and times aren't robust for beta reduction #39

Open
HuwCampbell opened this issue Jun 8, 2022 · 1 comment
Open

Plus and times aren't robust for beta reduction #39

HuwCampbell opened this issue Jun 8, 2022 · 1 comment

Comments

@HuwCampbell
Copy link

The subtyping and ad-hoc type of + make it a bit flaky.

This works fine:

>>> (\x -> 3.4 + x) 1
4.4

But this one doesn't

>>> 3.4 + 1
Not a subtype
The following type:
  Real
 cannot be a subtype of:
  Natural

All I've done here is beta reduction, which one would usually expect to preserve type inference.

Ideally, I think this should also work:

>>> (\x -> 1 + x) 3.14
Not a subtype

I can see why is doesn't, but Ignoring that + also does lists and text.

>>> :t (\x -> 1 + x)
Natural -> Natural

Could it instead be something like:

>>> :t (\x -> 1 + x)
forall (a : Type) such that (Natural <: a). a -> a
@Gabriella439
Copy link
Owner

Currently the type checker does not yet support subtyping constraints in types, but it might soon (as part of implementing support for record concatenation, which seems to require this)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants