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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@effect-native/patterns

v0.1.0

Published

Worked examples showing Effect module patterns (TypeId, dual, Equal.symbol, Hash.symbol).

Readme

@effect-native/patterns

Hands-on study material for the Effect Native codebase. Each module in this package illustrates the expectations described in the normative pattern library (.patterns/*.md).

Thing

Thing is a deliberately small data type that demonstrates several of the library-wide rules:

  • Type identifiers: every instance carries a stable TypeId symbol so it can be recognised safely across module boundaries.
  • Structural protocols: the prototype implements Equal.symbol and Hash.symbol, using Hash.cached plus sorted, deduplicated tags to keep hash codes deterministic.
  • Dual combinators: higher-order helpers like mapValue and addTag are exposed with dual so they support both data-first and data-last styles.
  • Pipeable: the prototype delegates to Effect's pipeArguments helper so instances compose naturally with .pipe(...).

The accompanying tests in test/Thing.test.ts follow the @effect/vitest conventions from .patterns/testing-patterns.md, showing how structured data (Data.struct) integrates with Equal/Hash.

Usage

import * as Thing from "@effect-native/patterns/Thing"

const todo = Thing.make({
  id: "add-patterns-docs",
  label: "Write README",
  value: { done: false }
})

const updated = todo.pipe(
  Thing.mapValue((value) => ({ ...value, done: true })),
  Thing.addTag("docs")
)

Run pnpm --filter @effect-native/patterns test inside nix develop to execute the worked examples.

List

List models a functional, singly-linked sequence with all of the idioms we lean on in production code:

  • Pipeable structure: every list is Pipeable, so you can chain transformations without reaching for helpers.
  • Structural equality: the prototype implements Equal.symbol and Hash.symbol by walking the nodes to ensure hashing follows value semantics.
  • Dual combinators: helpers like cons, append, map, reduce, and forEachEffect all use dual so they work in both data-first and data-last styles.
  • Effect traversal: forEachEffect demonstrates how to loop over the structure within Effect.gen, yielding each node sequentially.

The tests in test/List.test.ts include examples covering both pure and Effectful usage while applying the guardrails in .patterns/testing-patterns.md.

Tree

Tree demonstrates how to build richer recursive data models:

  • Structured construction: make accepts immutable child collections, and every node tracks its subtree size for quick introspection.
  • Deep equality / hashing: the prototype walks child trees to implement Equal.symbol and Hash.symbol, ensuring structural comparison works across nested data.
  • Dual helpers: appendChild, map, and reduce all support data-first and data-last usage via dual, mirroring the conventions in the Effect standard library.
  • Effectful traversal: forEachEffect produces depth-first visitation with index paths, showing how to integrate recursion with Effect.gen.

See test/Tree.test.ts for executable examples that combine pure and Effectful workloads.