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

Rename ∘ to << and add >>, |> and <| functions #103

Merged
merged 9 commits into from
Jun 24, 2024

Conversation

paulcadman
Copy link
Contributor

@paulcadman paulcadman commented Jun 20, 2024

This PR replaces the unicode composition function name with << and adds similar functions >>, |> and <|. Inspired by elm.

The $ function is now called <|.

The >>> (builtin seq) function is now called >->.

The >> : IO -> IO -> IO function is now called >>>.

@paulcadman paulcadman self-assigned this Jun 20, 2024
@paulcadman paulcadman marked this pull request as draft June 20, 2024 11:14
@paulcadman paulcadman marked this pull request as ready for review June 21, 2024 16:48
@@ -219,7 +219,7 @@ syntax iterator concatMap {init := 0; range := 1};
--- Applies a function to every item on a ;List; and concatenates the result.
--- 𝒪(𝓃), where 𝓃 is the number of items in the resulting list.
concatMap {A B} (f : A -> List B) : List A -> List B :=
flatten map f;
flatten << map f;
Copy link
Contributor

@lukaszcz lukaszcz Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have >>, I think it would be more readable to use it in most situations instead of << (the composition order of >> from left to right seems more intuitive: we first map, then flatten).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed - I will change this. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@paulcadman paulcadman merged commit 00f6f50 into main Jun 24, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Every function should have a counterpart that does not require Unicode
2 participants