| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Hpack
Contents
Synopsis
- version :: Version
- hpack :: Verbose -> Options -> IO ()
- hpackResult :: Options -> IO Result
- hpackResultWithError :: Options -> IO (Either HpackError Result)
- printResult :: Verbose -> Result -> IO ()
- data Result = Result {}
- data Status
- defaultOptions :: Options
- setProgramName :: ProgramName -> Options -> Options
- setTarget :: FilePath -> Options -> Options
- setDecode :: (FilePath -> IO (Either String ([String], Value))) -> Options -> Options
- setFormatYamlParseError :: (FilePath -> ParseException -> String) -> Options -> Options
- getOptions :: FilePath -> [String] -> IO (Maybe (Verbose, Options))
- data Verbose
- data Options = Options {}
- data Force
- data GenerateHashStrategy
- data OutputStrategy
Documentation
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
Running Hpack
hpackResultWithError :: Options -> IO (Either HpackError Result) Source #
Constructors
| Result | |
Fields
| |
Options
setProgramName :: ProgramName -> Options -> Options Source #
setFormatYamlParseError :: (FilePath -> ParseException -> String) -> Options -> Options Source #
This 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 mainpackage.yaml. To customize this you have to set a custom decode function. - Some of the constructors of
ParseExceptionare never produced by Hpack (e.g.AesonExceptionas Hpack uses it's own mechanism to decodeValues).
Example:
example :: IO (EitherHpackErrorResult) example =hpackResultWithErroroptions where options ::Optionsoptions = setCustomYamlParseErrorFormat formatdefaultOptionsformat :: FilePath ->ParseException-> String format file err = file ++ ": " ++ displayException err setCustomYamlParseErrorFormat :: (FilePath ->ParseException-> String) ->Options->OptionssetCustomYamlParseErrorFormat format =setDecodedecode >>>setFormatYamlParseErrorformat where decode :: FilePath -> IO (Either String ([String], Value)) decode file = first (format file) <$>decodeYamlWithParseErrorfile
Constructors
| Options | |
data GenerateHashStrategy Source #
Constructors
| ForceHash | |
| ForceNoHash | |
| PreferHash | |
| PreferNoHash |
Instances
| Show GenerateHashStrategy Source # | |
Defined in Hpack Methods showsPrec :: Int -> GenerateHashStrategy -> ShowS # show :: GenerateHashStrategy -> String # showList :: [GenerateHashStrategy] -> ShowS # | |
| Eq GenerateHashStrategy Source # | |
Defined in Hpack Methods (==) :: GenerateHashStrategy -> GenerateHashStrategy -> Bool # (/=) :: GenerateHashStrategy -> GenerateHashStrategy -> Bool # | |
data OutputStrategy Source #
Constructors
| CanonicalOutput | |
| MinimizeDiffs |
Instances
| Show OutputStrategy Source # | |
Defined in Hpack.Options Methods showsPrec :: Int -> OutputStrategy -> ShowS # show :: OutputStrategy -> String # showList :: [OutputStrategy] -> ShowS # | |
| Eq OutputStrategy Source # | |
Defined in Hpack.Options Methods (==) :: OutputStrategy -> OutputStrategy -> Bool # (/=) :: OutputStrategy -> OutputStrategy -> Bool # | |