agentsclimarketplace

Run3 scala functional parsing and error handling

Skill cxcscmu/SkillLearnBench/skills/b3-teacher-feedback-gemini-3-flash-preview/python-scala-translation/run3_scala-functional-parsing-and-error-handling

Implement idiomatic Scala logic for parsing temporal/numeric data and handling batch processing using functional transformations and error types.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run3_scala-functional-parsing-and-error-handling

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.3 KB, 255 tokens by cl100k_base, as published. Nobody here has run it

Functional Error Handling

Avoid returning null or throwing exceptions for expected failures (e.g., failed parsing). Use:

  • Option[Token]: When a result might be absent.
  • Either[String, Token]: When you need to provide an error message upon failure.

Numeric and Temporal Parsing

  • Numeric: Use String.toDoubleOption or String.toIntOption to safely convert strings to numbers. If using a version where these aren't available, wrap the logic in scala.util.Try(s.toDouble).toOption.
  • Temporal: Use the java.time package (e.g., LocalDateTime, ZonedDateTime) and DateTimeFormatter. Wrap parsing logic in a functional container to handle malformed date strings gracefully.

Batch Processing

Instead of manual loops, use Scala's collection API for tokenizeBatch:

  • Use .map(tokenize) to transform a sequence of inputs into a sequence of tokens.
  • Use .flatMap if the tokenization process returns an Option and you wish to filter out unsuccessful attempts.

Standard Library Usage

Prefer Scala's standard library over reinventing logic. For example, use s.split("\\s+") or Regex for WhitespaceTokenizer logic.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.