---
title: Moshi.jl
description: Algebraic data types, pattern matching, and trait derivation for Julia.
template: splash
editUrl: false
lastUpdated: false
hero:
  tagline: Algebraic data types, pattern matching, and trait derivation for Julia.
  actions: []
---

import LandingHero from '@components/LandingHero.astro';
import FeatureGrid from '@components/FeatureGrid.astro';

<LandingHero
  tagline="Type-stable ADTs, exhaustive pattern matching, and Rust-style derives — built for modern Julia."
/>

<FeatureGrid />

## Why Moshi?

Moshi (模式, *móshì*) brings ML-family patterns to Julia: sum types with `@data`, expressive `@match`, and `@derive` for common traits. It builds on ideas from [MLStyle](https://github.com/thautwarm/MLStyle.jl), [SumTypes](https://github.com/MasonProtter/SumTypes.jl), and [Expronicon](https://github.com/Roger-luo/Expronicon.jl).

```julia
using Moshi.Data: @data
using Moshi.Match: @match
using Moshi.Derive: @derive

@data Expr begin
    Num(Int)
    Add(Self, Self)
    Mul(Self, Self)
end

@derive Expr[Show, Hash, Eq]

eval = @match expr begin
    Expr.Num(n) => n
    Expr.Add(a, b) => eval(a) + eval(b)
    Expr.Mul(a, b) => eval(a) * eval(b)
end
```

## Get started in 30 seconds

```julia
pkg> add Moshi
```

Then head to the [Quick Start guide](/start/getting-started/) or browse the [API reference](/api/data/).
