Koda
Languages and libraries
functional programming library
SHOW HN2022
110points
58comments
#569of 2,570 in 2022
Top 23%of 2022 by points
How HN took it
MixedNo clear lean
9 positive, 7 neutral or asking, 0 mixed, 3 critical, out of 19 comments about the project. Thread score +0.25.
Idea: 8 for, 3 against
The thread, comment by comment
Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.
positive neutral or mixed critical about another commenter or something else the maker
What HN said
What people liked
Useful functional constructs for handling nullable and error values
From 2 comments
Really nice project! I’ve been looking for something like this, and typically end up building a very minimal version of it for projects. Are you looking for help or contributors?…
fishmarmalade on HNNow this is an answer I was waiting for. Thank you for explaining the real benefits of sticking to koda style. I guess this would be obvious if I used statically typed languages…
impoppy on HN
Objections
Python already handles None with Optional and try/except
From 3 comments
Why would you write Python like it’s Rust? I really fundamentally do not understand the purpose. Ain’t `is Null` checks and try except good enough?
impoppy on HNYeah this sort of thing is necessary in statically typed languages like Rust and C++ but in Python (and e.g. Typescript) you can just use anonymous type unions like `str | None`.…
IshKebab on HNI wanted to ask the same thing: Couldn't we just use Optional and None for this? So the point of using Koda is to communicate intent (functions that don't throw exceptions), and…
leethargo on HN
Feels unpythonic and Rust-like
From 2 comments
Why would you write Python like it’s Rust? I really fundamentally do not understand the purpose. Ain’t `is Null` checks and try except good enough?
impoppy on HNI let myself do a little bit of thinking and I guess this might be helpful when you are doing functional style pipes/chains but you can wrap the whole chain into a try except…
impoppy on HN
Requests
Higher-level collection functions like groupBy and countBy
From 1 comment
I want a similar toolkit that lifts over the Ruby/Groovy/Kotlin style functions like countBy, groupBy, sortBy, collate, etc etc. Programming in Python is such a chore without…
zmmmmm on HN
Questions
Does composition preserve error messages and tracebacks
From 2 comments
Nice. One question I have is does the compose operator preserve error messages, allow you to pinpoint which function raised an exception etc? That's the one issue I have w/ the…
pizza on HNSo far I've been able to follow them. If you `raise` an exception during one of the functions that's used in a compose the traceback will mention the function that failed (I'm…
keithasaurus on HN
Alternatives named
dry-python returns
From 2 comments
A similar "framework", very robust and used in production systems, is dry-python's one[0][1]. The approach taken is a bit different I think, since they rely heavily on `mypy`…
hackandtrip on HNdry-python has a lot of cool stuff. I encourage people to check it out. Koda has a slightly different approach in that it's meant to be a little simpler than returns, and to work…
keithasaurus on HN
funct library
From 1 comment
There is https://github.com/lauriat/funct which has some of those higher level functions.
lauriat on HN