-- | Set all 'file' actions to automatically take 'NonFatal'.
alwaysNonFatal :: Action () -> Action ()
alwaysNonFatal act = do
    (xs, _) <- capture act
    mapM_ emit $ transformBi f xs
    where
        f (File x) = File x{fileNonFatal=True}
        f x = x


-- | The type of expressions - namely an 'Action' producing a 'Value'. There are instances
--   for 'Num' and 'IsString', and turning on @{-\# LANGUAGE OverloadedStrings \#-}@ is
--   strongly recommended.
--
--   The 'fromString' function converts any embedded @$VAR@ into a variable lookup, which may refer to one of
--   the builtin NSIS variables (e.g. @$SMPROGRAMS@, @$TEMP@, @$PROGRAMFILES@), or a named variable
--   created with 'constant' or 'mutable'. The string @$$@ is used to escape @$@ values.
--   Bracket the variables to put text characters afterwards (e.g. @$(SMPROGRAMS)XXX@). In contrast
--   to standard strings, @\/@ is treated as @\\@ and @\/\/@ is treated as @\/@. Remember to escape any
--   slashes occuring in URLs.
--
--   If the string is @'Exp' 'String'@ then any 'Int' variables used will be automatically shown (see 'strShow').
--   If the string is @'Exp' ty@ then it must be of the form @\"$VAR\"@ where @$VAR@ is a variable of type @ty@.
--
--   The 'Eq' and 'Ord' instances for 'Exp' throw errors for all comparisons (use '%==', '%<=' etc),
--   but 'min' and 'max' are defined. The 'Num' (arithmetic) and 'Monoid' (string concatenation) instances are both
--   fully implemented. From 'Integral' and 'Fractional', only '/', 'mod' and 'div' are implemented, and
--   all as integer arithmetic. No functions from 'Enum' or 'Real' are implemented.
--
--   When using a single expression multiple times, to ensure it is not evaluated
--   repeatedly, use 'share'.
alwaysNonFatal :: Action () -> Action ()
alwaysNonFatal act = do
    (xs, _) <- capture act
    mapM_ emit $ transformBi f xs
    where
        f (File x) = File x{fileNonFatal=True}
        f x = x


-- | The type of expressions - namely an 'Action' producing a 'Value'. There are instances
--   for 'Num' and 'IsString', and turning on @{-\# LANGUAGE OverloadedStrings \#-}@ is
--   strongly recommended.
--
--   The 'fromString' function converts any embedded @$VAR@ into a variable lookup, which may refer to one of
--   the builtin NSIS variables (e.g. @$SMPROGRAMS@, @$TEMP@, @$PROGRAMFILES@), or a named variable
--   created with 'constant' or 'mutable'. The string @$$@ is used to escape @$@ values.
--   Bracket the variables to put text characters afterwards (e.g. @$(SMPROGRAMS)XXX@). In contrast
--   to standard strings, @\/@ is treated as @\\@ and @\/\/@ is treated as @\/@. Remember to escape any
--   slashes occuring in URLs.
--
--   If the string is @'Exp' 'String'@ then any 'Int' variables used will be automatically shown (see 'strShow').
--   If the string is @'Exp' ty@ then it must be of the form @\"$VAR\"@ where @$VAR@ is a variable of type @ty@.
--
--   The 'Eq' and 'Ord' instances for 'Exp' throw errors for all comparisons (use '%==', '%<=' etc),
--   but 'min' and 'max' are defined. The 'Num' (arithmetic) and 'Monoid' (string concatenation) instances are both
--   fully implemented. From 'Integral' and 'Fractional', only '/', 'mod' and 'div' are implemented, and
--   all as integer arithmetic. No functions from 'Enum' or 'Real' are implemented.
--
--   When using a single expression multiple times, to ensure it is not evaluated
--   repeatedly, use 'share'.
alwaysNonFatal act = do
    (xs, _) <- capture act
    mapM_ emit $ transformBi f xs
    where
        f (File x) = File x{fileNonFatal=True}
        f x = x


-- | The type of expressions - namely an 'Action' producing a 'Value'. There are instances
--   for 'Num' and 'IsString', and turning on @{-\# LANGUAGE OverloadedStrings \#-}@ is
--   strongly recommended.
--
--   The 'fromString' function converts any embedded @$VAR@ into a variable lookup, which may refer to one of
--   the builtin NSIS variables (e.g. @$SMPROGRAMS@, @$TEMP@, @$PROGRAMFILES@), or a named variable
--   created with 'constant' or 'mutable'. The string @$$@ is used to escape @$@ values.
--   Bracket the variables to put text characters afterwards (e.g. @$(SMPROGRAMS)XXX@). In contrast
--   to standard strings, @\/@ is treated as @\\@ and @\/\/@ is treated as @\/@. Remember to escape any
--   slashes occuring in URLs.
--
--   If the string is @'Exp' 'String'@ then any 'Int' variables used will be automatically shown (see 'strShow').
--   If the string is @'Exp' ty@ then it must be of the form @\"$VAR\"@ where @$VAR@ is a variable of type @ty@.
--
--   The 'Eq' and 'Ord' instances for 'Exp' throw errors for all comparisons (use '%==', '%<=' etc),
--   but 'min' and 'max' are defined. The 'Num' (arithmetic) and 'Monoid' (string concatenation) instances are both
--   fully implemented. From 'Integral' and 'Fractional', only '/', 'mod' and 'div' are implemented, and
--   all as integer arithmetic. No functions from 'Enum' or 'Real' are implemented.
--
--   When using a single expression multiple times, to ensure it is not evaluated
--   repeatedly, use 'share'.