Skip to content

Uncurried types: distinguish 0 args, and 1 arg of type unit. #5821

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

Merged
merged 2 commits into from
Nov 17, 2022

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Nov 17, 2022

Curried types () => int and unit => int are equivalent.
However, uncurried types have explicit arity. After this PR, (. ()) => int means arity 0, and (. unit) => int means arity 1. The distinction was always there, but it was not reflected in the syntax.
This is a breaking change. In addition, the formatter before this PR does not help, as it would always format to (. unit) => int.

In uncurried mode, these uncurried types are written as () => int and unit => int.

@cristianoc cristianoc requested a review from cknitt November 17, 2022 09:59
@cristianoc cristianoc mentioned this pull request Nov 17, 2022
15 tasks
@cristianoc cristianoc merged commit 91fc35f into master Nov 17, 2022
@cristianoc cristianoc deleted the uncurried_zero_one branch November 17, 2022 10:13
@mununki
Copy link
Member

mununki commented Nov 21, 2022

Not sure I understand correctly. After this PR, how can be matched between implementation and interface in curried mode?

// interface
(. unit) => int // arity 1

// implementation
(. ) => int // arity ?
(. ()) => int // arity 0

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

Successfully merging this pull request may close these issues.

3 participants