Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 #
Result | |
|
Options
setProgramName :: ProgramName -> Options -> Options Source #
setFormatYamlParseError :: (FilePath -> ParseException -> String) -> Options -> Options Source #
This is used to format any ParseException
s encountered during
decoding of defaults.
Note that:
- This is not used to format
ParseException
s encountered during decoding of the mainpackage.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 decodeValue
s).
Example:
example :: IO (EitherHpackError
Result
) example =hpackResultWithError
options where options ::Options
options = setCustomYamlParseErrorFormat formatdefaultOptions
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
data GenerateHashStrategy Source #
Instances
Show GenerateHashStrategy Source # | |
Defined in Hpack showsPrec :: Int -> GenerateHashStrategy -> ShowS # show :: GenerateHashStrategy -> String # showList :: [GenerateHashStrategy] -> ShowS # | |
Eq GenerateHashStrategy Source # | |
Defined in Hpack (==) :: GenerateHashStrategy -> GenerateHashStrategy -> Bool # (/=) :: GenerateHashStrategy -> GenerateHashStrategy -> Bool # |
data OutputStrategy Source #
Instances
Show OutputStrategy Source # | |
Defined in Hpack.Options showsPrec :: Int -> OutputStrategy -> ShowS # show :: OutputStrategy -> String # showList :: [OutputStrategy] -> ShowS # | |
Eq OutputStrategy Source # | |
Defined in Hpack.Options (==) :: OutputStrategy -> OutputStrategy -> Bool # (/=) :: OutputStrategy -> OutputStrategy -> Bool # |