parsePackage :: BS.ByteString -> BS.ByteString -> Either String Package
parsePackage cpvString metadataString = do
  CPV category package version <- Atto.parseOnly parseCPV cpvString
  metadata    <- Atto.parseOnly parseMetadata metadataString
  description <- lookup' "DESCRIPTION" metadata
  eapis       <- lookupWithDef "5" "EAPI" metadata
  eapi        <- Atto.parseOnly Atto.decimal eapis
  homepages   <- lookup' "HOMEPAGE" metadata
  homepage    <- Atto.parseOnly parseWords homepages
  iuses       <- lookupWithDef "" "IUSE" metadata
  iuse        <- Atto.parseOnly parseWords iuses
  keywordss   <- lookupWithDef "" "KEYWORDS" metadata
  keywords    <- Atto.parseOnly parseWords keywordss
  licenses    <- lookup' "LICENSE" metadata
  license     <- Atto.parseOnly parseWords licenses
  srcUris     <- lookupWithDef "" "SRC_URI" metadata
  srcUri      <- Atto.parseOnly parseWords srcUris
  slot        <- lookup' "SLOT" metadata
  return $ Package category
                   package
                   version
                   description
                   eapi
                   homepage
                   iuse
                   keywords
                   license
                   srcUri
                   slot
parsePackage :: BS.ByteString -> BS.ByteString -> Either String Package
parsePackage cpvString metadataString = do
  CPV category package version <- Atto.parseOnly parseCPV cpvString
  metadata    <- Atto.parseOnly parseMetadata metadataString
  description <- lookup' "DESCRIPTION" metadata
  eapis       <- lookupWithDef "5" "EAPI" metadata
  eapi        <- Atto.parseOnly Atto.decimal eapis
  homepages   <- lookup' "HOMEPAGE" metadata
  homepage    <- Atto.parseOnly parseWords homepages
  iuses       <- lookupWithDef "" "IUSE" metadata
  iuse        <- Atto.parseOnly parseWords iuses
  keywordss   <- lookupWithDef "" "KEYWORDS" metadata
  keywords    <- Atto.parseOnly parseWords keywordss
  licenses    <- lookup' "LICENSE" metadata
  license     <- Atto.parseOnly parseWords licenses
  srcUris     <- lookupWithDef "" "SRC_URI" metadata
  srcUri      <- Atto.parseOnly parseWords srcUris
  slot        <- lookup' "SLOT" metadata
  return $ Package category
                   package
                   version
                   description
                   eapi
                   homepage
                   iuse
                   keywords
                   license
                   srcUri
                   slot
parsePackage cpvString metadataString = do
  CPV category package version <- Atto.parseOnly parseCPV cpvString
  metadata    <- Atto.parseOnly parseMetadata metadataString
  description <- lookup' "DESCRIPTION" metadata
  eapis       <- lookupWithDef "5" "EAPI" metadata
  eapi        <- Atto.parseOnly Atto.decimal eapis
  homepages   <- lookup' "HOMEPAGE" metadata
  homepage    <- Atto.parseOnly parseWords homepages
  iuses       <- lookupWithDef "" "IUSE" metadata
  iuse        <- Atto.parseOnly parseWords iuses
  keywordss   <- lookupWithDef "" "KEYWORDS" metadata
  keywords    <- Atto.parseOnly parseWords keywordss
  licenses    <- lookup' "LICENSE" metadata
  license     <- Atto.parseOnly parseWords licenses
  srcUris     <- lookupWithDef "" "SRC_URI" metadata
  srcUri      <- Atto.parseOnly parseWords srcUris
  slot        <- lookup' "SLOT" metadata
  return $ Package category
                   package
                   version
                   description
                   eapi
                   homepage
                   iuse
                   keywords
                   license
                   srcUri
                   slot