Cabal
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Simple.SetupHooks.Rule

Description

Internal module that defines fine-grained rules for setup hooks. Users should import SetupHooks instead.

Synopsis

Rules

Rule

data RuleData (scope :: Scope) Source #

A rule consists of:

  • an action to run to execute the rule,
  • a description of the rule inputs and outputs.

Use staticRule or dynamicRule to construct a rule, overriding specific fields, rather than directly using the Rule constructor.

Constructors

Rule

Please use the staticRule or dynamicRule smart constructors instead of this constructor, in order to avoid relying on internal implementation details.

Fields

Instances

Instances details
Show RuleBinary Source #

Trimmed down Show instance, mostly for error messages.

Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Generic (RuleData scope) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Associated Types

type Rep (RuleData scope) :: Type -> Type #

Methods

from :: RuleData scope -> Rep (RuleData scope) x #

to :: Rep (RuleData scope) x -> RuleData scope #

Show (RuleData 'User) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Binary (RuleData 'System) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Binary (RuleData 'User) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: RuleData 'User -> Put #

get :: Get (RuleData 'User) #

putList :: [RuleData 'User] -> Put #

Eq (RuleData 'System) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Eq (RuleData 'User) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep (RuleData scope) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep (RuleData scope) = D1 ('MetaData "RuleData" "Distribution.Simple.SetupHooks.Rule" "Cabal-3.14.0.0-inplace" 'False) (C1 ('MetaCons "Rule" 'PrefixI 'True) (S1 ('MetaSel ('Just "ruleCommands") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (RuleCmds scope)) :*: (S1 ('MetaSel ('Just "staticDependencies") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [Dependency]) :*: S1 ('MetaSel ('Just "results") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (NonEmpty Location)))))

data RuleId Source #

A unique identifier for a Rule.

Constructors

RuleId 

Fields

Instances

Instances details
Structured RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

structure :: Proxy RuleId -> Structure

structureHash' :: Tagged RuleId MD5

Generic RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Associated Types

type Rep RuleId :: Type -> Type #

Methods

from :: RuleId -> Rep RuleId x #

to :: Rep RuleId x -> RuleId #

Show RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Binary RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: RuleId -> Put #

get :: Get RuleId #

putList :: [RuleId] -> Put #

Eq RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: RuleId -> RuleId -> Bool #

(/=) :: RuleId -> RuleId -> Bool #

Ord RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep RuleId Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep RuleId

staticRule :: forall arg. Typeable arg => Command arg (IO ()) -> [Dependency] -> NonEmpty Location -> Rule Source #

A rule with static dependencies.

Prefer using this smart constructor instead of Rule whenever possible.

dynamicRule :: forall depsArg depsRes arg. (Typeable depsArg, Typeable depsRes, Typeable arg) => StaticPtr (Dict (Binary depsRes, Show depsRes, Eq depsRes)) -> Command depsArg (IO ([Dependency], depsRes)) -> Command arg (depsRes -> IO ()) -> [Dependency] -> NonEmpty Location -> Rule Source #

A rule with dynamic dependencies.

Prefer using this smart constructor instead of Rule whenever possible.

Commands

data RuleCommands (scope :: Scope) (deps :: Scope -> Type -> Type -> Type) (ruleCmd :: Scope -> Type -> Type -> Type) where Source #

Commands to execute a rule:

  • for a rule with static dependencies, a single command,
  • for a rule with dynamic dependencies, a command for computing dynamic dependencies, and a command for executing the rule.

Constructors

StaticRuleCommand

A rule with statically-known dependencies.

Fields

DynamicRuleCommands 

Fields

  • :: forall depsArg depsRes arg deps ruleCmd scope. If (scope == System) (depsArg ~ ByteString, depsRes ~ ByteString, arg ~ ByteString) (() :: Constraint)
     
  • => { dynamicRuleInstances :: !(Static scope (Dict (Binary depsRes, Show depsRes, Eq depsRes)))

    A rule with dynamic dependencies, which consists of two parts:

    • a dynamic dependency computation, that returns additional edges to be added to the build graph together with an additional piece of data,
    • the command to execute the rule itself, which receives the additional piece of data returned by the dependency computation.
  •    , dynamicDeps :: !(deps scope depsArg depsRes)

    A dynamic dependency computation. The resulting dependencies will be injected into the build graph, and the result of the computation will be passed on to the command that executes the rule.

  •    , dynamicRuleCommand :: !(ruleCmd scope arg (depsRes -> IO ()))

    The command to execute the rule. It will receive the result of the dynamic dependency computation.

  •    , dynamicRuleTypeRep :: !(If (scope == System) SomeTypeRep (TypeRep (depsArg, depsRes, arg)))

    A TypeRep for the triple (depsArg,depsRes,arg).

  •    } -> RuleCommands scope deps ruleCmd
     

Instances

Instances details
(forall arg res. Show (ruleCmd 'User arg res), forall depsArg depsRes. Show depsRes => Show (deps 'User depsArg depsRes)) => Show (RuleCommands 'User deps ruleCmd) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

showsPrec :: Int -> RuleCommands 'User deps ruleCmd -> ShowS #

show :: RuleCommands 'User deps ruleCmd -> String #

showList :: [RuleCommands 'User deps ruleCmd] -> ShowS #

(forall res. Binary (ruleCmd 'System ByteString res), Binary (deps 'System ByteString ByteString)) => Binary (RuleCommands 'System deps ruleCmd) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: RuleCommands 'System deps ruleCmd -> Put #

get :: Get (RuleCommands 'System deps ruleCmd) #

putList :: [RuleCommands 'System deps ruleCmd] -> Put #

(forall arg res. Binary (ruleCmd 'User arg res), forall depsArg depsRes. Binary depsRes => Binary (deps 'User depsArg depsRes)) => Binary (RuleCommands 'User deps ruleCmd) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: RuleCommands 'User deps ruleCmd -> Put #

get :: Get (RuleCommands 'User deps ruleCmd) #

putList :: [RuleCommands 'User deps ruleCmd] -> Put #

(forall res. Eq (ruleCmd 'System ByteString res), Eq (deps 'System ByteString ByteString)) => Eq (RuleCommands 'System deps ruleCmd) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: RuleCommands 'System deps ruleCmd -> RuleCommands 'System deps ruleCmd -> Bool #

(/=) :: RuleCommands 'System deps ruleCmd -> RuleCommands 'System deps ruleCmd -> Bool #

(forall arg res. Eq (ruleCmd 'User arg res), forall depsArg depsRes. Eq depsRes => Eq (deps 'User depsArg depsRes)) => Eq (RuleCommands 'User deps ruleCmd) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: RuleCommands 'User deps ruleCmd -> RuleCommands 'User deps ruleCmd -> Bool #

(/=) :: RuleCommands 'User deps ruleCmd -> RuleCommands 'User deps ruleCmd -> Bool #

type Command = CommandData User Source #

A command consists of a statically-known action together with a (possibly dynamic) argument to that action.

For example, the action can consist of running an executable (such as happy or c2hs), while the argument consists of the variable component of the command, e.g. the specific file to run happy on.

data CommandData (scope :: Scope) (arg :: Type) (res :: Type) Source #

Internal datatype used for commands, both for the Hooks API (Command) and for the build system.

Constructors

Command 

Fields

  • actionPtr :: !(Static scope (arg -> res))

    The (statically-known) action to execute.

  • actionArg :: !(ScopedArgument scope arg)

    The (possibly dynamic) argument to pass to the action.

  • cmdInstances :: !(Static scope (Dict (Binary arg, Show arg)))

    Static evidence that the argument can be serialised and deserialised.

Instances

Instances details
Show (CommandData 'User arg res) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

showsPrec :: Int -> CommandData 'User arg res -> ShowS #

show :: CommandData 'User arg res -> String #

showList :: [CommandData 'User arg res] -> ShowS #

arg ~ ByteString => Binary (CommandData 'System arg res) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: CommandData 'System arg res -> Put #

get :: Get (CommandData 'System arg res) #

putList :: [CommandData 'System arg res] -> Put #

Binary (CommandData 'User arg res) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: CommandData 'User arg res -> Put #

get :: Get (CommandData 'User arg res) #

putList :: [CommandData 'User arg res] -> Put #

arg ~ ByteString => Eq (CommandData 'System arg res) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: CommandData 'System arg res -> CommandData 'System arg res -> Bool #

(/=) :: CommandData 'System arg res -> CommandData 'System arg res -> Bool #

Eq (CommandData 'User arg res) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: CommandData 'User arg res -> CommandData 'User arg res -> Bool #

(/=) :: CommandData 'User arg res -> CommandData 'User arg res -> Bool #

runCommand :: Command args res -> res Source #

Run a Command.

mkCommand :: forall arg res. StaticPtr (Dict (Binary arg, Show arg)) -> StaticPtr (arg -> res) -> arg -> Command arg res Source #

Construct a command.

Prefer using this smart constructor instead of Command whenever possible.

data Dict c where Source #

A wrapper used to pass evidence of a constraint as an explicit value.

Constructors

Dict :: c => Dict c 

Helpers for executing commands

type RuleCmds scope = RuleCommands scope DynDepsCmd CommandData Source #

Both the rule command and the (optional) dynamic dependency command.

type RuleDynDepsCmd scope = RuleCommands scope DynDepsCmd NoCmd Source #

Only the (optional) dynamic dependency command.

type RuleExecCmd scope = RuleCommands scope DepsRes CommandData Source #

The rule command together with the result of the (optional) dynamic dependency computation.

newtype DynDepsCmd scope depsArg depsRes Source #

A dynamic dependency command.

Constructors

DynDepsCmd 

Fields

Instances

Instances details
Show (DynDepsCmd 'User depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

showsPrec :: Int -> DynDepsCmd 'User depsArg depsRes -> ShowS #

show :: DynDepsCmd 'User depsArg depsRes -> String #

showList :: [DynDepsCmd 'User depsArg depsRes] -> ShowS #

(arg ~ ByteString, depsRes ~ ByteString) => Binary (DynDepsCmd 'System arg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: DynDepsCmd 'System arg depsRes -> Put #

get :: Get (DynDepsCmd 'System arg depsRes) #

putList :: [DynDepsCmd 'System arg depsRes] -> Put #

Binary (DynDepsCmd 'User depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: DynDepsCmd 'User depsArg depsRes -> Put #

get :: Get (DynDepsCmd 'User depsArg depsRes) #

putList :: [DynDepsCmd 'User depsArg depsRes] -> Put #

(arg ~ ByteString, depsRes ~ ByteString) => Eq (DynDepsCmd 'System arg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: DynDepsCmd 'System arg depsRes -> DynDepsCmd 'System arg depsRes -> Bool #

(/=) :: DynDepsCmd 'System arg depsRes -> DynDepsCmd 'System arg depsRes -> Bool #

Eq (DynDepsCmd 'User depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: DynDepsCmd 'User depsArg depsRes -> DynDepsCmd 'User depsArg depsRes -> Bool #

(/=) :: DynDepsCmd 'User depsArg depsRes -> DynDepsCmd 'User depsArg depsRes -> Bool #

newtype DepsRes (scope :: Scope) depsArg depsRes Source #

The result of a dynamic dependency computation.

Constructors

DepsRes 

Fields

  • depsRes :: ScopedArgument scope depsRes
     

Instances

Instances details
Show depsRes => Show (DepsRes scope depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

showsPrec :: Int -> DepsRes scope depsArg depsRes -> ShowS #

show :: DepsRes scope depsArg depsRes -> String #

showList :: [DepsRes scope depsArg depsRes] -> ShowS #

Binary (ScopedArgument scope depsRes) => Binary (DepsRes scope depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: DepsRes scope depsArg depsRes -> Put #

get :: Get (DepsRes scope depsArg depsRes) #

putList :: [DepsRes scope depsArg depsRes] -> Put #

Eq depsRes => Eq (DepsRes scope depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Bool #

(/=) :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Bool #

Ord depsRes => Ord (DepsRes scope depsArg depsRes) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

compare :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Ordering #

(<) :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Bool #

(<=) :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Bool #

(>) :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Bool #

(>=) :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> Bool #

max :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes #

min :: DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes -> DepsRes scope depsArg depsRes #

ruleDepsCmd :: RuleCmds scope -> RuleDynDepsCmd scope Source #

Project out the (optional) dependency computation command, so that it can be serialised without serialising anything else.

runRuleDynDepsCmd :: RuleDynDepsCmd User -> Maybe (IO ([Dependency], ByteString)) Source #

Obtain the (optional) IO action that computes dynamic dependencies.

ruleExecCmd :: SScope scope -> RuleCmds scope -> Maybe ByteString -> RuleExecCmd scope Source #

Project out the command for running the rule, passing in the result of the dependency computation if there was one.

runRuleExecCmd :: RuleExecCmd User -> IO () Source #

Obtain the IO action that executes a rule.

Collections of rules

newtype Rules env Source #

A collection of Rules.

Use the rules smart constructor instead of directly using the Rules constructor.

  • Rules are registered using registerRule,
  • Monitored files or directories are declared using addRuleMonitors; a change in these will trigger the recomputation of all rules.

The env type parameter represents an extra argument, which usually consists of information known to Cabal such as LocalBuildInfo and ComponentLocalBuildInfo.

Constructors

Rules 

Fields

Instances

Instances details
Monoid (Rules env) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

mempty :: Rules env #

mappend :: Rules env -> Rules env -> Rules env #

mconcat :: [Rules env] -> Rules env #

Semigroup (Rules env) Source #

Warning: this Semigroup instance is not commutative.

Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(<>) :: Rules env -> Rules env -> Rules env #

sconcat :: NonEmpty (Rules env) -> Rules env #

stimes :: Integral b => b -> Rules env -> Rules env #

data Dependency Source #

A dependency of a rule.

Constructors

RuleDependency !RuleOutput

A dependency on an output of another rule.

FileDependency !Location

A direct dependency on a file at a particular location on disk.

This should not be used for files that are generated by other rules; use RuleDependency instead.

Instances

Instances details
Structured Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

structure :: Proxy Dependency -> Structure

structureHash' :: Tagged Dependency MD5

Generic Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Associated Types

type Rep Dependency :: Type -> Type #

Show Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Binary Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Eq Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Ord Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep Dependency Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep Dependency = D1 ('MetaData "Dependency" "Distribution.Simple.SetupHooks.Rule" "Cabal-3.14.0.0-inplace" 'False) (C1 ('MetaCons "RuleDependency" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RuleOutput)) :+: C1 ('MetaCons "FileDependency" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Location)))

data RuleOutput Source #

A reference to an output of another rule.

Constructors

RuleOutput 

Fields

Instances

Instances details
Structured RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

structure :: Proxy RuleOutput -> Structure

structureHash' :: Tagged RuleOutput MD5

Generic RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Associated Types

type Rep RuleOutput :: Type -> Type #

Show RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Binary RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Eq RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Ord RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep RuleOutput Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

type Rep RuleOutput = D1 ('MetaData "RuleOutput" "Distribution.Simple.SetupHooks.Rule" "Cabal-3.14.0.0-inplace" 'False) (C1 ('MetaCons "RuleOutput" 'PrefixI 'True) (S1 ('MetaSel ('Just "outputOfRule") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RuleId) :*: S1 ('MetaSel ('Just "outputIndex") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word)))

rules Source #

Arguments

:: StaticPtr label

unique label for this collection of rules

-> (env -> RulesM ())

the computation of rules

-> Rules env 

Construct a collection of rules with a given label.

A label for the rules can be constructed using the static keyword, using the StaticPointers extension. NB: separate calls to rules should have different labels.

Example usage:

myRules :: Rules env
myRules = rules (static ()) $ \ env -> do { .. } -- use the monadic API here

noRules :: RulesM () Source #

An empty collection of rules.

Rule inputs/outputs

data Location where Source #

A (fully resolved) location of a dependency or result of a rule, consisting of a base directory and of a file path relative to that base directory path.

In practice, this will be something like Location dir (moduleNameSymbolicPath mod . "hs"), where:

  • for a file dependency, dir is one of the Cabal search directories,
  • for an output, dir is a directory such as autogenComponentModulesDir or componentBuildDir.

Constructors

Location 

Fields

  • :: { locationBaseDir :: !(SymbolicPath Pkg (Dir baseDir))

    Base directory.

  •    , locationRelPath :: !(RelativePath baseDir File)

    File path relative to base directory (including file extension).

  •    } -> Location
     

Instances

Instances details
Structured Location Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

structure :: Proxy Location -> Structure

structureHash' :: Tagged Location MD5

Show Location Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Binary Location Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: Location -> Put #

get :: Get Location #

putList :: [Location] -> Put #

Eq Location Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Ord Location Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

location :: Location -> SymbolicPath Pkg File Source #

Get a (relative or absolute) un-interpreted path to a Location.

File/directory monitoring

data MonitorFilePath Source #

A description of a file (or set of files) to monitor for changes.

Where file paths are relative they are relative to a common directory (e.g. project root), not necessarily the process current directory.

Instances

Instances details
Structured MonitorFilePath Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Methods

structure :: Proxy MonitorFilePath -> Structure

structureHash' :: Tagged MonitorFilePath MD5

Generic MonitorFilePath Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Associated Types

type Rep MonitorFilePath :: Type -> Type #

Show MonitorFilePath Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Binary MonitorFilePath Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Eq MonitorFilePath Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

type Rep MonitorFilePath Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

type Rep MonitorFilePath = D1 ('MetaData "MonitorFilePath" "Distribution.Simple.FileMonitor.Types" "Cabal-3.14.0.0-inplace" 'False) (C1 ('MetaCons "MonitorFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "monitorKindFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindFile) :*: (S1 ('MetaSel ('Just "monitorKindDir") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindDir) :*: S1 ('MetaSel ('Just "monitorPath") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath))) :+: C1 ('MetaCons "MonitorFileGlob" 'PrefixI 'True) (S1 ('MetaSel ('Just "monitorKindFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindFile) :*: (S1 ('MetaSel ('Just "monitorKindDir") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindDir) :*: S1 ('MetaSel ('Just "monitorPathGlob") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RootedGlob))))

data MonitorKindFile Source #

Instances

Instances details
Structured MonitorKindFile Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Methods

structure :: Proxy MonitorKindFile -> Structure

structureHash' :: Tagged MonitorKindFile MD5

Generic MonitorKindFile Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Associated Types

type Rep MonitorKindFile :: Type -> Type #

Show MonitorKindFile Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Binary MonitorKindFile Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Eq MonitorKindFile Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

type Rep MonitorKindFile Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

type Rep MonitorKindFile = D1 ('MetaData "MonitorKindFile" "Distribution.Simple.FileMonitor.Types" "Cabal-3.14.0.0-inplace" 'False) ((C1 ('MetaCons "FileExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FileModTime" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FileHashed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FileNotExists" 'PrefixI 'False) (U1 :: Type -> Type)))

data MonitorKindDir Source #

Instances

Instances details
Structured MonitorKindDir Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Methods

structure :: Proxy MonitorKindDir -> Structure

structureHash' :: Tagged MonitorKindDir MD5

Generic MonitorKindDir Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Associated Types

type Rep MonitorKindDir :: Type -> Type #

Show MonitorKindDir Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Binary MonitorKindDir Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

Eq MonitorKindDir Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

type Rep MonitorKindDir Source # 
Instance details

Defined in Distribution.Simple.FileMonitor.Types

type Rep MonitorKindDir = D1 ('MetaData "MonitorKindDir" "Distribution.Simple.FileMonitor.Types" "Cabal-3.14.0.0-inplace" 'False) (C1 ('MetaCons "DirExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DirModTime" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DirNotExists" 'PrefixI 'False) (U1 :: Type -> Type)))

Monadic API for generation of ActionId

type RulesM a = RulesT IO a Source #

Monad for constructing rules.

newtype RulesT m a Source #

Monad transformer for defining rules. Usually wraps the IO monad, allowing IO actions to be performed using liftIO.

Instances

Instances details
MonadTrans RulesT Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

lift :: Monad m => m a -> RulesT m a #

MonadFix m => MonadFix (RulesT m) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

mfix :: (a -> RulesT m a) -> RulesT m a #

MonadIO m => MonadIO (RulesT m) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

liftIO :: IO a -> RulesT m a #

Monad m => Applicative (RulesT m) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

pure :: a -> RulesT m a #

(<*>) :: RulesT m (a -> b) -> RulesT m a -> RulesT m b #

liftA2 :: (a -> b -> c) -> RulesT m a -> RulesT m b -> RulesT m c #

(*>) :: RulesT m a -> RulesT m b -> RulesT m b #

(<*) :: RulesT m a -> RulesT m b -> RulesT m a #

Functor m => Functor (RulesT m) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

fmap :: (a -> b) -> RulesT m a -> RulesT m b #

(<$) :: a -> RulesT m b -> RulesT m a #

Monad m => Monad (RulesT m) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(>>=) :: RulesT m a -> (a -> RulesT m b) -> RulesT m b #

(>>) :: RulesT m a -> RulesT m b -> RulesT m b #

return :: a -> RulesT m a #

data RulesEnv Source #

The environment within the monadic API.

Constructors

RulesEnv 

Fields

computeRules :: Verbosity -> env -> Rules env -> IO (Map RuleId Rule, [MonitorFilePath]) Source #

Internal function: run the monadic Rules computations in order to obtain all the Rules with their RuleIds.

Internals

data Scope Source #

Rules are defined with rich types by the package.

The build system only has a limited view of these; most data consists of opaque ByteStrings.

The Scope data-type describes which side of this divide we are on.

Constructors

User

User space (with rich types).

System

Build-system space (manipulation of raw data).

data SScope (scope :: Scope) where Source #

Constructors

SUser :: SScope User 
SSystem :: SScope System 

data family Static (scope :: Scope) :: Type -> Type Source #

A static pointer (in user scope) or its key (in system scope).

Instances

Instances details
Show (Static 'System fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

showsPrec :: Int -> Static 'System fnTy -> ShowS #

show :: Static 'System fnTy -> String #

showList :: [Static 'System fnTy] -> ShowS #

Show (Static 'User fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

showsPrec :: Int -> Static 'User fnTy -> ShowS #

show :: Static 'User fnTy -> String #

showList :: [Static 'User fnTy] -> ShowS #

Binary (Static 'System fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: Static 'System fnTy -> Put #

get :: Get (Static 'System fnTy) #

putList :: [Static 'System fnTy] -> Put #

Binary (Static 'User fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

put :: Static 'User fnTy -> Put #

get :: Get (Static 'User fnTy) #

putList :: [Static 'User fnTy] -> Put #

Eq (Static 'System fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: Static 'System fnTy -> Static 'System fnTy -> Bool #

(/=) :: Static 'System fnTy -> Static 'System fnTy -> Bool #

Eq (Static 'User fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

(==) :: Static 'User fnTy -> Static 'User fnTy -> Bool #

(/=) :: Static 'User fnTy -> Static 'User fnTy -> Bool #

Ord (Static 'System fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

compare :: Static 'System fnTy -> Static 'System fnTy -> Ordering #

(<) :: Static 'System fnTy -> Static 'System fnTy -> Bool #

(<=) :: Static 'System fnTy -> Static 'System fnTy -> Bool #

(>) :: Static 'System fnTy -> Static 'System fnTy -> Bool #

(>=) :: Static 'System fnTy -> Static 'System fnTy -> Bool #

max :: Static 'System fnTy -> Static 'System fnTy -> Static 'System fnTy #

min :: Static 'System fnTy -> Static 'System fnTy -> Static 'System fnTy #

Ord (Static 'User fnTy) Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

Methods

compare :: Static 'User fnTy -> Static 'User fnTy -> Ordering #

(<) :: Static 'User fnTy -> Static 'User fnTy -> Bool #

(<=) :: Static 'User fnTy -> Static 'User fnTy -> Bool #

(>) :: Static 'User fnTy -> Static 'User fnTy -> Bool #

(>=) :: Static 'User fnTy -> Static 'User fnTy -> Bool #

max :: Static 'User fnTy -> Static 'User fnTy -> Static 'User fnTy #

min :: Static 'User fnTy -> Static 'User fnTy -> Static 'User fnTy #

newtype Static 'System fnTy Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

newtype Static 'User fnTy Source # 
Instance details

Defined in Distribution.Simple.SetupHooks.Rule

newtype Static 'User fnTy = UserStatic {}