cabal-add-0.1: Extend build-depends from the command line
Copyright(c) 2023 Bodigrim
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageGHC2021

Distribution.Client.Add

Description

Building blocks of cabal-add executable, probably not terribly useful on their own.

Synopsis

Documentation

newtype CommonStanza Source #

Just a newtype wrapper, since Cabal-syntax does not provide any.

Constructors

CommonStanza 

data Config Source #

An input for executeConfig.

Constructors

Config 

Fields

Instances

Instances details
Show Config Source # 
Instance details

Defined in Distribution.Client.Add

Methods

showsPrecIntConfigShowS #

showConfigString #

showList ∷ [Config] → ShowS #

Eq Config Source # 
Instance details

Defined in Distribution.Client.Add

Methods

(==)ConfigConfigBool #

(/=)ConfigConfigBool #

parseCabalFile Source #

Arguments

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.

resolveComponent Source #

Arguments

MonadError String m 
FilePath

File name, just for error reporting.

→ ([Field Position], GenericPackageDescription)

Parsed Cabal file, as returned by parseCabalFile.

Maybe String

Component name (default component if Nothing).

→ m (Either CommonStanza ComponentName)

Resolved component.

Resolve a raw component name.

validateDependency Source #

Arguments

MonadError String m 
String

Raw dependency to add.

→ m ByteString

Dependency as ByteString.

Validate dependency syntax.

executeConfig Source #

Arguments

∷ (Either CommonStanza ComponentNameByteStringBool)

How to validate results? See validateChanges.

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.

validateChanges Source #

Arguments

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.