Copyright | (c) 2023 Bodigrim |
---|---|
License | BSD-3-Clause |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Building blocks of cabal-add
executable,
probably not terribly useful on their own.
Synopsis
- newtype CommonStanza = CommonStanza {}
- data Config = Config {}
- parseCabalFile ∷ MonadError String m ⇒ FilePath → ByteString → m ([Field Position], GenericPackageDescription)
- resolveComponent ∷ MonadError String m ⇒ FilePath → ([Field Position], GenericPackageDescription) → Maybe String → m (Either CommonStanza ComponentName)
- validateDependency ∷ MonadError String m ⇒ String → m ByteString
- executeConfig ∷ (Either CommonStanza ComponentName → ByteString → Bool) → Config → Maybe ByteString
- validateChanges ∷ GenericPackageDescription → Either CommonStanza ComponentName → ByteString → Bool
Documentation
newtype CommonStanza Source #
Just a newtype wrapper, since Cabal-syntax
does not provide any.
Instances
Show CommonStanza Source # | |
Defined in Distribution.Client.Add showsPrec ∷ Int → CommonStanza → ShowS # show ∷ CommonStanza → String # showList ∷ [CommonStanza] → ShowS # | |
Eq CommonStanza Source # | |
Defined in Distribution.Client.Add (==) ∷ CommonStanza → CommonStanza → Bool # (/=) ∷ CommonStanza → CommonStanza → Bool # | |
Ord CommonStanza Source # | |
Defined in Distribution.Client.Add compare ∷ CommonStanza → CommonStanza → Ordering # (<) ∷ CommonStanza → CommonStanza → Bool # (<=) ∷ CommonStanza → CommonStanza → Bool # (>) ∷ CommonStanza → CommonStanza → Bool # (>=) ∷ CommonStanza → CommonStanza → Bool # max ∷ CommonStanza → CommonStanza → CommonStanza # min ∷ CommonStanza → CommonStanza → CommonStanza # |
An input for executeConfig
.
Config | |
|
∷ MonadError String m | |
⇒ FilePath | File name, just for error reporting. |
→ ByteString | Contents of the Cabal file. |
→ m ([Field Position], GenericPackageDescription) | Parsed data. |
Parse Cabal file into two representations.
∷ MonadError String m | |
⇒ FilePath | File name, just for error reporting. |
→ ([Field Position], GenericPackageDescription) | Parsed Cabal file, as returned by |
→ Maybe String | Component name (default component if |
→ m (Either CommonStanza ComponentName) | Resolved component. |
Resolve a raw component name.
∷ MonadError String m | |
⇒ String | Raw dependency to add. |
→ m ByteString | Dependency as |
Validate dependency syntax.
∷ (Either CommonStanza ComponentName → ByteString → Bool) | How to validate results? See |
→ Config | Input arguments. |
→ Maybe ByteString | Updated contents, if validated successfully. |
Main work horse of the module, adding dependencies to a specified component in the Cabal file.
∷ GenericPackageDescription | Original package description. |
→ Either CommonStanza ComponentName | Which component was supposed to be updated? |
→ ByteString | Update Cabal file. |
→ Bool | Was the update successful? |
Validate that updates did not cause unexpected effects on other sections of the Cabal file.