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 🙏

© 2024 – Pkg Stats / Ryan Hefner

effect-monocle

v0.7.0

Published

Port of some monocle-ts features to effect-ts

Downloads

1,344

Readme

effect-monocle

Hey there! This is a library aiming to provide monocle-ts API for effect codebases. My motivation for creating it was to make transition from fp-ts to effect easier because we rely heavily on monocle-ts in our codebase.

The overall tendency in the effect ecosystem is to ditch the optics whatsoever. I'm mostly aligned with this view, so I'd like to emphasize that this library's main goal is to provide a smooth transition path for those who are already using monocle-ts and want to switch to effect. The goal is NOT to promote the use of optics.

The API

This library exposes a very small subset of the monocle-ts API. I basically rewrote parts I use personally. If you need more, feel free to open an issue or a PR.

Along the way, I've made some changes to the API to make it more effect-friendly. Also, I've included some changes to the API that I either wish were in the monocle-ts or have implemented as a custom in-app code.

Notably,

  • multi-parameter functions are implemented and exposed as duals, thus there are always both data-first and data-last variants,
  • the index module exposes a fully named Lens and Optional modules, so the expected usage is e.g Lens.prop instead of L.prop,
  • I included a Lens.extract / Optional.extract combinators, they are the moral equivalents of type-level Extract<A, { [K in keyof A]: B } and are useful when creating an optional from a discriminated union,
  • I included Lens.append / Lens.appendAll / Optional.append / Optional.appendAll combinators that work on lenses / optionals focusing an array and they create a function performing an append / extend on the focused array,
  • I modified the signature of Lens.prop / Optional.prop to accept multiple keys at once, so one can write Lens.prop(lens, 'a', 'b', 'c') instead of pipe(lens, Lens.prop('a'), Lens.prop('b'), Lens.prop('c')).
  • I renamed Lens.props / Optional.props to Lens.pick / Optional.pick to unify the naming with @effect/schema, effect/Struct, etc.
  • The Lens<S, A> has a modify method so it should be used insteadf of L.modify

Please refer to the monocle-ts README and the effect-monocle API docs for more information.