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