-
Notifications
You must be signed in to change notification settings - Fork 448
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
["Request"] Feedback to make Arrow more approachable #3303
Comments
Hi @schielek, thanks for your feedback! We usually try to strike a balance between Kotlin-idiomatic names and names coming from the functional programming sphere. Personally, I like some of your suggestions like |
On the other hand, I think that renaming |
@serras
|
As user, I think With regards to |
What version are you currently using?
1.2.0
What would you like to see?
What's great?
Arrow's raise DSL is a masterpiece of engineering. It has all the benefits of type-safe error handling without compromising green path programming and therefore fosters readability.
Concrete vs. Abstract
I love that function names in the raise DSL are very concrete.
fun raise(r: Error): Nothing
clearly indicates that we deal with error handling here. A person not familiar with Arrow or even Kotlin can understand what the code does.Either.Left
on the other hand is abstract. It takes time to get used to the convention thatEither.Left
models errors andEither.Right
models the green path, but I feel like it is an unnecessary price to pay if I useEither
only for error handling. (For other cases I have sealed data types and would never long for Either.)Suggestions for some Renaming/Aliases
getOrRaise instead of/along with bind
I propose to introduce
getOrRaise
as an alias forbind
. It goes along with other functions such asgetOrElse
,getOrNull
, andgetOrNone
.get and error instead of/along with left and right
As mentioned before
left
andright
are rather abstract.parMap and parZip
This is not part of the raise DSL but belongs into a similar category since it affects readability. Some function names such as
parMap
andparZip
are directly taken from Haskell. While it is apparent to Haskell developers what these functions do, it might not be for the average Kotlin developer.I suggest going with the Kotlin/Java philosophy of avoiding abbreviations where possible.
parallelMap
andparallelZip
have five more characters but can save a lot of headache when reading code.Note
This issue is rather meant as a feedback or an impulse for a discussion than a feature request. I would be happy if some people would join the conversation and leave their thoughts.
The text was updated successfully, but these errors were encountered: