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

Curry #1

Closed
opeltre opened this issue Oct 26, 2021 · 2 comments
Closed

Curry #1

opeltre opened this issue Oct 26, 2021 · 2 comments

Comments

@opeltre
Copy link
Owner

opeltre commented Oct 26, 2021

Implement:

curry   :: ((a, b) -> c) -> a -> b -> c
uncurry :: (a -> b -> c) -> (a, b) -> c

As methods of the Arrow class.

Then, given arity of function f, return partial application (slice) of f with smaller number of arguments.

To do this properly, we should have product types, so that:

Arrow(A * B, C) ~ Arrow(A, Arrow(B, C))

And arity 2 is infered from the input type A * B.

@opeltre
Copy link
Owner Author

opeltre commented Oct 26, 2021

More generally implement the whole cartesian structure on types:

A | B  # union type
A * B  # product type
B ** A # exponentiation: Arrow(A, B)

@opeltre
Copy link
Owner Author

opeltre commented May 12, 2024

Cartesian structure merged in #10

@opeltre opeltre closed this as completed May 12, 2024
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

No branches or pull requests

1 participant