hello,
I want to build an in-memory data-structure that tracks changes in
source files (think of something like an LSP server that tracks
changes in source code, builds some kind of data-structure and can then
answer questions about it). My current approach has shake writing the
data processed from a source file to a target file; when the program
is invoked it reads all target files, joins the data (they have a
Monoid instance), and returns something.
I want to make the program work like a server instead (so that I forgo
all the needless I/O), with shake being called to update an in-memory
data-structure. I can write empty target files to satisfy shake if
needed, and thought of using the State monad to modify the in-memory
data-structure; but I'm struggling with something related to
https://github.com/ndmitchell/shake/issues/572; couldn't shake's (the
function) signature be |Monoid a => ShakeOptions -> Rules a -> IO a|?
But I guess what I really want to know is the best way to do what I
want (i.e., using shake to update an in-memory datastructure)… Should
I be using IORef or …?
thank you,
-- bruno