cabal-helper-1.1.0.0: Give Haskell development tools access to Cabal project environment
LicenseApache-2.0
Maintainercabal-helper@dxld.at
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Distribution.Helper

Description

 
Synopsis

Type Variable Naming Conventions

Throughout the API we use the following conventions for type variables:

  • pt stands for "project type", when instantiated it is always of kind ProjType.
  • c stands for "cache". It is used internally to make the cache inaccessible for some parts of the implementation. Users of the API may completely ignore this parameter. See the internal qeCacheRef field accessor of QueryEnv for details.

Running Queries

data Query pt a Source #

A query against a package's Cabal configuration. Use runQuery to execute it.

Instances

Instances details
Monad (Query pt) Source # 
Instance details

Defined in Distribution.Helper

Methods

(>>=) :: Query pt a -> (a -> Query pt b) -> Query pt b

(>>) :: Query pt a -> Query pt b -> Query pt b

return :: a -> Query pt a

Functor (Query pt) Source # 
Instance details

Defined in Distribution.Helper

Methods

fmap :: (a -> b) -> Query pt a -> Query pt b

(<$) :: a -> Query pt b -> Query pt a

Applicative (Query pt) Source # 
Instance details

Defined in Distribution.Helper

Methods

pure :: a -> Query pt a

(<*>) :: Query pt (a -> b) -> Query pt a -> Query pt b

liftA2 :: (a -> b -> c) -> Query pt a -> Query pt b -> Query pt c

(*>) :: Query pt a -> Query pt b -> Query pt b

(<*) :: Query pt a -> Query pt b -> Query pt a

runQuery :: Query pt a -> QueryEnv pt -> IO a Source #

Queries against Cabal's on disk state

Project queries

compilerVersion :: Query pt (String, Version) Source #

The version of GHC the project is configured to use for compilation.

projectPackages :: Query pt (NonEmpty (Package pt)) Source #

All local packages currently active in a project's build plan.

Package queries

type Package pt = Package' (NonEmpty (Unit pt)) Source #

pPackageName :: Package' units -> String Source #

pSourceDir :: Package' units -> FilePath Source #

pUnits :: Package' units -> units Source #

Cabal flags to set when configuring and building this package.

Unit queries

data Unit pt Source #

A Unit is essentially a "build target". It is used to refer to a set of components (exes, libs, tests etc.) which are managed by a certain instance of the Cabal build-system[1]. We may get information on the components in a unit by retriving the corresponding UnitInfo.

[1]: No I'm not talking about the cabal-install build-tool, I'm talking about the Cabal build-system. Note the distinction. Both cabal-install and Stack use the Cabal build-system (aka lib:Cabal) underneath.

Note that a Unit value is only valid within the QueryEnv context it was created in, this is however this is not enforced by the API. Furthermore if the user changes the underlying project configuration while your application is running even a properly scoped Unit could become invalid because the component it belongs to was removed from the cabal file.

Instances

Instances details
Show (Unit pt) Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> Unit pt -> ShowS

show :: Unit pt -> String

showList :: [Unit pt] -> ShowS

uComponentName :: Unit pt -> Maybe ChComponentName Source #

This returns the component a Unit corresponds to. This information is only available if the correspondence happens to be unique and known before querying setup-config for the respective project type. Currently this only applies to pt=V2.

This is intended to be used as an optimization, to allow reducing the number of helper invocations for clients that don't need to know the entire project structure.

data UnitId Source #

Instances

Instances details
Eq UnitId Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

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

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

Ord UnitId Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

compare :: UnitId -> UnitId -> Ordering

(<) :: UnitId -> UnitId -> Bool

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

(>) :: UnitId -> UnitId -> Bool

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

max :: UnitId -> UnitId -> UnitId

min :: UnitId -> UnitId -> UnitId

Read UnitId Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

readsPrec :: Int -> ReadS UnitId

readList :: ReadS [UnitId]

readPrec :: ReadPrec UnitId

readListPrec :: ReadPrec [UnitId]

Show UnitId Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> UnitId -> ShowS

show :: UnitId -> String

showList :: [UnitId] -> ShowS

data UnitInfo Source #

The information extracted from a Unit's on-disk configuration cache.

Constructors

UnitInfo 

Fields

  • uiUnitId :: !UnitId

    A unique identifier of this unit within the originating project.

  • uiPackageId :: !(String, Version)

    The package-name and version this unit belongs to.

  • uiComponents :: !(Map ChComponentName ChComponentInfo)

    The components of the unit: libraries, executables, test-suites, benchmarks and so on.

  • uiCompilerId :: !(String, Version)

    The version of GHC the unit is configured to use

  • uiPackageFlags :: ![(String, Bool)]

    Flag definitions from cabal file

  • uiConfigFlags :: ![(String, Bool)]

    Flag assignments from active configuration

  • uiNonDefaultConfigFlags :: ![(String, Bool)]

    Flag assignments from setup-config which differ from the default setting. This can also include flags which cabal decided to modify, i.e. don't rely on these being the flags set by the user directly.

  • uiModTimes :: !UnitModTimes

    Key for cache invalidation. When this is not equal to the value returned by getUnitModTimes this UnitInfo is considered invalid.

Instances

Instances details
Eq UnitInfo Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

(==) :: UnitInfo -> UnitInfo -> Bool

(/=) :: UnitInfo -> UnitInfo -> Bool

Ord UnitInfo Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

compare :: UnitInfo -> UnitInfo -> Ordering

(<) :: UnitInfo -> UnitInfo -> Bool

(<=) :: UnitInfo -> UnitInfo -> Bool

(>) :: UnitInfo -> UnitInfo -> Bool

(>=) :: UnitInfo -> UnitInfo -> Bool

max :: UnitInfo -> UnitInfo -> UnitInfo

min :: UnitInfo -> UnitInfo -> UnitInfo

Read UnitInfo Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

readsPrec :: Int -> ReadS UnitInfo

readList :: ReadS [UnitInfo]

readPrec :: ReadPrec UnitInfo

readListPrec :: ReadPrec [UnitInfo]

Show UnitInfo Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> UnitInfo -> ShowS

show :: UnitInfo -> String

showList :: [UnitInfo] -> ShowS

unitInfo :: Unit pt -> Query pt UnitInfo Source #

Get the UnitInfo for a given Unit. To get a Unit see projectUnits.

Convenience Queries

allUnits :: (UnitInfo -> a) -> Query pt (NonEmpty a) Source #

Get information on all units in a project.

Query environment

type QueryEnv pt = QueryEnvI QueryCache pt Source #

Environment for running a Query. The constructor is not exposed in the API to allow extending it with more fields without breaking user code.

To create a QueryEnv use the mkQueryEnv smart constructor instead. Some field accessors are exported and may be used to override the defaults filled in by mkQueryEnv. See below.

Note that this environment contains an IORef used as a cache. If you want to take advantage of this you should not simply discard the value returned by the smart constructor after one use.

data QueryEnvI c (pt :: ProjType) Source #

mkQueryEnv Source #

Arguments

:: ProjLoc pt

Location of the project.

-> DistDir pt

Path to the dist/ or dist-newstyle/ directory, called builddir in Cabal terminology.

-> IO (QueryEnv pt) 

mkQueryEnv projdir distdir. Smart constructor for QueryEnv. Sets fields qeProjLoc and qeDistDir to projdir and distdir respectively and provides sensible defaults for the other fields.

qeReadProcess :: QueryEnvI c pt -> ReadProcessWithCwdAndEnv Source #

Field accessor for QueryEnv. Function used to to start processes and capture output. Useful if you need to, for example, redirect standard error output of programs started by cabal-helper.

qeCallProcess :: QueryEnvI c pt -> CallProcessWithCwdAndEnv () Source #

Field accessor for QueryEnv. Function used to to start processes without capturing output. See also qeReadProcess.

qePrograms :: QueryEnvI c pt -> Programs Source #

Field accessor for QueryEnv. Paths to various programs we use.

qeProjLoc :: QueryEnvI c pt -> ProjLoc pt Source #

Field accessor for QueryEnv. Defines path to the project directory, i.e. a directory containing a cabal.project file

qeDistDir :: QueryEnvI c pt -> DistDir pt Source #

Field accessor for QueryEnv. Defines path to the dist/ or dist-newstyle/ directory, aka. builddir in Cabal terminology.

GADTs

data ProjType Source #

The kind of project being managed by a QueryEnv (pun intended). Used as a phantom-type variable throughout to make the project type being passed into various functions correspond to the correct implementation.

Constructors

Cabal CabalProjType

cabal project.

Stack

stack project.

Instances

Instances details
Eq ProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

(==) :: ProjType -> ProjType -> Bool

(/=) :: ProjType -> ProjType -> Bool

Ord ProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

compare :: ProjType -> ProjType -> Ordering

(<) :: ProjType -> ProjType -> Bool

(<=) :: ProjType -> ProjType -> Bool

(>) :: ProjType -> ProjType -> Bool

(>=) :: ProjType -> ProjType -> Bool

max :: ProjType -> ProjType -> ProjType

min :: ProjType -> ProjType -> ProjType

Read ProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

readsPrec :: Int -> ReadS ProjType

readList :: ReadS [ProjType]

readPrec :: ReadPrec ProjType

readListPrec :: ReadPrec [ProjType]

Show ProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> ProjType -> ShowS

show :: ProjType -> String

showList :: [ProjType] -> ShowS

data CabalProjType Source #

The kind of a cabal project.

Constructors

CV1

cabal v1-build project.

CV2

cabal v2-build project.

Instances

Instances details
Eq CabalProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Ord CabalProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Read CabalProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

readsPrec :: Int -> ReadS CabalProjType

readList :: ReadS [CabalProjType]

readPrec :: ReadPrec CabalProjType

readListPrec :: ReadPrec [CabalProjType]

Show CabalProjType Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> CabalProjType -> ShowS

show :: CabalProjType -> String

showList :: [CabalProjType] -> ShowS

data ProjLoc (pt :: ProjType) where Source #

Location of a project context. This is usually just the path project's top-level source code directory together with an optional project-type specific config file path.

To find any recognized default project contexts in a given directory use findProjects.

Build tools usually allow the user to specify the location of their project config files manually, so we also support passing this path here with the *File constructors.

Correspondence between Project and Package Source Directories

Note that the project's source directory does not necessarily correspond to the directory containing the project config file, though in some cases it does.

For example cabal v2-build allows the cabal.project file to be positively anywhere in the filesystem when specified via the --cabal-project command-line flag, corresponding to the ProjLocV2File constructor here. This config file can then refer to package directories with absolute paths in the packages: declaration.

Hence it isn't actually possible to find one directory which contains the whole project's source code but rather we have to consider each package's source directory individually, see pSourceDir

Constructors

ProjLocV1CabalFile

A fully specified cabal v1-build project context. Here you can specify both the path to the .cabal file and the source directory of the package. The cabal file path corresponds to the --cabal-file=PATH flag on the cabal command line.

Note that more than one such files existing in a package directory is a user error and while cabal will still complain about that we won't.

Also note that for this project type the concepts of project and package coincide.

Fields

ProjLocV1Dir

A cabal v1-build project context. Essentially the same as ProjLocV1CabalFile but this will dynamically search for the cabal file for you as cabal-install does by default.

If more than one .cabal file is found in the given directory we will shamelessly throw a obscure exception so prefer ProjLocV1CabalFile if you don't want that to happen. This mainly exists for easy upgrading from the cabal-helper-0.8 series.

Fields

ProjLocV2File

A cabal v2-build project context. The path to the cabal.project file, though you can call it whatever you like. This configuration file then points to the packages that make up this project. This corresponds to the --cabal-project=PATH flag on the cabal command line.

Fields

ProjLocV2Dir

This is equivalent to ProjLocV2File but using the default cabal.project file name in the given directory.

Fields

ProjLocStackYaml

A stack project context. Specify the path to the stack.yaml file here. This configuration file then points to the packages that make up this project. Corresponds to stack's --stack-yaml=PATH command line flag if different from the default name, stack.yaml.

Note: with Stack the invariant takeDirectory plStackYaml == projdir holds.

Fields

Instances

Instances details
Show (ProjLoc pt) Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> ProjLoc pt -> ShowS

show :: ProjLoc pt -> String

showList :: [ProjLoc pt] -> ShowS

data DistDir (pt :: ProjType) where Source #

A build directory for a certain project type. The pt type variable must be compatible with the ProjLoc used. This is enforced by the type system so you can't get this wrong.

Constructors

DistDirCabal :: !(SCabalProjType pt) -> !FilePath -> DistDir ('Cabal pt)

A build-directory for cabal, aka. dist-dir in Cabal terminology. SCabalProjType specifies whether we should use v2-build or v1-build. This choice must correspond to ProjLoc 's project type.

DistDirStack :: !(Maybe RelativePath) -> DistDir 'Stack

A build-directory for stack, aka. work-dir. Optionally override Stack's work-dir. If you just want to use Stack's default set to Nothing

Instances

Instances details
Show (DistDir pt) Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> DistDir pt -> ShowS

show :: DistDir pt -> String

showList :: [DistDir pt] -> ShowS

data SProjType pt where Source #

A "singleton" datatype for ProjType which allows us to establish a correspondence between a runtime representation of ProjType to the compile-time value at the type level.

If you just want to know the runtime ProjType use demoteSProjType to convert to that.

Constructors

SCabal :: !(SCabalProjType pt) -> SProjType ('Cabal pt) 
SStack :: SProjType 'Stack 

Instances

Instances details
Show (SProjType pt) Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> SProjType pt -> ShowS

show :: SProjType pt -> String

showList :: [SProjType pt] -> ShowS

data SCabalProjType pt where Source #

This is a singleton, like SProjType, but restricted to just the Cabal project types. We use this to restrict some functions which don't make sense for Stack to just the Cabal project types.

Constructors

SCV1 :: SCabalProjType 'CV1 
SCV2 :: SCabalProjType 'CV2 

Instances

Instances details
Show (SCabalProjType pt) Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> SCabalProjType pt -> ShowS

show :: SCabalProjType pt -> String

showList :: [SCabalProjType pt] -> ShowS

data Ex a Source #

General purpose existential wrapper. Useful for hiding a phantom type argument.

Say you have:

{-# LANGUAGE DataKinds, GADTS #-}
data K = A | B | ...
data Q k where
  QA :: ... -> Q 'A
  QB :: ... -> Q 'B

and you want a list of Q. You can use Ex to hide the phantom type argument and recover it later by matching on the GADT constructors:

qa :: Q A
qa = QA

qb :: Q B
qb = QB

mylist :: [Ex Q]
mylist = [Ex qa, Ex qb]

Constructors

forall x. Ex (a x) 

Programs

data Programs Source #

Configurable paths to various programs we use.

Constructors

Programs 

Fields

Instances

Instances details
Eq Programs Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

(==) :: Programs -> Programs -> Bool

(/=) :: Programs -> Programs -> Bool

Ord Programs Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

compare :: Programs -> Programs -> Ordering

(<) :: Programs -> Programs -> Bool

(<=) :: Programs -> Programs -> Bool

(>) :: Programs -> Programs -> Bool

(>=) :: Programs -> Programs -> Bool

max :: Programs -> Programs -> Programs

min :: Programs -> Programs -> Programs

Read Programs Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

readsPrec :: Int -> ReadS Programs

readList :: ReadS [Programs]

readPrec :: ReadPrec Programs

readListPrec :: ReadPrec [Programs]

Show Programs Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> Programs -> ShowS

show :: Programs -> String

showList :: [Programs] -> ShowS

Generic Programs Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Associated Types

type Rep Programs :: Type -> Type

Methods

from :: Programs -> Rep Programs x

to :: Rep Programs x -> Programs

type Rep Programs Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

type Rep Programs = D1 ('MetaData "Programs" "CabalHelper.Compiletime.Types" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'False) (C1 ('MetaCons "Programs" 'PrefixI 'True) (((S1 ('MetaSel ('Just "cabalProgram") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "cabalProjArgs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [String])) :*: (S1 ('MetaSel ('Just "cabalUnitArgs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [String]) :*: (S1 ('MetaSel ('Just "stackProgram") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "stackProjArgs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [String])))) :*: ((S1 ('MetaSel ('Just "stackUnitArgs") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [String]) :*: S1 ('MetaSel ('Just "stackEnv") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [(String, EnvOverride)])) :*: (S1 ('MetaSel ('Just "ghcProgram") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just "ghcPkgProgram") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "haddockProgram") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath))))))

defaultPrograms :: Programs Source #

By default all programs use their unqualified names, i.e. they will be searched for on PATH.

data EnvOverride Source #

Constructors

EnvUnset 
EnvSet String 
EnvAppend String 
EnvPrepend String 

Instances

Instances details
Eq EnvOverride Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

(==) :: EnvOverride -> EnvOverride -> Bool

(/=) :: EnvOverride -> EnvOverride -> Bool

Ord EnvOverride Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Read EnvOverride Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

readsPrec :: Int -> ReadS EnvOverride

readList :: ReadS [EnvOverride]

readPrec :: ReadPrec EnvOverride

readListPrec :: ReadPrec [EnvOverride]

Show EnvOverride Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Methods

showsPrec :: Int -> EnvOverride -> ShowS

show :: EnvOverride -> String

showList :: [EnvOverride] -> ShowS

Generic EnvOverride Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

Associated Types

type Rep EnvOverride :: Type -> Type

Methods

from :: EnvOverride -> Rep EnvOverride x

to :: Rep EnvOverride x -> EnvOverride

type Rep EnvOverride Source # 
Instance details

Defined in CabalHelper.Compiletime.Types

type Rep EnvOverride = D1 ('MetaData "EnvOverride" "CabalHelper.Compiletime.Types" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'False) ((C1 ('MetaCons "EnvUnset" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "EnvSet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) :+: (C1 ('MetaCons "EnvAppend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "EnvPrepend" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))))

Query result types

data ChComponentInfo Source #

Constructors

ChComponentInfo 

Fields

  • ciComponentName :: ChComponentName

    The component's type and name

  • ciGhcOptions :: [String]

    Full set of GHC options, ready for loading this component into GHCi.

  • ciSourceDirs :: [String]

    A component's hs-source-dirs field, note that this only contains the directories specified by the cabal file, however cabal also adds the output directory of preprocessors to GHC's search path when building. TODO: make this easier to use.

  • ciEntrypoints :: ChEntrypoint

    Modules or files Cabal would have the compiler build directly. Can be used to compute the home module closure for a component.

data ChComponentName Source #

Constructors

ChSetupHsName 
ChLibName ChLibraryName 
ChFLibName String 
ChExeName String 
ChTestName String 
ChBenchName String 

Instances

Instances details
Eq ChComponentName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Ord ChComponentName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Read ChComponentName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Show ChComponentName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

showsPrec :: Int -> ChComponentName -> ShowS

show :: ChComponentName -> String

showList :: [ChComponentName] -> ShowS

Generic ChComponentName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Associated Types

type Rep ChComponentName :: Type -> Type

type Rep ChComponentName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

type Rep ChComponentName = D1 ('MetaData "ChComponentName" "CabalHelper.Shared.InterfaceTypes" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'False) ((C1 ('MetaCons "ChSetupHsName" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ChLibName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChLibraryName)) :+: C1 ('MetaCons "ChFLibName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) :+: (C1 ('MetaCons "ChExeName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: (C1 ('MetaCons "ChTestName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)) :+: C1 ('MetaCons "ChBenchName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))))

data ChLibraryName Source #

Constructors

ChMainLibName 
ChSubLibName String 

Instances

Instances details
Eq ChLibraryName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Ord ChLibraryName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Read ChLibraryName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

readsPrec :: Int -> ReadS ChLibraryName

readList :: ReadS [ChLibraryName]

readPrec :: ReadPrec ChLibraryName

readListPrec :: ReadPrec [ChLibraryName]

Show ChLibraryName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

showsPrec :: Int -> ChLibraryName -> ShowS

show :: ChLibraryName -> String

showList :: [ChLibraryName] -> ShowS

Generic ChLibraryName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Associated Types

type Rep ChLibraryName :: Type -> Type

type Rep ChLibraryName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

type Rep ChLibraryName = D1 ('MetaData "ChLibraryName" "CabalHelper.Shared.InterfaceTypes" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'False) (C1 ('MetaCons "ChMainLibName" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ChSubLibName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

newtype ChModuleName Source #

Constructors

ChModuleName 

Fields

Instances

Instances details
Eq ChModuleName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

(==) :: ChModuleName -> ChModuleName -> Bool

(/=) :: ChModuleName -> ChModuleName -> Bool

Ord ChModuleName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Read ChModuleName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

readsPrec :: Int -> ReadS ChModuleName

readList :: ReadS [ChModuleName]

readPrec :: ReadPrec ChModuleName

readListPrec :: ReadPrec [ChModuleName]

Show ChModuleName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

showsPrec :: Int -> ChModuleName -> ShowS

show :: ChModuleName -> String

showList :: [ChModuleName] -> ShowS

Generic ChModuleName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Associated Types

type Rep ChModuleName :: Type -> Type

type Rep ChModuleName Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

type Rep ChModuleName = D1 ('MetaData "ChModuleName" "CabalHelper.Shared.InterfaceTypes" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'True) (C1 ('MetaCons "ChModuleName" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChModuleName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))

data ChPkgDb Source #

Constructors

ChPkgGlobal 
ChPkgUser 
ChPkgSpecific FilePath 

Instances

Instances details
Eq ChPkgDb Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

(==) :: ChPkgDb -> ChPkgDb -> Bool

(/=) :: ChPkgDb -> ChPkgDb -> Bool

Ord ChPkgDb Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

compare :: ChPkgDb -> ChPkgDb -> Ordering

(<) :: ChPkgDb -> ChPkgDb -> Bool

(<=) :: ChPkgDb -> ChPkgDb -> Bool

(>) :: ChPkgDb -> ChPkgDb -> Bool

(>=) :: ChPkgDb -> ChPkgDb -> Bool

max :: ChPkgDb -> ChPkgDb -> ChPkgDb

min :: ChPkgDb -> ChPkgDb -> ChPkgDb

Read ChPkgDb Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

readsPrec :: Int -> ReadS ChPkgDb

readList :: ReadS [ChPkgDb]

readPrec :: ReadPrec ChPkgDb

readListPrec :: ReadPrec [ChPkgDb]

Show ChPkgDb Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

showsPrec :: Int -> ChPkgDb -> ShowS

show :: ChPkgDb -> String

showList :: [ChPkgDb] -> ShowS

Generic ChPkgDb Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Associated Types

type Rep ChPkgDb :: Type -> Type

Methods

from :: ChPkgDb -> Rep ChPkgDb x

to :: Rep ChPkgDb x -> ChPkgDb

type Rep ChPkgDb Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

type Rep ChPkgDb = D1 ('MetaData "ChPkgDb" "CabalHelper.Shared.InterfaceTypes" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'False) (C1 ('MetaCons "ChPkgGlobal" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ChPkgUser" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ChPkgSpecific" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))

data ChEntrypoint Source #

Instances

Instances details
Eq ChEntrypoint Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

(==) :: ChEntrypoint -> ChEntrypoint -> Bool

(/=) :: ChEntrypoint -> ChEntrypoint -> Bool

Ord ChEntrypoint Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Read ChEntrypoint Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

readsPrec :: Int -> ReadS ChEntrypoint

readList :: ReadS [ChEntrypoint]

readPrec :: ReadPrec ChEntrypoint

readListPrec :: ReadPrec [ChEntrypoint]

Show ChEntrypoint Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Methods

showsPrec :: Int -> ChEntrypoint -> ShowS

show :: ChEntrypoint -> String

showList :: [ChEntrypoint] -> ShowS

Generic ChEntrypoint Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

Associated Types

type Rep ChEntrypoint :: Type -> Type

type Rep ChEntrypoint Source # 
Instance details

Defined in CabalHelper.Shared.InterfaceTypes

type Rep ChEntrypoint = D1 ('MetaData "ChEntrypoint" "CabalHelper.Shared.InterfaceTypes" "cabal-helper-1.1.0.0-8Jw8PbrXIiY4xY2BgtTtpn" 'False) (C1 ('MetaCons "ChSetupEntrypoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "chMainIs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: (C1 ('MetaCons "ChLibEntrypoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "chExposedModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ChModuleName]) :*: (S1 ('MetaSel ('Just "chOtherModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ChModuleName]) :*: S1 ('MetaSel ('Just "chSignatures") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ChModuleName]))) :+: C1 ('MetaCons "ChExeEntrypoint" 'PrefixI 'True) (S1 ('MetaSel ('Just "chMainIs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just "chOtherModules") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ChModuleName]))))

General information

Legacy v1-build helpers

getSandboxPkgDb Source #

Arguments

:: String

Cabal build platform, i.e. buildPlatform

-> GhcVersion

GHC version (cProjectVersion is your friend)

-> FilePath

Path to the project directory, i.e. a directory containing a cabal.sandbox.config file

-> IO (Maybe FilePath) 

Get the path to the sandbox package-db in a project

Build actions

prepare :: Query pt () Source #

Make sure the appropriate helper executable for the given project is installed and ready to run queries.

The idea is you can run this at a convinient time instead of having the helper compilation happen during a time-sensitive user interaction. This will however happen automatically as needed if you don't run it first.

writeAutogenFiles :: Unit pt -> Query pt () Source #

Create cabal_macros.h, Paths_<pkg>.hs and other generated files in the usual place. See initialBuildSteps.

This is usually only needed on the first load of a unit or after the cabal file changes.

buildUnits :: [Unit pt] -> Query pt () Source #