2 ms·
The way before and after hooks are applied seems pretty terrible. Imagine doing this everywhere. It's also not a pattern I've ever seen in any FP codebase. If
by YuukiRey 5y ago
The way before and after hooks are applied seems pretty terrible. Imagine doing this everywhere. It's also not a pattern I've ever seen in any FP codebase.
If you need to do something before or after you could just, you know, do it from the callers side. Or wrap the original thing in a new thing which does this. If the only way of composing things is by passing increasingly elaborate callbacks around (have fun with error handling, return early, and so on, from these functions) then I think you really missed a good abstraction level in your code.
Lastly, dependency inversion is actually a pretty big topic in FP languages, especially since they often experiment with effect systems. It's a shame that this paragraph read so anemic.
Honestly this article is exactly the kind of shallow content I've come to expect from this blog.
- Cidolfas2 5y agoI'm definitely not an expert in FP! The hook method is one I've seen used here and there, but higher-order functions is definitely more common. In retrospect I should have put more emphasis on that. Can you point to some good articles on dependency inversion in FP?