Run3 scala functional parsing and error handling
[COLM'26] SkillLearnBench is the first benchmark for evaluating continual learning methods that automatically generate agent skills.
npx -y skills add cxcscmu/SkillLearnBench --skill run3_scala-functional-parsing-and-error-handlingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
What its author says it does
Copied from the file, not written here
Implement idiomatic Scala logic for parsing temporal/numeric data and handling batch processing using functional transformations and error types.
SKILL.md
1.3 KB, 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.toDoubleOptionorString.toIntOptionto safely convert strings to numbers. If using a version where these aren't available, wrap the logic inscala.util.Try(s.toDouble).toOption. - Temporal: Use the
java.timepackage (e.g.,LocalDateTime,ZonedDateTime) andDateTimeFormatter. 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
.flatMapif the tokenization process returns anOptionand 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.