8000 idea: Simplify types in type constructors · Issue #1109 · shirok/Gauche · GitHub
[go: up one dir, main page]

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

idea: Simplify types in type constructors #1109

Open
shirok opened this issue Feb 7, 2025 · 0 comments
Open

idea: Simplify types in type constructors #1109

shirok opened this issue Feb 7, 2025 · 0 comments

Comments

@shirok
Copy link
Owner
shirok commented Feb 7, 2025

For example, if S <: T, (</> S T) can be simplified to (</> T). A more complicaed example is that (</> (<Assortment> #f) <char>) to (<?> <char>) etc.

The advantage is that type predicates such as of-type? or subtype? can be quicker.

Issues:

  • Suppose A <: B and A <: C but B and C are not subclass to another. We want (</> A B C) and (</> A C B) to be end up to the same type, but simple left- or right-fold won't cut it. Need some sort of consistent ordering. (The ordering also help to make memoization of type constructors, by allowing (</> X Y) and (</> Y X) share the same instance).
  • Should we simplify (</> A) to A? They behave the same with of-type? and subtype?, but the former can't be used with make. So probably not.
  • (</> (<Assortment> #f) <boolean>) can be (</> <boolean>) and (<?> <boolean>). This is a special case so we can handle it separately, maybe.
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
0