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

"Lower-bounded" universal quantification #2

Open
probeiuscorp opened this issue Sep 10, 2024 · 0 comments
Open

"Lower-bounded" universal quantification #2

probeiuscorp opened this issue Sep 10, 2024 · 0 comments

Comments

@probeiuscorp
Copy link
Owner

Ideally typeclassing can be flattened, such that in

class Eq a
  eq: a -> a -> Bool

eq has type forall a: Eq. a -> a -> Bool. The problem is the flattening does not work when the typeclass parameter is used multiple times, as eq does. Its current definition would allow usages like this:

eq "Hello" 42

where a is inferred as String + Num. However, a usage like:

eq None $ Some 42

should be allowed, where a is inferred as None + Some Num.


A related problem is inspecting type constructors, such as which of these should be valid and how the compiler would know:

type Maybe = a. Some a + None
instance Functor Maybe

type Maybe2 = Maybe
instance Functor Maybe2

type Maybe3 = a. Maybe a
instance Functor Maybe3
@probeiuscorp probeiuscorp changed the title Closed universal quantification "Lower-bounded" universal quantification Sep 23, 2024
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

1 participant