Hacker News new | ask | show | jobs
by johnday 845 days ago
This seems like too much effort has been put into it for it to be a purely satirical exercise, but I really cannot see why anyone would prefer to use this within Python, rather than (say) reaching for a proper type-safe functional language and either using that directly, or calling out to it from Python code.

As a person who teaches functional programming at degree level, this is the kind of thing that would put people off FP before they even get in the door. It is obviously less ergonomic than standard Python, and the code you end up with is no safer or more abstracted than what you started with.

That said, if the authors really do think it's a better way for programming in Python, and it works for them, then more power to 'em.

3 comments

I completely agree with you. As a Haskeller, I find it immensely irritating when people try to force ‘FP’ into programming languages where it doesn’t fit. It just ends up putting people off functional programming, which is a very nice paradigm in languages which properly support it. I feel that the best code is that which adheres to the general paradigm and style of the language it is written in, and these kinds of libraries go against that.

What’s worse, these versions of ‘FP’ often bear very little resemblance to actual functional programming and its advantages. Rather, people seem to fall into the trap of confusing functional programming with ‘those fancy words I hear from Haskell’. Now, I may like Haskell, but its concepts are only useful because of the rest of the language — you can’t just port ‘monads’ and ‘IO’ into some random language and expect them to be usable. It looks like this library partly avoids that fate, in that it does have more than just ‘monads’… but yes, the monads are still there, and they’re just as clunky as you’d expect from Python.

</rant>

> you can’t just

I mean, you can... But only with great discipline and experience. It just (probably) won't work if you're having to mentor more junior engineers with an OOP background.

Do you think that style of error handling works in Scala? It certainly seems possible to get right but the quality of Scala code I've worked with in different roles has frequently been atrocious, I'd almost rather dig into some old ColdFusion or PHP.

(Funny, I was downright terrified 15 years ago about ever mentioning "ColdFusion" or "Sharepoint" in a forum because I'd get contacted by recruiters about the first and salespeople about the second. I'd always tell the salespeople that we had no budget at all for Sharepoint and just had one for our dev team because you could get the license for free with an MSDN subscription)

To be perfectly honest, I don't know Scala very well.

I'm more interested in "pure FP" languages than in multi-paradigm languages, because the former seem much more coherent in design to me. IMO, functional programming isn't about adding extra degrees of freedom (or "extra features"), it's about working within very well-defined and rigid constraints (what one might call safeguards).

As a bit of an observation, and I suppose judgement, Python developers will seemingly do everything possible to not use another language. It is a strange phenomenon, but it partially explains why there are so many libraries There is a lot of reinventing the wheel, or trying to at least.
i have fastapi server which gets and mangles data. and calls numpy with that. data is badly formatted, i need to make it right. functional code is better for that. i do not want one more service now to be added in typescript, with effect ts.

there are no apis for haskell or other functional langs for data i need.