New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to "dirty" a forward-defined rule inside of cacheAction
#734
Comments
cacheAction
rulescacheAction
The Forward stuff is definitely undocumented! It's also poorly understood - I think there is a paper to be written on forward build systems, but we haven't figured out what it contains yet, or what idiomatic looks like! Thanks for your investigations. As to your immediate problems, the two things I can think of are:
|
In this case I can likely get away with rebuilding tags every time, so this isn't a "critical" problem (I'll survive 😄 ). But it would be nice to understand how this works a little better, and there are certain transformations that could be a bit more time intensive. I gave the To clarify, If I have a tag: Make sense? I suspect a workaround would be to write out each tag to a file, then Something like a E.g. (in pseudo-code) rerunOnValueChange name val action = do
writeFile' ("cache" </> name) (toBinary val)
cacheAction name $ need ("cache" </> name) *> action |
I just pushed |
Hi! I've been running shake's forward mode as the primary mode for slick and it's been working pretty well!
I'm still a little confused by
cacheAction
(not a lot of documentation yet), but I think I've got the gist of it; please correct me if I'm wrong about the following assumptions.So far as I can tell it runs the action once and associates any "needed" files with that key, so it'll only re-run on subsequent executions if any "needed" files have changed.
The part I don't understand, is how this interacts with pieces I'm feeding in from earlier actions. This is likely best explained with a simple example:
This mostly works well! The problem is that
writeTags
uses the list of tags as its entire input, the writing of each tag "depends" on only the tag object itself, it doesn't read any files, and therefore doesn't "need" anything. Ideally it would rebuild a tag when its "object" changes (perhaps detected via checksum or binary representation)I used to implement this sort of thing with oracles in older versions of slick, but this seems considerably more awkward in the forward feeding style. Is it considered bad practice to compute the
md5
and just use that as part of thecacheAction
key so it rebuilds on changes? Curious what the "idiomatic" approach is here 😄It seems like it would be nice to have either a
makeDirty <key>
action so I can manually dirty tags, or even better: the option to provide a value argument tocacheAction
which will force a re-run of the action if the provided argument value changes.Love using
shake
, it makes building my site pretty easy, cheers!The text was updated successfully, but these errors were encountered: