-
Notifications
You must be signed in to change notification settings - Fork 25
Adding type directive to REPL. #295
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
base: master
Are you sure you want to change the base?
Conversation
…rder to make adding another directives easier & to eliminate printing of : Unit after each directive
Foxinio
left a comment
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.
The changes look promising, and I believe they will get to what we want from this PR, but it's not it just yet.
As I understood it, the goal was to implement capability to look up schemes as they are in they are kept in the environment. So for example when I enter:
> :t List.hdErr ;;
I should get the information about what arguments the function expects, what it returns, but also what are it's named parameters. Instead I get following output:
fatal error: Cannot resolve an implicit parameter ~onError
| :t List.hdErr ;;
| ^^^^^
|
The idea is to not only return reconstructed type of an expression, but to expect an identifier, lookup it's scheme in the environment and print that.
Another problem with this approach is that all the work is done in the type inference section. While it is simple, it misses out on all the information inferred about effects. Since fram's main appeal are effects, this is unsatisfactory.
| let () = open_cbrackets := !open_cbrackets - 1 in | ||
| YaccParser.CBR_CLS | ||
| } | ||
| | ":t" { YaccParser.DIR_TYPE } |
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.
While this is correct, I'm not sure if there isn't a more general approach that will be useful in future extensions of this mechanism.
We should discuss that on the meeting
| | Raw.REPL_Dir directive -> | ||
| begin match directive with | ||
| | Directive_Type e -> | ||
| let def = make_nowhere (Lang.Surface.DReplDir(Type_Directive (Desugar.tr_expr e))) in |
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.
Please keep number of characters on a line under 80
This PR will add
:tdirective to REPL.It will become possible to print type scheme of expression without evaluating it.
For example: