Safe Haskell | None |
---|
This module is used for defining new types of rules for Shake build systems. Most users will find the built-in set of rules sufficient.
- type ShakeValue a = (Show a, Typeable a, Eq a, Hashable a, Binary a, NFData a)
- class (ShakeValue key, ShakeValue value) => Rule key value where
- storedValue :: ShakeOptions -> key -> IO (Maybe value)
- equalValue :: ShakeOptions -> key -> value -> value -> EqualCost
- data EqualCost
- = EqualCheap
- | EqualExpensive
- | NotEqual
- rule :: Rule key value => (key -> Maybe (Action value)) -> Rules ()
- apply :: Rule key value => [key] -> Action [value]
- apply1 :: Rule key value => key -> Action value
- trackUse :: ShakeValue key => key -> Action ()
- trackChange :: ShakeValue key => key -> Action ()
- trackAllow :: ShakeValue key => (key -> Bool) -> Action ()
- defaultRule :: Rule key value => (key -> Maybe (Action value)) -> Rules ()
Documentation
type ShakeValue a = (Show a, Typeable a, Eq a, Hashable a, Binary a, NFData a)Source
Define an alias for the six type classes required for things involved in Shake Rule
s.
This alias is only available in GHC 7.4 and above, and requires the ConstraintKinds
extension.
To define your own values meeting the necessary constraints it is convenient to use the extensions
GeneralizedNewtypeDeriving
and DeriveDataTypeable
to write:
newtype MyType = MyType (String, Bool) deriving (Show,Typeable,Eq,Hashable,Binary,NFData)
class (ShakeValue key, ShakeValue value) => Rule key value whereSource
Define a pair of types that can be used by Shake rules. To import all the type classes required see Development.Shake.Classes.
storedValue :: ShakeOptions -> key -> IO (Maybe value)Source
[Required] Retrieve the value
associated with a key
, if available.
As an example for filenames/timestamps, if the file exists you should return Just
the timestamp, but otherwise return Nothing
. For rules whose values are not
stored externally, storedValue
should return Nothing
.
equalValue :: ShakeOptions -> key -> value -> value -> EqualCostSource
[Optional] Equality check, with a notion of how expensive the check was.
An equality check and a cost.
EqualCheap | The equality check was cheap. |
EqualExpensive | The equality check was expensive, as the results are not trivially equal. |
NotEqual | The values are not equal. |
trackUse :: ShakeValue key => key -> Action ()Source
Track that a key has been used by the action preceeding it.
trackChange :: ShakeValue key => key -> Action ()Source
Track that a key has been changed by the action preceeding it.
trackAllow :: ShakeValue key => (key -> Bool) -> Action ()Source
Allow any matching key to violate the tracking rules.