Hello, I’ve released (my first) Library in Haskell on hackage:
clplug
It works quite well but there are a few things about the interface that make using it seem a bit awkward and I was hoping to get some suggestions to make it better.
Specifically right now the user creates a function within the PluginMonad:
type PluginMonad a = ReaderT Plug (StateT a IO)
Within that monad you have access to other functions defined with access to the plug reader and you have access to the polymorphic state you define, but it seems like it forces too much. What if you want more environment variables? It seems like the second Monad, StateT within the reader, could be fully general, I’ve seen other libraries (Servant) use the concept of hoisting, but given how I created the plugin function (Control/Plugin) I can’t quite understand how I would initialize the Conduit (runPlugin | line27) within a polymorphic monad.
Another thing is when I have been using it I have been using ViewPatterns:
Just (Res (fromJSON -> Success funds@(Funds{}) ) _) <- lightningCli listfunds
But I am unsure as to what would happen (it never does in practice) if the pattern match failed or if/how it is possible to define specify that. Sometimes nothing happening is fine but other times a response is required.
If you take some time to read through the library any have any comments about form or function that come to mind, they would be much appreciated. I’ve created a few plugins (executable projects created using the library) that may be useful to see how it is used but I can only link one : Summarize Some Info