acts-generic
Safe HaskellNone
LanguageHaskell2010

Data.Act.Generic

Description

Provide generic Act instances, in two cases

data Product a b = Product a b

instance Act (Last a) a where act (Last Nothing) a = a act (Last (Just a)) _ = a

instance Act (Last a) (Product a) where act = gact

or where two product are matched piecewise (e.g. field by field)

instance Act (Last a) (Identity a) where act (Last Nothing) a = a act (Last (Just a)) _ = Identity a

data Product' f = Product' (f a) (f b) derive Generic

instance Act (Product' Last) (Product' Identity) where act = gpact

Synopsis

Documentation

gact :: (Generic a, GAct s (Rep a)) => s -> a -> a Source #

Action of s on a via `Rep a`.

newtype GenericAct s a Source #

A newtype wrapper for deriving via.

Constructors

GenericAct 

Fields

Instances

Instances details
(Generic s, Generic a, GAct s (Rep a), Semigroup s) => Act s (GenericAct s a) Source # 
Instance details

Defined in Data.Act.Generic

Methods

(•) :: s -> GenericAct s a -> GenericAct s a #

act :: s -> GenericAct s a -> GenericAct s a #

gpact :: (Generic s, Generic a, GPAct (Rep s) (Rep a)) => s -> a -> a Source #

Action of s on a via action of `Rep s` on `Rep a`.