build-env-1.2.0.0: Compute, fetch and install Cabal build plans into a local environment
Safe HaskellSafe-Inferred
LanguageHaskell2010

BuildEnv.CabalPlan

Description

This module parses the plan.json Cabal plan files that are created by cabal-install.

In the future, we hope to avoid doing this, and directly invoke Cabal's solver to obtain the build plan, instead of invoking cabal-install build --dry-run and parsing the resulting plan.json file.

Synopsis

Build plans

newtype CabalPlan Source #

Units in a Cabal plan.json file.

Constructors

CabalPlan 

Fields

Instances

Instances details
FromJSON CabalPlan Source # 
Instance details

Defined in BuildEnv.CabalPlan

Show CabalPlan Source # 
Instance details

Defined in BuildEnv.CabalPlan

newtype CabalPlanBinary Source #

Binary data underlying a cabal plan.json file.

Packages

newtype PkgName Source #

A cabal package name, e.g. lens, aeson.

Constructors

PkgName 

Fields

Instances

Instances details
FromJSON PkgName Source # 
Instance details

Defined in BuildEnv.CabalPlan

FromJSONKey PkgName Source # 
Instance details

Defined in BuildEnv.CabalPlan

Show PkgName Source # 
Instance details

Defined in BuildEnv.CabalPlan

Eq PkgName Source # 
Instance details

Defined in BuildEnv.CabalPlan

Methods

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

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

Ord PkgName Source # 
Instance details

Defined in BuildEnv.CabalPlan

pkgNameVersion :: PkgName -> Version -> Text Source #

The name-version string of a package.

validPackageName :: Text -> Bool Source #

Is the string a valid cabal package name? That is, does it consist only of alphanumeric identifiers and hyphens?

mangledPkgName :: PkgName -> String Source #

A Cabal mangled package name, in which - has been replaced with _.

Allow-newer

newtype AllowNewer Source #

A collection of allow-newer specifications, e.g. pkg1:pkg2,*:base.

Constructors

AllowNewer (Set (Text, Text)) 

Package specification

type PkgSpecs = Map PkgName PkgSpec Source #

A mapping from a package name to its flags and constraints.

data PkgSpec Source #

Constraints and flags for a package.

Constructors

PkgSpec 

Instances

Instances details
Semigroup PkgSpec Source # 
Instance details

Defined in BuildEnv.CabalPlan

Show PkgSpec Source # 
Instance details

Defined in BuildEnv.CabalPlan

emptyPkgSpec :: PkgSpec Source #

No flags or constraints on a package.

parsePkgSpec :: Text -> PkgSpec Source #

Parse flags and constraints (in that order).

unionPkgSpecsOverriding :: PkgSpecs -> PkgSpecs -> PkgSpecs Source #

Left-biased union of two sets of packages, overriding flags and constraints of the second argument with those provided in the first argument.

Package constraints

newtype Constraints Source #

A collection of cabal constraints, e.g. >= 3.2 && < 3.4, in raw textual format.

Constructors

Constraints Text 

Instances

Instances details
Semigroup Constraints Source #

Combine two constraints using &&.

Instance details

Defined in BuildEnv.CabalPlan

Show Constraints Source # 
Instance details

Defined in BuildEnv.CabalPlan

Package flags

newtype FlagSpec Source #

Specification of package flags, e.g. +foo -bar.

+ corresponds to True and - to False.

Constructors

FlagSpec (Map Text Bool) 

Package source location

data PkgSrc Source #

The source location of a package.

  • Nothing: it's in the package database (e.g. Hackage).
  • Just fp: specified by the cabal file at the given path.

Constructors

Remote 
Local !(SymbolicPath Project (Dir Pkg)) 

Instances

Instances details
FromJSON PkgSrc Source # 
Instance details

Defined in BuildEnv.CabalPlan

Monoid PkgSrc Source # 
Instance details

Defined in BuildEnv.CabalPlan

Semigroup PkgSrc Source # 
Instance details

Defined in BuildEnv.CabalPlan

Show PkgSrc Source # 
Instance details

Defined in BuildEnv.CabalPlan

Units

Units

newtype UnitId Source #

A unique identifier for a unit, e.g. lens-5.2-1bfd85cb66d2330e59a2f957e87cac993d922401.

Constructors

UnitId 

Fields

Instances

Instances details
FromJSON UnitId Source # 
Instance details

Defined in BuildEnv.CabalPlan

FromJSONKey UnitId Source # 
Instance details

Defined in BuildEnv.CabalPlan

Show UnitId Source # 
Instance details

Defined in BuildEnv.CabalPlan

Eq UnitId Source # 
Instance details

Defined in BuildEnv.CabalPlan

Methods

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

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

Ord UnitId Source # 
Instance details

Defined in BuildEnv.CabalPlan

data PreexistingUnit Source #

Information about a built-in pre-existing unit (such as base).

Constructors

PreexistingUnit 

Instances

Instances details
Show PreexistingUnit Source # 
Instance details

Defined in BuildEnv.CabalPlan

data ConfiguredUnit Source #

Information about a unit: name, version, dependencies, flags.

Instances

Instances details
Show ConfiguredUnit Source # 
Instance details

Defined in BuildEnv.CabalPlan

cuComponentType :: ConfiguredUnit -> ComponentType Source #

Get what kind of component this unit is: lib, exe, etc.

allDepends :: ConfiguredUnit -> [UnitId] Source #

All the dependencies of a unit: depends, exe-depends and setup-depends.

unitDepends :: ConfiguredUnit -> [UnitId] Source #

The dependencies of a unit, excluding setup-depends.

Units within a package

type UnitSpecs = Map PkgName (PkgSrc, PkgSpec, Set ComponentName) Source #

A mapping from a package name to its flags, constraints, and components we want to build from it.

unionUnitSpecsCombining :: UnitSpecs -> UnitSpecs -> UnitSpecs Source #

Combine two UnitSpecs. Combines constraints and flags.

Components

data ComponentName Source #

The name of a cabal component, e.g. lib:comp.

Constructors

ComponentName 

Fields

cabalComponent :: ComponentName -> Text Source #

Print a cabal component using colon syntax ty:comp.

parsePkgComponent :: Text -> Maybe (PkgName, ComponentName) Source #

Parse a cabal package component, using the syntax pkg:ty:comp, e.g. attoparsec:lib:attoparsec-internal.

data ComponentType Source #

The type of a component, e.g. library, executable, test-suite...

Constructors

Lib 
FLib 
Exe 
Test 
Bench 
Setup 

cabalComponentType :: ComponentType -> Text Source #

Print the cabal component type as expected in cabal colon syntax pkg:ty:comp.

parseComponentType :: Text -> Maybe ComponentType Source #

Parse the type of a cabal component, e.g library, executable, etc.