npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@systemfsoftware/effect-schema-bounded-union

v0.1.3

Published

A recursive Effect Schema union whose generated values terminate — same decode, encode and equivalence as Schema.Union, with a depth cap on arbitrary generation.

Readme

@systemfsoftware/effect-schema-bounded-union

A recursive Effect Schema union whose generated values terminate.

Schema.Union is generated as an unbounded fc.oneof(...members). That is fine for a union of leaves, but a union that recurses through a non-array field — Binary.left: Expression, Member.object: Expression — can recurse until the call stack overflows. Anything that generates values from the schema then crashes before it does its job: a property test, an arbitrary-driven fuzz run, a fixture generator.

boundedUnion builds the same union with a depth cap on generation only. Decode, encode and equivalence are identical to Schema.Union. Past maxDepth (default 2), generation collapses to the base case, so every variant stays reachable while the recursion always terminates.

import { boundedUnion } from '@systemfsoftware/effect-schema-bounded-union'
import { Schema as S } from 'effect'

const LitBase = S.TaggedStruct('Lit', { value: S.JsonNumber })
const AddBase = S.TaggedStruct('Add', {})

type Lit = S.Schema.Type<typeof LitBase>
type Add = S.Schema.Type<typeof AddBase> & {
  readonly left: Expr
  readonly right: Expr
}
type Expr = Lit | Add

const Add: S.Codec<Add> = S.suspend((): S.Codec<Add> => S.Struct({ ...AddBase.fields, left: Expr, right: Expr }))

export const Expr: S.Codec<Expr> = boundedUnion('Expr', {
  base: [LitBase],
  recur: [Add],
})

Split the members by whether they recurse: base holds the leaves and is used as the base case, recur holds the self-referential ones. The first argument is both the schema's identifier and the depthIdentifier the generator counts depth against — keep it unique per recursive cycle.

Install

pnpm add @systemfsoftware/effect-schema-bounded-union

A regular dependency, not a devDependency: boundedUnion returns the codec your schema is, so the module that declares the schema imports it, and that module ships. effect is a peer dependency — you bring your own, so one copy of it decodes your whole application.

License

Apache-2.0. Part of systemfsoftware.