Modulehpack-0.38.2Haskell2010
Hpack
- 7 types
- 11 values
- Packagehpack-0.38.2
- Exports18
- LanguageHaskell2010
- LicenceMIT
- SourceHpack.hs
NOTE: This module is exposed to allow integration of Hpack into other tools. It is not meant for general use by end users. The following caveats apply:
The API is undocumented, consult the source instead.
The exposed types and functions primarily serve Hpack's own needs, not that of a public API. Breaking changes can happen as Hpack evolves.
As an Hpack user you either want to use the hpack executable or a build
tool that supports Hpack (e.g. stack or cabal2nix).
Version
1 declarationRunning Hpack
6 declarationsConstructors
Options
11 declarationsThis is used to format any ParseExceptions encountered during decoding of defaults.
Note that:
This is not used to format ParseExceptions encountered during decoding of the main
package.yaml. To customize this you have to set a custom decode function.Some of the constructors of ParseException are never produced by Hpack (e.g. AesonException as Hpack uses it's own mechanism to decode Values).
Example:
example :: IO (Either HpackError Result)
example = hpackResultWithError options
where
options :: Options
options = setCustomYamlParseErrorFormat format defaultOptions
format :: FilePath -> ParseException -> String
format file err = file ++ ": " ++ displayException err
setCustomYamlParseErrorFormat :: (FilePath -> ParseException -> String) -> Options -> Options
setCustomYamlParseErrorFormat format = setDecode decode >>> setFormatYamlParseError format
where
decode :: FilePath -> IO (Either String ([String], Value))
decode file = first (format file) <$> decodeYamlWithParseError file
Instances2Eq, Show
Eq GenerateHashStrategyDefined in hpack-0.38.2 · HpackShow GenerateHashStrategyDefined in hpack-0.38.2 · Hpack
Instances2Eq, Show
Eq OutputStrategyDefined in hpack-0.38.2 · Hpack.OptionsShow OutputStrategyDefined in hpack-0.38.2 · Hpack.Options