Middleware 1.0.0 -- Composable functions which respond to inner calls

Hey folks!

I’m happy to announce the first release of middleware, a utility for composing functions which
need to respond to inner calls.

See our GitHub for examples and more details: GitHub - skolemlabs/middleware: OCaml utility for building composable middleware functions

This package was developed internally at Skolem Technologies, and we’ve decided to open-source it. More such packages are coming soon!

– Trent

3 Likes

I didn’t quite understand why this library is useful from the examples. OCaml is generally quite good at composing functions using nothing but language primitives — so what problem is this library solving?

One thing that may help is to show an example and what it looks like without vs with the library.

Add the end of the README, you mention that the library can help whenever you are using a monad, but you don’t show how. Maybe providing a concrete example with a monad would help?

5 Likes

Hey @smolkaj!

Good point – I suppose a more advanced example may help illustrate its usefulness.
Along with the monad example, updating the README sounds like a good plan.

I think the key which makes this useful is that it’s more ergonomic to pass this kind of
structure around (especially while composed), opposed to passing around higher-order
functions. Hopefully I can make a compelling argument for that next time I update the
README.

I appreciate the feedback – happy to make some improvements here!

3 Likes