In Shake there is a way to run an Action from Rules:
action :: Action a -> Rules ()
But I couldn't find a function which returns the result of the Action, namely:
actionWithResult :: Action a -> Rules a
How come?
In Shake there is a way to run an Action from Rules:
action :: Action a -> Rules ()
But I couldn't find a function which returns the result of the Action, namely:
actionWithResult :: Action a -> Rules a
How come?
The reason is that
Rulesis run first, to completion, and thenActions are run - so it's somewhat staged programming. Allactiondoes is records anAction, to execute later. The reason you have to run all theRulesfirst is so that it can collect all the possible types of rule that are available, since they're all available for allActions.Once you understand the staging, it's impossible to have
Action a -> Rules a, because that implies running anActionand returning the result toRules, soActionmust run beforeRulescompletes. However,Actions a -> Rules ()is fine, because it doesn't actually run then, but later.