miso
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Miso.Lens.TH

Contents

Description

 
Synopsis

TH

Re-exports

lens :: (record -> field) -> (record -> field -> record) -> Lens record field Source #

Smart constructor lens function. Used to easily construct a Lens

name :: Lens Person String
name = lens _name $ \p n -> p { _name = n }

compose :: Category cat => cat b c -> cat a b -> cat a c Source #

this :: Lens a a Source #

Lens that operates on itself

update AddOne = do
  this += 1

data Lens record field Source #

A Lens is a generalized getter and setter.

Lenses allow both the retrieval of values from fields in a record and the assignment of values to fields in a record. The power of a Lens comes from its ability to be composed with other lenses.

In the context of building applications with miso, the model is often a deeply nested product type. This makes it highly conducive to Lens operations (as defined below).

Instances

Instances details
Category Lens Source #

Lens are Categories, and can therefore be composed.

Instance details

Defined in Miso.Lens

Methods

id :: Lens a a #

(.) :: Lens b c -> Lens a b -> Lens a c #