-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add builtin integer type to the surface language #1948
Conversation
a147928
to
c22da7d
Compare
In the REPL:
The operations on Nats can somehow be used with integers. It shouldn't be possible or the result should have type Int. |
Thanks for catching this. I've now fixed it and added a negative type checking test. The REPL now reports:
|
This doesn't solve the problem completely:
Should give an error that |
Thank you - I've tried to solve the problem again. |
This PR provides the implementations of builtins defined in anoma/juvix#1948
This PR adds a builtin integer type to the surface language that is compiled to the backend integer type.
Inductive definition
The
Int
type is defined in the standard library as:New builtin functions defined in the standard library
Additional builtins required in the definition of the other builtins:
REPL types of literals
In the REPL, non-negative integer literals have the inferred type
Nat
, negative integer literals have the inferred typeInt
.The standard library Prelude
The definitions of
*
,+
,div
andmod
are not exported from the standard library prelude as these would conflict with the definitions fromStdlib.Data.Nat
.Stdlib.Prelude