dhall-1.42.3: A configuration language guaranteed to terminate

Safe Haskell | None
Language | Haskell2010

Dhall.Package

Description

Create a package.dhall from files and directory contents.

Synopsis

- data Options
- defaultOptions :: Options
- characterSet :: Lens' Options CharacterSet
- packageFileName :: Lens' Options String
- packagingMode :: Lens' Options PackagingMode
- data PackagingMode
  - = OnlyThisPackage
  - | RecursiveSubpackages
- writePackage :: Options -> NonEmpty FilePath -> IO ()
- getPackagePathAndContent :: Options -> NonEmpty FilePath -> IO (FilePath, Expr s Import)
- data PackageError
  - = AmbiguousOutputDirectory FilePath FilePath
  - | IncompatiblePaths [Import]
  - | InvalidPath FilePath

# Documentation

data Options Source #

Options for package creation.

defaultOptions :: Options Source #

The default options used for packaging.

The default values for the different settings are:

- The character set used is the one given by `defaultCharacterSet`.
- The package file name is `package.dhall`.
- The packaging mode is `OnlyThisPackage`.

characterSet :: Lens' Options CharacterSet Source #

Access the character set used to render the package content.

packageFileName :: Lens' Options String Source #

Access the file name used for the package file.

packagingMode :: Lens' Options PackagingMode Source #

Access the packaging mode. See the documentation of `getPackagePathAndContent`.

data PackagingMode Source #

Whether to recursively create a package for each subdirectory or not. See the documentation of `getPackagePathAndContent`.

Constructors

OnlyThisPackage |
RecursiveSubpackages |

writePackage :: Options -> NonEmpty FilePath -> IO () Source #

Create a package.dhall from files and directory contents. For a description of how the package file is constructed see `getPackagePathAndContent`.

getPackagePathAndContent :: Options -> NonEmpty FilePath -> IO (FilePath, Expr s Import) Source #

Get the path and the Dhall expression for a package file.

The location of the resulting package file is determined by the first path of the second argument:

- If it is a directory, it is also the output directory and the package file will be placed there.
- If it is a file, then the directory that file resides in is the output directory and the package file will be placed there.

All inputs provided as the second argument must be either in the output directory or below it. They are processed depending on whether the path points to a directory or a file:

- If the path points to a directory, all files with a `.dhall` extensions in that directory are included in the package.

If you passed `Recurse` to the this function, then in addition to these files all subdirectories are traversed and a sub-package created for each one. That sub-package will be included in the package too.

- If the path points to a regular file, it is included in the package unless it is the path of the package file itself.

data PackageError Source #

Exception thrown when creating a package file.

Constructors

AmbiguousOutputDirectory FilePath FilePath |
IncompatiblePaths [Import] |
InvalidPath FilePath |

#### Instances

Instances details

Exception PackageError Source # |
Instance details Defined in Dhall.Package Methods toException :: PackageError -> SomeException Source # fromException :: SomeException -> Maybe PackageError Source # displayException :: PackageError -> String Source # backtraceDesired :: PackageError -> Bool Source #
Show PackageError Source # |
Instance details Defined in Dhall.Package Methods showsPrec :: Int -> PackageError -> ShowS Source # show :: PackageError -> String Source # showList :: [PackageError] -> ShowS Source #