nw-fp-scala
SolidScala 3 language-specific patterns with ZIO, Cats Effect, and opaque types
AI & Automation 526 stars
55 forks Updated 1 weeks ago MIT
Install
Quality Score: 95/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# FP in Scala 3 -- Functional Software Crafter Skill
Cross-references: [fp-principles](../nw-fp-principles/SKILL.md) | [fp-domain-modeling](../nw-fp-domain-modeling/SKILL.md) | [pbt-jvm](../nw-pbt-jvm/SKILL.md)
## When to Choose Scala
- Best for: JVM with full FP power | large-scale systems | data engineering | richest effect ecosystem
- Not ideal for: small teams wanting simplicity | Android (use Kotlin) | teams allergic to OO/FP duality
## [STARTER] Quick Setup
```bash
cs install scala3-compiler scala3-repl sbt
sbt new scala/scala3.g8 && cd order-service
# Add zio, zio-test, scalacheck to build.sbt
sbt compile && sbt test
```
## [STARTER] Type System for Domain Modeling
### Choice Types and Record Types
```scala
enum PaymentMethod:
case CreditCard(cardNumber: String, expiryDate: String)
case BankTransfer(accountNumber: String)
case Cash
case class Customer(
customerId: CustomerId,
customerName: CustomerName,
customerEmail: EmailAddress
)
```
Case classes provide structural equality, copy, and pattern matching for free.
### [STARTER] Domain Wrappers (Opaque Types) -- Zero Cost
```scala
object OrderDomain:
opaque type OrderId = Int
object OrderId:
def apply(value: Int): OrderId = value
extension (id: OrderId) def value: Int = id
opaque type EmailAddress = String
object EmailAddress:
def from(raw: String): Either[ValidationError, EmailAddress] =
if raw.contains("@") then Right(raw)
else Left(InvalidEmail(raw))
```
Inside ...
Details
- Author
- nWave-ai
- Repository
- nWave-ai/nWave
- Created
- 3 months ago
- Last Updated
- 1 weeks ago
- Language
- Python
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
AI & Automation Solid
nw-fp-haskell
Haskell language-specific patterns, GADTs, type classes, and effect systems
526 Updated 1 weeks ago
nWave-ai AI & Automation Solid
nw-fp-fsharp
F# language-specific patterns, Railway-Oriented Programming, and Computation Expressions
526 Updated 1 weeks ago
nWave-ai AI & Automation Solid
nw-fp-kotlin
Kotlin language-specific patterns with Arrow, Raise DSL, and coroutine-based effects
526 Updated 1 weeks ago
nWave-ai AI & Automation Solid
nw-fp-clojure
Clojure language-specific patterns, data-first modeling, REPL-driven development, and spec
526 Updated 1 weeks ago
nWave-ai AI & Automation Solid
nw-fp-domain-modeling
Domain modeling with algebraic data types, smart constructors, and type-level error handling
526 Updated 1 weeks ago
nWave-ai