On this page:
Lenses
6.3.90.900

Lenses

Jack Firth <jackhfirth@gmail.com>
and Alex Knauth <alexander@knauth.org>

 (require lens) package: lens

This library includes functions and forms for working with lenses. A lens is a value that operates on some small piece of a larger structure. Think of them as a more general representation of getters and setters in object-oriented languages.

source code: https://github.com/jackfirth/lens

This library is stable, backwards compatibility will be maintained. For experimental features see unstable/lens.

    1 The Lens Guide

      1.1 Introduction to Lenses

        1.1.1 What are lenses?

        1.1.2 Why use lenses?

      1.2 Lenses on Built-In Datatypes

        1.2.1 Lenses on Ordered Data

          1.2.1.1 Pairs and Lists

          1.2.1.2 Vectors and Strings

          1.2.1.3 Streams

        1.2.2 Lenses on Key-Value Data

          1.2.2.1 Hash Tables

          1.2.2.2 Dictionaries

      1.3 Lenses on User-Defined Datatypes

        1.3.1 Structures

        1.3.2 Constructing Entirely New Lenses

    2 The Lens Reference

      2.1 Core Lens Forms

        2.1.1 Lens Construction

        2.1.2 Viewing and Setting

        2.1.3 Lens Laws

        2.1.4 Transforming Values With Lenses

        2.1.5 Lens Contracts

      2.2 Joining and Composing Lenses

      2.3 Pair and List Lenses

        2.3.1 Pair lenses

        2.3.2 List lenses

        2.3.3 Joining lenses to view lists

        2.3.4 Association List Lenses

      2.4 Hash Lenses

      2.5 Struct Lenses

      2.6 Vector lenses

      2.7 String Lenses

        2.7.1 String Lenses

        2.7.2 ???

      2.8 Stream Lenses

      2.9 Dict lenses

      2.10 Applicable lenses