ParseError package:hpack

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