lens-3.6.0.4: Lenses, Folds and Traversals

PortabilityRank2Types
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Control.Lens.Classes

Contents

Description

 

Synopsis

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 (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 (BazaarT a b g), Gettable g) => Gettable (BazaarT a b g) 
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.

Actions

class (Monad m, Gettable f) => Effective m r f | f -> m r whereSource

An Effective Functor ignores its argument and is isomorphic to a monad wrapped around a value.

That said, the monad is possibly rather unrelated to any Applicative structure.

Methods

effective :: Isomorphic k => k (m r) (f a)Source

Instances

ineffective :: Effective m r f => Isomorphic k => k (f a) (m r)Source

A convenient antonym that is used internally.

Setters

class Applicative f => Settable f whereSource

Anything Settable must be isomorphic to the Identity Functor.

Methods

untainted :: f a -> aSource

untainted# :: (a -> f b) -> a -> bSource

tainted# :: (a -> b) -> a -> f bSource

Instances

Settable Identity

so you can pass our a Setter into combinators from other lens libraries

Settable Mutator 
(Applicative (Backwards f), Settable f) => Settable (Backwards f)

backwards

(Applicative (Compose f g), Settable f, Settable g) => Settable (Compose f g)