hpack-0.35.4: A modern format for Haskell packages
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hpack

Synopsis

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

data Result Source #

Instances

Instances details
Show Result Source # 
Instance details

Defined in Hpack

Eq Result Source # 
Instance details

Defined in Hpack

Methods

(==) :: Result -> Result -> Bool #

(/=) :: Result -> Result -> Bool #

data Status Source #

Instances

Instances details
Show Status Source # 
Instance details

Defined in Hpack

Eq Status Source # 
Instance details

Defined in Hpack

Methods

(==) :: Status -> Status -> Bool #

(/=) :: Status -> Status -> Bool #

Options

setFormatYamlParseError :: (FilePath -> ParseException -> String) -> Options -> Options Source #

This is used to format any ParseExceptions encountered during decoding of defaults.

Note that:

  1. 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.
  2. 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

data Verbose Source #

Constructors

Verbose 
NoVerbose 

Instances

Instances details
Show Verbose Source # 
Instance details

Defined in Hpack.Options

Eq Verbose Source # 
Instance details

Defined in Hpack.Options

Methods

(==) :: Verbose -> Verbose -> Bool #

(/=) :: Verbose -> Verbose -> Bool #

data Force Source #

Constructors

Force 
NoForce 

Instances

Instances details
Show Force Source # 
Instance details

Defined in Hpack.Options

Methods

showsPrec :: Int -> Force -> ShowS #

show :: Force -> String #

showList :: [Force] -> ShowS #

Eq Force Source # 
Instance details

Defined in Hpack.Options

Methods

(==) :: Force -> Force -> Bool #

(/=) :: Force -> Force -> Bool #

data OutputStrategy Source #

Instances

Instances details
Show OutputStrategy Source # 
Instance details

Defined in Hpack.Options

Eq OutputStrategy Source # 
Instance details

Defined in Hpack.Options