I know it is totally a nonsense question but due to my illiteracy on programming skill this question came to my mind. Cats and scalaz are used so that we can code in Scala similar to Haskell/in pure functional programming way. But for achieving this we need to add those libraries additionally with our projects. Eventually for using these we need to wrap our codes with their objects and functions. It is something adding extra codes and dependencies. I don't know whether these create larger objects in memory. These is making me think about. So my question: will I face any performance issue like more memory consumption if I use cats/scalaz ? Or should I avoid these if my application needs performance?
Do cats and scalaz create performance overhead on application?
Absolutely.
In the same way that any line of code adds performance overhead.
So, if that is your concern, then don't write any code (well, actually, the world may be simpler if we had never tried all this).
Now, dick answer outside. The proper question you should be asking is: "Is the overhead of X library harmful to my software?"; remember this applies to any library, actually to any code you write, to any algorithm you pick, etc.
And, to answer that question, we need some things before.
Fibers
instead of Threads
rather than trying to optimize small functions. Also, sometimes the easier and cheaper solution is better infrastructure).Thus, as you can see, performance is an art and a lot of work. So, unless you are committed to doing all this then stop worrying about something you will not measure and optimize properly. Rather, focus on increasing the maintainability of your code. This actually also helps performance, because when you find that you need to change something you would be grateful that the code is as clean as possible and that the whole architecture of the code allows for an easy change.
And, believe me when I say that, using tools like cats, cats-effect, fs2, etc will help with that regard. Also, they are actually pretty optimized on their core so you should be good for a lot of use cases.
Now, the big exception is that if you know that the work you are doing will be very CPU and memory bound then yeah, you pretty much can be sure all those abstractions will be harmful. In those cases, you may even want to stay away from the JVM and rather write pretty low-level code in a language like Rust which will provide you with proper tools for that kind of problem and still be way safer than plain old C.