Skip to content

twhitehead/purescript-profunctor-lenses

 
 

Repository files navigation

Profunctor Lenses

CI Release Pursuit Maintainer: garyb

Pure profunctor lenses: a mechanism for updating, viewing, and setting values within nested data structures.

Learn more about profunctor lenses with:

Installation

Install profunctor-lenses with Spago:

spago install profunctor-lenses

Quick start

> structure = Tuple (Tuple (Tuple "hi!" 3) 2) 1

> import Data.Lens
> _leftmost = _1 <<< _1 <<< _1

> view _leftmost structure
"hi!"

> set _leftmost "Bye!" structure
(Tuple (Tuple (Tuple "Bye!" 3) 2) 1)

> over _leftmost String.toUpper structure
(Tuple (Tuple (Tuple "HI!" 3) 2) 1)

You can try out the examples in the REPL by running:

spago -x examples.dhall repl

Documentation

profunctor-lenses documentation is stored in a few places:

  1. Module documentation is published on Pursuit.
  2. Usage examples can be found in the test suite and examples directory.
  3. Practical Profunctor Optics & Lenses in PureScript, a practical introduction to profunctor optics in PureScript
  4. Lenses for the Mere Mortal, a book about lenses in PureScript

If you get stuck, there are several ways to get help:

Contributing

You can contribute to profunctor-lenses in several ways:

  1. If you encounter a problem or have a question, please open an issue. We'll do our best to work with you to resolve or answer it.

  2. If you would like to contribute code, tests, or documentation, please read the contributor guide. It's a short, helpful introduction to contributing to this library, including development instructions.

  3. If you have written a library, tutorial, guide, or other resource based on this package, please share it on the PureScript Discourse! Writing libraries and learning resources are a great way to help this library succeed.

About

Pure profunctor lenses

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PureScript 98.9%
  • Dhall 1.1%