2.6 KiB
Enso - The Minimalist IO Monad Library
Enso is a minimal IO Monad library that provides only absolute basics, nothing more and nothing less. It's not very robust, and that's by design. It's not amazing, and that's also by design. Enso is both something I wrote to learn how Monads (such as IO Monads) work in hopes to respark my interest in Functional Programming, as well as a utility built to make the development of my projects heavily utilizing the paradigm much easier.
As a result, Enso is not exactly fantastical and may not be for you, unless you don't mind the batteries not included mentality of Enso. Furthermore, I am not amazing at Functional Programming, and I have learned all of what I know about it through Haskell. As well, I'm not an academic of any sort (not a Computer Sciences major nor student) and thus this most likely is not the most impressive attempt at an IO Monad. I'm more of the engineer praxis type, and I just wanted to see whether I can even do the task.
Usage
Enso provides the IO Thunk in order to handle data and functions. Functions and any data made pure via to_IO are lazily evaluated and then able to be used on the spot or when necessary, with the run function intended to sugar the usage of functions stored this way. flatmap, map, join, and lift are also provided in order to be used with the IO Thunk or with any other potentially impure functions to be executed in the Monad's context. It's mostly bare bones other than that besides readstr to read from a UNIX file descriptor and strput to write a string to STDOUT.
Dependencies
Enso doesn't depend on anything but the Nim language itself. As such, Enso is meant to be a batteries not included library that provides niceties to make Functional Programming a little quicker, or at least I tell myself that as I really just designed this out of sheer curiosity.
Why should I use Enso?
The short answer, you shouldn't unless you are insane like I am.
The long answer is that maybe you're a lot like me and want to better understand how Functional Programming works under the hood for some reason, and you want to tinker around with building the systems yourself too. I also built Enso because the only Monad library I found for Nim is practically abandoned, and I was psychotic enough to start a project with an associate where we decided to use Functional Programming for it, but we had no good systems to use for IO that added a few bells and whistles for us. For all I know, Enso may get new code should we need more. I don't quite know yet.
If you like Enso, great. If you don't like Enso, great.