| Copyright | (c) 2023 Bodigrim |
|---|---|
| License | BSD-3-Clause |
| Safe Haskell | None |
| Language | GHC2021 |
Distribution.Client.Add
Description
Building blocks of cabal-add executable.
Synopsis
- parseCabalFile :: MonadError String m => FilePath -> ByteString -> m ([Field Position], GenericPackageDescription)
- resolveComponent :: MonadError String m => FilePath -> ([Field a], GenericPackageDescription) -> Maybe String -> m (Either CommonStanza ComponentName)
- newtype CommonStanza = CommonStanza {}
- validateDependency :: MonadError String m => CabalSpecVersion -> String -> m ByteString
- data AddConfig = AddConfig {}
- executeAddConfig :: (Either CommonStanza ComponentName -> ByteString -> Bool) -> AddConfig -> Maybe ByteString
- validateChanges :: GenericPackageDescription -> Either CommonStanza ComponentName -> ByteString -> Bool
- data TargetField
Documentation
Arguments
| :: MonadError String m | |
| => FilePath | File name, just for error reporting. |
| -> ByteString | Contents of the Cabal file. |
| -> m ([Field Position], GenericPackageDescription) | Parsed data, suitable for |
Parse Cabal file into two representations.
Arguments
| :: MonadError String m | |
| => FilePath | File name, just for error reporting. |
| -> ([Field a], GenericPackageDescription) | Parsed Cabal file, as returned by |
| -> Maybe String | Component name (or default component if |
| -> m (Either CommonStanza ComponentName) | Resolved component. |
Resolve a raw component name.
newtype CommonStanza Source #
Just a newtype wrapper, since Cabal-syntax does not provide any.
Constructors
| CommonStanza | |
Fields | |
Instances
| Show CommonStanza Source # | |
Defined in Distribution.Client.Common Methods showsPrec :: Int -> CommonStanza -> ShowS # show :: CommonStanza -> String # showList :: [CommonStanza] -> ShowS # | |
| Eq CommonStanza Source # | |
Defined in Distribution.Client.Common | |
| Ord CommonStanza Source # | |
Defined in Distribution.Client.Common Methods compare :: CommonStanza -> CommonStanza -> Ordering # (<) :: CommonStanza -> CommonStanza -> Bool # (<=) :: CommonStanza -> CommonStanza -> Bool # (>) :: CommonStanza -> CommonStanza -> Bool # (>=) :: CommonStanza -> CommonStanza -> Bool # max :: CommonStanza -> CommonStanza -> CommonStanza # min :: CommonStanza -> CommonStanza -> CommonStanza # | |
Arguments
| :: MonadError String m | |
| => CabalSpecVersion | Cabal format version to adhere to. |
| -> String | Raw dependency to add. |
| -> m ByteString | Validated dependency as |
Validate dependency syntax, checking whether Cabal would be able to parse it.
An input for executeAddConfig.
Constructors
| AddConfig | |
Fields
| |
Arguments
| :: (Either CommonStanza ComponentName -> ByteString -> Bool) | How to validate results? See |
| -> AddConfig | Input arguments. |
| -> Maybe ByteString | Updated contents, if validated successfully. |
The main workhorse, adding fields to a specified component in the Cabal file.
Arguments
| :: GenericPackageDescription | Original package description. |
| -> Either CommonStanza ComponentName | Which component was supposed to be updated?
Usually constructed by |
| -> ByteString | Updated Cabal file. |
| -> Bool | Was the update successful? |
Validate that updates did not cause unexpected effects on other sections of the Cabal file.
data TargetField Source #
A field in a cabal file, new content can be added to
Constructors
| BuildDepends | Corresponds to |
| ExposedModules | Corresponds to |
| OtherModules | Corresponds to |
Instances
| Show TargetField Source # | |
Defined in Distribution.Client.Common Methods showsPrec :: Int -> TargetField -> ShowS # show :: TargetField -> String # showList :: [TargetField] -> ShowS # | |
| Eq TargetField Source # | |
Defined in Distribution.Client.Common | |
| Ord TargetField Source # | |
Defined in Distribution.Client.Common Methods compare :: TargetField -> TargetField -> Ordering # (<) :: TargetField -> TargetField -> Bool # (<=) :: TargetField -> TargetField -> Bool # (>) :: TargetField -> TargetField -> Bool # (>=) :: TargetField -> TargetField -> Bool # max :: TargetField -> TargetField -> TargetField # min :: TargetField -> TargetField -> TargetField # | |