lens-3.8.0.2: 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

Functor (Const r) => Gettable (Const r) 
(Functor (Backwards f), Gettable f) => Gettable (Backwards f) 
Functor (Accessor r) => Gettable (Accessor r) 
(Functor (Indexing64 f), Gettable f) => Gettable (Indexing64 f) 
(Functor (Indexing f), Gettable f) => Gettable (Indexing f) 
(Functor (Compose f g), Functor f, Gettable g) => Gettable (Compose f g) 
Functor (Effect m r) => Gettable (Effect m r) 
(Functor (PretextT p g a b), Profunctor p, Gettable g) => Gettable (PretextT p g a b) 
(Functor (BazaarT p g a b), Profunctor p, Gettable g) => Gettable (BazaarT p g a b) 
(Functor (TakingWhile p f a b), Gettable f) => Gettable (TakingWhile p f a b) 
Functor (EffectRWS w st m s) => Gettable (EffectRWS w st m s) 

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