Discussion:
[Ur] Tooling: type of an expression
Simon Van Casteren
2018-10-11 00:22:24 UTC
Permalink
Urweb tooling is pretty limited compared to other languages. I knew that
when I started with it and so far I'm OK with it. Honestly, most of the
"modern" tooling I see in other ecosystems is a waste of time.

However, the one thing that would really cut dev time in half for me in
Ur/web (slightly exaggerated for effect) would be being able to have the
compiler tell me the type of an expression. You can go multiple levels deep
here:

- type of an identifier
- type of an expression at top level
- type of an expression in function definition, let-binding, etc

I'm sending this email to the mailing list to ask if something like this is
remotely possible, what kind of approach we can take and how we could go
about implementing it.

Any help much appreciated

Simon
Adam Chlipala
2018-10-11 03:19:38 UTC
Permalink
I'm sure it's more than just remotely possible and is just a question of
someone getting hands dirty and writing the code!  The baseline of a
whole-program compiler could make it trickier than for many other
toolsets, but it could work to periodically run "compiles" through type
inference, saving the results to hidden files.
Post by Simon Van Casteren
Urweb tooling is pretty limited compared to other languages. I knew
that when I started with it and so far I'm OK with it. Honestly, most
of the "modern" tooling I see in other ecosystems is a waste of time.
However, the one thing that would really cut dev time in half for me
in Ur/web (slightly exaggerated for effect) would be being able to
have the compiler tell me the type of an expression. You can go
- type of an identifier
- type of an expression at top level
- type of an expression in function definition, let-binding, etc
I'm sending this email to the mailing list to ask if something like
this is remotely possible, what kind of approach we can take and how
we could go about implementing it.
Any help much appreciated
Simon Van Casteren
2018-10-11 06:56:42 UTC
Permalink
I think that would get me to the first level: getting types of identifiers.
Do you see any way to evaluate expressions and getting the types of those?

This is something that would definitely be worth it for me, so I'll be
implementing it unless I can't figure it out :).

Simon
Post by Adam Chlipala
I'm sure it's more than just remotely possible and is just a question of
someone getting hands dirty and writing the code! The baseline of a
whole-program compiler could make it trickier than for many other
toolsets, but it could work to periodically run "compiles" through type
inference, saving the results to hidden files.
Post by Simon Van Casteren
Urweb tooling is pretty limited compared to other languages. I knew
that when I started with it and so far I'm OK with it. Honestly, most
of the "modern" tooling I see in other ecosystems is a waste of time.
However, the one thing that would really cut dev time in half for me
in Ur/web (slightly exaggerated for effect) would be being able to
have the compiler tell me the type of an expression. You can go
- type of an identifier
- type of an expression at top level
- type of an expression in function definition, let-binding, etc
I'm sending this email to the mailing list to ask if something like
this is remotely possible, what kind of approach we can take and how
we could go about implementing it.
Any help much appreciated
_______________________________________________
Ur mailing list
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Adam Chlipala
2018-10-11 14:32:58 UTC
Permalink
Well, you could take advantage of the type-inference daemon and run a
new compilation job with your extra expression added to the build.
Post by Simon Van Casteren
I think that would get me to the first level: getting types of
identifiers. Do you see any way to evaluate expressions and getting
the types of those?
This is something that would definitely be worth it for me, so I'll be
implementing it unless I can't figure it out :).
Simon
I'm sure it's more than just remotely possible and is just a question of
someone getting hands dirty and writing the code!  The baseline of a
whole-program compiler could make it trickier than for many other
toolsets, but it could work to periodically run "compiles" through type
inference, saving the results to hidden files.
Post by Simon Van Casteren
Urweb tooling is pretty limited compared to other languages. I knew
that when I started with it and so far I'm OK with it. Honestly,
most
Post by Simon Van Casteren
of the "modern" tooling I see in other ecosystems is a waste of
time.
Post by Simon Van Casteren
However, the one thing that would really cut dev time in half
for me
Post by Simon Van Casteren
in Ur/web (slightly exaggerated for effect) would be being able to
have the compiler tell me the type of an expression. You can go
- type of an identifier
- type of an expression at top level
- type of an expression in function definition, let-binding, etc
I'm sending this email to the mailing list to ask if something like
this is remotely possible, what kind of approach we can take and
how
Post by Simon Van Casteren
we could go about implementing it.
Any help much appreciated
Simon Van Casteren
2018-10-24 08:11:52 UTC
Permalink
Is there a possibility for -dumpTypes to also dump values in let bindings?
Well, you could take advantage of the type-inference daemon and run a new
compilation job with your extra expression added to the build.
I think that would get me to the first level: getting types of
identifiers. Do you see any way to evaluate expressions and getting the
types of those?
This is something that would definitely be worth it for me, so I'll be
implementing it unless I can't figure it out :).
Simon
Post by Adam Chlipala
I'm sure it's more than just remotely possible and is just a question of
someone getting hands dirty and writing the code! The baseline of a
whole-program compiler could make it trickier than for many other
toolsets, but it could work to periodically run "compiles" through type
inference, saving the results to hidden files.
Post by Simon Van Casteren
Urweb tooling is pretty limited compared to other languages. I knew
that when I started with it and so far I'm OK with it. Honestly, most
of the "modern" tooling I see in other ecosystems is a waste of time.
However, the one thing that would really cut dev time in half for me
in Ur/web (slightly exaggerated for effect) would be being able to
have the compiler tell me the type of an expression. You can go
- type of an identifier
- type of an expression at top level
- type of an expression in function definition, let-binding, etc
I'm sending this email to the mailing list to ask if something like
this is remotely possible, what kind of approach we can take and how
we could go about implementing it.
Any help much appreciated
_______________________________________________
Ur mailing list
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Adam Chlipala
2018-10-24 12:56:12 UTC
Permalink
It doesn't sound too hard, and I'd be glad to see a patch for it; and
feel free to open a GitHub issue.
Post by Simon Van Casteren
Is there a possibility for -dumpTypes to also dump values in let bindings?
Well, you could take advantage of the type-inference daemon and
run a new compilation job with your extra expression added to the
build.
Post by Simon Van Casteren
I think that would get me to the first level: getting types of
identifiers. Do you see any way to evaluate expressions and
getting the types of those?
This is something that would definitely be worth it for me, so
I'll be implementing it unless I can't figure it out :).
Simon
I'm sure it's more than just remotely possible and is just a question of
someone getting hands dirty and writing the code!  The baseline of a
whole-program compiler could make it trickier than for many other
toolsets, but it could work to periodically run "compiles" through type
inference, saving the results to hidden files.
Post by Simon Van Casteren
Urweb tooling is pretty limited compared to other
languages. I knew
Post by Simon Van Casteren
that when I started with it and so far I'm OK with it.
Honestly, most
Post by Simon Van Casteren
of the "modern" tooling I see in other ecosystems is a
waste of time.
Post by Simon Van Casteren
However, the one thing that would really cut dev time in
half for me
Post by Simon Van Casteren
in Ur/web (slightly exaggerated for effect) would be being
able to
Post by Simon Van Casteren
have the compiler tell me the type of an expression. You
can go
Post by Simon Van Casteren
- type of an identifier
- type of an expression at top level
- type of an expression in function definition,
let-binding, etc
Post by Simon Van Casteren
I'm sending this email to the mailing list to ask if
something like
Post by Simon Van Casteren
this is remotely possible, what kind of approach we can
take and how
Post by Simon Van Casteren
we could go about implementing it.
Any help much appreciated
_______________________________________________
Ur mailing list
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
_______________________________________________
Ur mailing list
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
Loading...