ten-0.1.0.0: Typeclasses like Functor, etc. over arity-1 type constructors.
Safe HaskellNone
LanguageHaskell2010

Data.Functor.Update

Description

Extends Representable with support for modifying elements.

Synopsis

Documentation

class Representable f => Update f where Source #

Extends Representable with support for modifying elements.

If Eq (Rep f) is available, this is already possible by roundabout means, but this class lets instances provide a more direct method that doesn't require per-field equality tests.

Methods

overRep :: Rep f -> (a -> a) -> f a -> f a Source #

Instances

Instances details
(Generic1 f, GTabulate (Rep1 f), GUpdate (Rep1 f), Functor f) => Update (FieldRep f) Source # 
Instance details

Defined in Data.Functor.Update

Methods

overRep :: Rep (FieldRep f) -> (a -> a) -> FieldRep f a -> FieldRep f a Source #

updateRep :: Update f => Rep f -> a -> f a -> f a Source #

Update an f a at a given index.

ixRep :: (Update f, Functor m) => Rep f -> (a -> m a) -> f a -> m (f a) Source #

A Lens to the field identified by a given Rep.

    ixRep :: Update f => Rep f -> Lens' (f a) a

class GUpdate rec where Source #

The Generic1 implementation of Update.

Methods

gsetters :: ((forall a. (a -> a) -> rec a -> rec a) -> r) -> rec r Source #

Instances

Instances details
GUpdate Par1 Source # 
Instance details

Defined in Data.Functor.Update

Methods

gsetters :: ((forall a. (a -> a) -> Par1 a -> Par1 a) -> r) -> Par1 r Source #

GUpdate (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Update

Methods

gsetters :: ((forall a. (a -> a) -> U1 a -> U1 a) -> r) -> U1 r Source #

GUpdate rec => GUpdate (Rec1 rec) Source # 
Instance details

Defined in Data.Functor.Update

Methods

gsetters :: ((forall a. (a -> a) -> Rec1 rec a -> Rec1 rec a) -> r) -> Rec1 rec r Source #

(GUpdate f, GUpdate g) => GUpdate (f :*: g) Source # 
Instance details

Defined in Data.Functor.Update

Methods

gsetters :: ((forall a. (a -> a) -> (f :*: g) a -> (f :*: g) a) -> r) -> (f :*: g) r Source #

GUpdate rec => GUpdate (M1 k i rec) Source # 
Instance details

Defined in Data.Functor.Update

Methods

gsetters :: ((forall a. (a -> a) -> M1 k i rec a -> M1 k i rec a) -> r) -> M1 k i rec r Source #

(GUpdate f, GUpdate g) => GUpdate (f :.: g) Source # 
Instance details

Defined in Data.Functor.Update

Methods

gsetters :: ((forall a. (a -> a) -> (f :.: g) a -> (f :.: g) a) -> r) -> (f :.: g) r Source #