Created
April 5, 2011 12:56
-
-
Save paolino/903541 to your computer and use it in GitHub Desktop.
Pure interface for hakyll dependency analysis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Manager where | |
-- | Yielded values from a manager. The constructor tagging mark the item for the client to act accordingly | |
data Yield a | |
= Uptodate a -- ^ this item is uptodate | |
| Unlink a -- ^ this item must be eliminated | |
| Build a -- ^ this item must be built | |
| Empty -- ^ the manager has no item to manage | |
-- | Create method. Index and value associated is given along dependency logic and existential dependency, if present. | |
type Create b a | |
= b -- ^ index for the item | |
-> a -- ^ new item | |
-> (b -> Bool)-- ^ mask for dependencies | |
-> Maybe b -- ^ existence dependence | |
-> Manager b a | |
-- | All items indexed as the argument and all existential dependants will be marked to yield an Unlink | |
type Delete b a | |
= b -- ^ index to be deleted | |
-> Manager b a | |
-- | All items indexed as the argument and their logical dependants will be marked to yield a Build. All items existentially depending on the touched items will be marked as Unlink | |
type Touch b a | |
= b -- ^ index to be touched | |
-> Manager b a | |
-- | next programmed operation along the updated manager considering the yielded value | |
type Step b a = (Yield a, Manager b a) | |
-- | Abstract Manager object. A bunch of closures over the internal structure. | |
data Manager b a = Manager | |
{ create :: Create b a | |
, delete :: Delete b a | |
, touch :: Touch b a | |
, step :: Step b a | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment