Live data from Hacker News

FP-Go: Functional programming library for Golang

github.com

61–70 of 185 posts

Re: FP-Go: Functional programming library for Golang

#61
post #50

I don’t know who to feel more sorry for: the junior programmer who has dutifully taught themselves idiomatic go and explicit error handling being shown a large unreadable codebase full of this nonsense on their first day, or the the poor sods having to tear this nonsense out of a large tangled codebase in three years time.

[deleted]

Re: FP-Go: Functional programming library for Golang

#62
post #49

Earlier quoted context omitted.

True, however the README does link to this: https://github.com/IBM/fp-go/tree/main/samples

data := F.Pipe3( T.MakeTuple2("https://jsonplaceholder.typicode.com/posts/1", "https://catfact.ninja/fact"), T.Map2(H.MakeGetRequest, H.MakeGetRequest), R.TraverseTuple2( readSinglePost, readSingleCatFact, ), R.ChainFirstIOK(IO.Logf[T.Tuple2[PostItem, CatFact]]("Log Result: %v")), ) This looks like a pain to modify if you're not intimately familiar with the fp-go library and are just trying to insert a debug statemen…

And, after all that, they don’t even handle the IO errors.

Re: FP-Go: Functional programming library for Golang

#64
post #58

Why?

I can think of two good reasons: 1. To look clever. 2. To make junior programmers look stupid.

For me, the best reason would be: for the heck of it. But it's IBM's repo. Someone wanted this in some official IBM capacity.

Re: FP-Go: Functional programming library for Golang

#68
I hope this remains just a curiosity that showcases a fascinatingly bad idea, rather than that anyone out there thinks that this is a good idea and start depending on it.

Picture jumping into a codebase to quickly fix something, then stumble upon ChainFirstIOK or Eithersize5 because someone went overboard showing off that they remember FP from cs classes.

Re: FP-Go: Functional programming library for Golang

#69

This is a tour de force, and it accomplishes the goal of enabling FP using the Go syntax and toolchain. But code written using this library is no longer Go: most Go programmers can't grok it, and it's awkward to call normal Go libraries because there's no way to know if that function you're calling is pure. If your goal is to "make it easy and fun to write maintainable and testable code in golang" by making pure func…

It's syntactically Go but it adds a functional DSL on top of it - that is, you can't just know Go, you need to learn the ins and outs of this library too (plus functional programming) before you can use it.

I cannot recommend this unless you really have to for whatever reason. Besides readability, another factor to consider is performance; Go is not optimized for functional programming structures. It doesn't have things like tail call optimization.

There's better languages than Go if you want to / have to do functional programming.

Post reply on HN