tfausak / flow

:droplet: Write more understandable Haskell.
https://hackage.haskell.org/package/flow
MIT License
198 stars 10 forks source link

Define Unicode operators? #1

Closed tfausak closed 8 years ago

tfausak commented 9 years ago

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.

tfausak commented 9 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' <!
tfausak commented 9 years ago

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.

tfausak commented 9 years ago

I don't think these operators are worth it.

tfausak commented 9 years ago

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.

tfausak commented 8 years ago

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.

tfausak commented 8 years ago

Changed my mind after implementing this feature: https://github.com/tfausak/flow/pull/8#issuecomment-145395672