Get project root
ModuleAgda-2.7.0.1Haskell2010
Agda.Interaction.Library
Library management.
Sample use:
-- Get libraries as listed in .agda/libraries file.
libs <- getInstalledLibraries Nothing
-- Get the libraries (and immediate paths) relevant for projectRoot.
-- This involves locating and processing the .agda-lib file for the project.
(libNames, includePaths) <- getDefaultLibraries projectRoot True
-- Get include paths of depended-on libraries.
resolvedPaths <- libraryIncludePaths Nothing libs libNames
let allPaths = includePaths ++ resolvedPaths
- 9 types
- 13 values
- PackageAgda-2.7.0.1
- Exports22
- LanguageHaskell2010
- LicenceMIT
- SourceLibrary.hs
Get the path to ~/.agda (system-specific).
Can be overwritten by the AGDA_DIR environment variable.
(This is not to be confused with the directory for the data files that Agda needs (e.g. the primitive modules).)
getDefaultLibraries Get dependencies and include paths for given project root:
Look for .agda-lib files according to findAgdaLibFiles.
If none are found, use default dependencies (according to defaults file)
and current directory (project root).
getInstalledLibraries :: Maybe FilePathOverride the default
librariesfile?-> LibM [AgdaLibFile]Content of library files. (Might have empty
LibNames.)
Parse the descriptions of the libraries Agda knows about.
Returns none if there is no libraries file.
Return the trusted executables Agda knows about.
Returns none if there is no executables file.
libraryIncludePaths Get all include pathes for a list of libraries to use.
Get the contents of .agda-lib files in the given project root.
Returns the absolute default lib dir. This directory is used to store the Primitive.agda file.
A symbolic library name.
The options from an OPTIONS pragma (or a .agda-lib file).
In the future it might be nice to switch to a more structured representation. Note that, currently, there is not a one-to-one correspondence between list elements and options.
Constructors
OptionsPragmapragmaStrings :: [String]The options.
pragmaRange :: RangeThe range of the options in the pragma (not including things like an
OPTIONSkeyword).
Instances5Show, Semigroup, Monoid, NFData, EmbPrj
Show OptionsPragmaDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseSemigroup OptionsPragmaDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseMonoid OptionsPragmaDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseNFData OptionsPragmaDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseRanges are not forced.
EmbPrj OptionsPragmaDefined in Agda-2.7.0.1 · Agda.TypeChecking.Serialise.Instances.Common · orphan
Content of a .agda-lib file.
Constructors
AgdaLibFile_libName :: LibNameThe symbolic name of the library.
_libFile :: FilePathPath to this
.agda-libfile (not content of the file)._libAbove :: !IntHow many directories above the Agda file is the
.agda-libfile located?_libIncludes :: [FilePath]Roots where to look for the modules of the library.
_libDepends :: [LibName]Dependencies.
_libPragmas :: OptionsPragmaDefault pragma options for all files in the library.
Instances4Show, Generic, NFData, Rep
Show AgdaLibFileDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseGeneric AgdaLibFileDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseNFData AgdaLibFileDefined in Agda-2.7.0.1 · Agda.Interaction.Library.Basetype Rep AgdaLibFile = D1 ('MetaDataDefined in Agda-2.7.0.1 · Agda.Interaction.Library.Base"AgdaLibFile"
"Agda.Interaction.Library.Base"
"Agda-2.7.0.1-DbbZpETDDF1KkwuzEZvfn8"
'False) (C1 ('MetaCons"AgdaLibFile"
'PrefixI 'True) ((S1 ('MetaSel ('Just"_libName"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LibName) :*: (S1 ('MetaSel ('Just"_libFile"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: S1 ('MetaSel ('Just"_libAbove"
) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int))) :*: (S1 ('MetaSel ('Just"_libIncludes"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: (S1 ('MetaSel ('Just"_libDepends"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LibName]) :*: S1 ('MetaSel ('Just"_libPragmas"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 OptionsPragma)))))
A symbolic executable name.
Throws LibErrors exceptions, still collects LibWarnings.
Raise collected LibErrors as exception.
Constructors
Instances6Show, Generic, NFData, Pretty, EmbPrj, Rep
Show LibWarningDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseGeneric LibWarningDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseNFData LibWarningDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BasePretty LibWarningDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseEmbPrj LibWarningDefined in Agda-2.7.0.1 · Agda.TypeChecking.Serialise.Instances.Errors · orphantype Rep LibWarning = D1 ('MetaDataDefined in Agda-2.7.0.1 · Agda.Interaction.Library.Base"LibWarning"
"Agda.Interaction.Library.Base"
"Agda-2.7.0.1-DbbZpETDDF1KkwuzEZvfn8"
'False) (C1 ('MetaCons"LibWarning"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe LibPositionInfo)) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LibWarning')))
Information about which .agda-lib file we are reading
and from where in the libraries file it came from.
Constructors
LibPositionInfolibFilePos :: Maybe FilePathName of
librariesfile.lineNumPos :: LineNumberLine number in
librariesfile.filePos :: FilePathLibrary file.
Instances5Show, Generic, NFData, EmbPrj, Rep
Show LibPositionInfoDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseGeneric LibPositionInfoDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseNFData LibPositionInfoDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseEmbPrj LibPositionInfoDefined in Agda-2.7.0.1 · Agda.TypeChecking.Serialise.Instances.Errors · orphantype Rep LibPositionInfo = D1 ('MetaDataDefined in Agda-2.7.0.1 · Agda.Interaction.Library.Base"LibPositionInfo"
"Agda.Interaction.Library.Base"
"Agda-2.7.0.1-DbbZpETDDF1KkwuzEZvfn8"
'False) (C1 ('MetaCons"LibPositionInfo"
'PrefixI 'True) (S1 ('MetaSel ('Just"libFilePos"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe FilePath)) :*: (S1 ('MetaSel ('Just"lineNumPos"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LineNumber) :*: S1 ('MetaSel ('Just"filePos"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))
A file can either belong to a project located at a given root containing one or more .agda-lib files, or be part of the default project.
Constructors
ProjectConfigconfigRoot :: FilePathconfigAgdaLibFiles :: [FilePath]configAbove :: !IntHow many directories above the Agda file is the
.agda-libfile located?
DefaultProjectConfig
Instances3Generic, NFData, Rep
Generic ProjectConfigDefined in Agda-2.7.0.1 · Agda.Interaction.Library.BaseNFData ProjectConfigDefined in Agda-2.7.0.1 · Agda.Interaction.Library.Basetype Rep ProjectConfig = D1 ('MetaDataDefined in Agda-2.7.0.1 · Agda.Interaction.Library.Base"ProjectConfig"
"Agda.Interaction.Library.Base"
"Agda-2.7.0.1-DbbZpETDDF1KkwuzEZvfn8"
'False) (C1 ('MetaCons"ProjectConfig"
'PrefixI 'True) (S1 ('MetaSel ('Just"configRoot"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath) :*: (S1 ('MetaSel ('Just"configAgdaLibFiles"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FilePath]) :*: S1 ('MetaSel ('Just"configAbove"
) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 Int))) :+: C1 ('MetaCons"DefaultProjectConfig"
'PrefixI 'False) U1)
Exported for testing
4 declarationsLibrary names are structured into the base name and a suffix of version
numbers, e.g. mylib-1.2.3. The version suffix is optional.
Constructors
Instances2Eq, Show
Eq VersionViewDefined in Agda-2.7.0.1 · Agda.Interaction.LibraryShow VersionViewDefined in Agda-2.7.0.1 · Agda.Interaction.Library
Split a library name into basename and a list of version numbers.
versionView "foo-1.2.3" == VersionView "foo" [1, 2, 3]
versionView "foo-01.002.3" == VersionView "foo" [1, 2, 3]Note that because of leading zeros, versionView is not injective.
(unVersionView . versionView would produce a normal form.)
Print a VersionView, inverse of versionView (modulo leading zeros).
Generalized version of findLib for testing.
findLib' id "a" [ "a-1", "a-02", "a-2", "b" ] == [ "a-02", "a-2" ]findLib' id "a" [ "a", "a-1", "a-01", "a-2", "b" ] == [ "a" ]
findLib' id "a-1" [ "a", "a-1", "a-01", "a-2", "b" ] == [ "a-1", "a-01" ]
findLib' id "a-2" [ "a", "a-1", "a-01", "a-2", "b" ] == [ "a-2" ]
findLib' id "c" [ "a", "a-1", "a-01", "a-2", "b" ] == []