Skip to content

Commit d204bd3

Browse files
committed
Refine 'apply' precedence
1 parent 464d5c1 commit d204bd3

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Xcode
22
#
3+
.build/*
34
build/
45
*.pbxuser
56
!default.pbxuser

Operators.swift

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,36 @@ precedencegroup CompositionPrecedence {
2020
/// Compose | Applies one function to the result of another function to produce a third function.
2121
infix operator : CompositionPrecedence
2222

23-
precedencegroup RightAssociativeCombinatorPrecedence {
23+
precedencegroup RightApplyPrecedence {
2424
associativity: right
25-
lowerThan: DefaultPrecedence
25+
higherThan: AssignmentPrecedence
26+
lowerThan: TernaryPrecedence
2627
}
2728

28-
precedencegroup LeftAssociativeCombinatorPrecedence {
29+
precedencegroup LeftApplyPrecedence {
2930
associativity: left
30-
lowerThan: DefaultPrecedence
31+
higherThan: AssignmentPrecedence
32+
lowerThan: TernaryPrecedence
3133
}
3234

3335
/// Apply | Applies an argument to a function.
34-
infix operator § : RightAssociativeCombinatorPrecedence
36+
infix operator § : RightApplyPrecedence
3537

3638
/// Pipe Backward | Applies the function to its left to an argument on its right.
37-
infix operator <| : RightAssociativeCombinatorPrecedence
39+
infix operator <| : RightApplyPrecedence
3840

3941
/// Pipe forward | Applies an argument on the left to a function on the right.
40-
infix operator |> : LeftAssociativeCombinatorPrecedence
42+
infix operator |> : LeftApplyPrecedence
43+
44+
precedencegroup RightAssociativeCombinatorPrecedence {
45+
associativity: right
46+
lowerThan: DefaultPrecedence
47+
}
48+
49+
precedencegroup LeftAssociativeCombinatorPrecedence {
50+
associativity: left
51+
lowerThan: DefaultPrecedence
52+
}
4153

4254
/// On | Given a "combining" function and a function that converts arguments to the target of the
4355
/// combiner, returns a function that applies the right hand side to two arguments, then runs both

0 commit comments

Comments
 (0)