HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Moduleoptics-core-0.4.2Haskell2010

Optics.Getter

A Getter is simply a function considered as an Optic.

Given a function f :: S -> A, we can convert it into a Getter S A using to, and convert back to a function using view.

This is typically useful not when you have functions/Getters alone, but when you are composing multiple Optics to produce a Getter.

Contents
  1. Formation
  2. Introduction
  3. Elimination
  4. Computation
  5. Well-formedness
  6. Subtyping
Synopsis
  • Packageoptics-core-0.4.2
  • Exports5
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceGetter.hs

Formation

Introduction

valueto :: (s -> a) -> Getter s a

Build a getter from a function.

Elimination

valueview :: Is k A_Getter => Optic' k is s a -> s -> a

View the value pointed to by a getter.

If you want to view a type-modifying optic that is insufficiently polymorphic to be type-preserving, use getting.

Computation

view (to f) ≡ f

Well-formedness

A Getter is not subject to any laws.

Subtyping

datadata A_Getter

Tag for a getter.

Instances29ReversibleOptic, Is, JoinKinds, IxOptic, ToReadOnly, MappingOptic, …