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

Fixing typing annotations on recursive functions #484

Open
andrejbauer opened this issue Nov 25, 2019 · 0 comments
Open

Fixing typing annotations on recursive functions #484

andrejbauer opened this issue Nov 25, 2019 · 0 comments

Comments

@andrejbauer
Copy link
Member

This issue is a partial response to #482. A recursive function f of type t is annotated as

let rec f x : t = ...

which makes it look as if f x has type t. The easiest fix here so to instead have

let rec (f : t) x = ...

This is what should be implemented instead of the current solutions.

Alrernatives

  1. In case t is of the form t1 -> t2 we could write let rec f (x : t1) : t2 = ..., but not when t is of the form mlforall a , ....

  2. OCaml allows let rec f : t = fun x -> ... but that relies on examining the syntactic form of the right-hand side, which we prefer to avoid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant