-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Type System Improvements #216
Conversation
The |
I would leave Other than that, I would like to have an ability to restrict/write types of variables in Oh, and I love that it's all optional. Especially anonymous functions (used with mapping, filtering) can benefit from that. |
It's easy to add it as an optional thing, I can see that it could be helpful from some situations, I never needed myself it though.
I have mixed feelings here as well. GitHub need to implement some kind of polls for issues 😂 |
@gdotdesign It's pretty easy! Add a 👍 reaction to this comment for leaving |
- Removed the "TypeChecker::Js" type class - Allow the type to be defined from code using the "as Type" notation.
spec/formatters/connect
Outdated
@@ -6,7 +6,7 @@ store Test { | |||
} | |||
|
|||
component A { | |||
connect Test exposing{a,b,c,d} | |||
connectTest exposing{a,b,c,d} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesnt seem right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking the parser does not need white-space between the keyword and the name of the store here.
It's because there is no tokeniser phase, the parser directly produces the AST.
} | ||
|
||
fun just (value : a) : Maybe(a) { | ||
`new Just(value)` | ||
`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it empty now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests does not execute JavaScript code, it just parses the code and type checks based on the annotations, so it does not make sense having that here.
By popular demand the Now this PR contains the following:
|
Two more issues has been implemented here:
|
Co-Authored-By: Sijawusz Pur Rahnama <sija@sija.pl>
This PR is an RFC for visual improvements for the code itself.
I feel like that Mint code has some visual clutter which can be resolved quite easily, but for some we need type inference.
Removing some elements helps reduce visual complexity, makes it easier to read and reason about the code, also it has the additional benefit of writing less.
Types
For functions, states, properties and computed properties the type (or return type) is required, and for me sometimes it's a burden to write them. These type definitions can be made optional.
The only downside of that is that for recursive functions and for the component records we need to calculate static type signatures and without a defined type we can use a type variable
a
but having a type for helps with that.Type definitions elsewhere will still be required (arguments, provider, records, etc...)
The
fun
keywordIt is possible to remove the
fun
keyword which in hindsight is not needed.Here is an example of how a component file looks now and how it can look with this PR:
This PR can be merged as-is, all the tests pass, however I still plan to work on this.
The
fun
keyword is optional but the compiler throws a warning that it will be removed in the future and the formatter automatically removes them.Please give your feedback and if there is anything else which you think can be removed just let me know.