lens-3.8.7.3: Lenses, Folds and Traversals

Portabilitynon-portable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Control.Lens.Internal.Getter

Contents

Description

 

Synopsis

Internal Classes

Getters

class Functor f => Gettable f whereSource

Generalizing Const so we can apply simple Applicative transformations to it and so we can get nicer error messages.

A Gettable Functor ignores its argument, which it carries solely as a phantom type parameter.

To ensure this, an instance of Gettable is required to satisfy:

id = fmap f = coerce

Which is equivalent to making a Gettable f an "anyvariant" Functor.

Methods

coerce :: f a -> f bSource

Replace the phantom type argument.

Instances

noEffect :: (Applicative f, Gettable f) => f aSource

The mempty equivalent for a Gettable Applicative Functor.

newtype Accessor r a Source

Used instead of Const to report

No instance for (Settable Accessor)

when the user attempts to misuse a Setter as a Getter, rather than a monolithic unification error.

Constructors

Accessor 

Fields

runAccessor :: r