Python to Scala Functional Patterns
SkillDev toolsGuide for translating Python code to functional Scala style. Use when converting Python code involving numeric formatting, higher-order functions, decorators, closures, generators, or when aiming for idiomatic functional Scala with pattern matching, Option handling, and monadic operations.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Python to Scala Functional Patterns skill
What this skill tells your AI
The instructions your AI receives, as published by cxcscmu/skilllearnbench in skills/human_authored/python-scala-translation/python-scala-functional/SKILL.md and read by ahel’s review.
Functor / Monad Simulation -> Proper Scala Types
// Python simulates functors; Scala has them natively via map/flatMap
class TokenFunctor[A](val get: A) {
def map[B](f: A => B): TokenFunctor[B] = new TokenFunctor(f(get))
def flatMap[B](f: A => TokenFunctor[B]): TokenFunctor[B] = f(get)
def getOrElse(default: => A): A = if (get != null) get else default
}
Option Handling
// Python: return None -> Scala: Option[T]
// Python: if x is None -> Scala: x match { case None => ... case Some(v) => ... }
// Python: x or default -> Scala: x.getOrElse(default)
Higher-Order Functions
// Python: Callable[[T], Token] -> Scala: T => Token
// Python: Callable[[T], Token | None] -> Scala: T => Option[Token]
Lazy Evaluation
// Python: yield (generator) -> Scala: Iterator via .iterator.map
def tokenizeBatch(values: Iterable[T]): Iterator[Token] =
values.iterator.map(tokenize)
Signals
- GitHub stars
- 83
- Forks
- 5
- Last commit
- Jul 2026
Advanced
- Catalog kind
- skill
- Gateway key
python-scala-functional- Source
- github.com/cxcscmu/skilllearnbench