Closed tfausak closed 8 years ago
If I was going to add Unicode operators, I think these are the characters I would use:
Function | Operator | Unicode |
---|---|---|
apply |
|> |
▷ |
apply |
<| |
◁ |
compose |
.> |
⇴ |
compose |
<. |
⬰ |
apply' |
!> |
▶ |
apply' |
<! |
◀ |
Here are some examples of how those operators would look in code:
-- apply
x |> f |> g
x ▷ f ▷ g
g <| f <| x
g ◁ f ◁ x
-- compose
f .> g .> h
f ⇴ g ⇴ h
h <. g <. f
h ⬰ g ⬰ f
-- apply'
x !> f !> g
x ▶ f ▶ g
g <! f <! x
g ◀ f ◀ x
I'm not crazy about the compose operators. They're hard to make out at small sizes. I couldn't find any Unicode symbols that were half cricle, half triangle. The only other option I found was "arrow with loop": ↬
and ↫
. It's easier to discern but not technically accurate.
I don't think these operators are worth it.
Another option for the composition operators is ⋗
and ⋖
. They are slightly easier to read than either of the arrows I suggested.
There's also ⪧
and ⪦
. They are closer to what I was looking for, but they might be too similar to the application operators.
Like #3, I am reconsidering this one. The Unicode operators wouldn't hurt anything, and people that like Unicode would get what they want. I think these are a harmless addition.
Changed my mind after implementing this feature: https://github.com/tfausak/flow/pull/8#issuecomment-145395672
I don't think I would ever use Unicode operators in my code. However there is some precedent for Unicode operators in Haskell; the base-unicode-symbols package defines some, for instance.