I’m curious what the basic things are that you need in every project. Having to reach for a library every time might suggest some areas that the core language could improve. Here are the things I always reach for:
-
@jaredly’s PPX “let-anything”: https://github.com/jaredly/let-anything
This one, though not strictly necessary, has become one of my most used tools. Being able to use a let binding for async operations has drastically improved the readability of my code. I also use it for the occasional monadic bind on non-async structures. -
@glennsl’s bs-json: https://github.com/glennsl/bs-json because I almost always have to deal with encoding and decoding JSON, though this has been replaced in most cases by what I’m about to mention below.
-
@ryb73’s PPX “decco”: https://github.com/ryb73/ppx_decco automatically generates JSON encoders and decoders for almost all of the cases I need, and it speeds up development significantly, since I have to work with Json so often.
-
My own https://www.npmjs.com/package/bs-pom for working with Promises. I know there are many libraries out there for promise work, and this one doesn’t pass the “soundness” test. But I’ve found it to be very practical in real-world use (it’s still under development, and almost totally undocumented). But I use this library because it allows promises to reject, which I am taking advantage of on the server, and uses Bluebird under the hood to generate a long stack-trace (preserved through async calls!) that can be enabled in production for increased debuggability (a huge win when doing server work). It also offers modules for compatibility with let-anything, named monadic functions for chaining promises, and their haskell-ish infix equivalents like
<$>
(which I almost never use anymore because of let-anything).
Without these extra tools, the language feels incomplete for the tasks I’m performing. How about you? What libs are you constantly reaching for?