semigroups-actions-0.1: Semigroups actions

Safe HaskellSafe-Inferred

Data.Semigroup.Act

Synopsis

Documentation

class Semigroup g => SemigroupAct g a whereSource

Represents an action of semigroup g to set a.

Laws: Endo . act must be a homomorphism of semigroups.

Methods

act :: g -> a -> aSource

Instances

(Semigroup (Sum n), Bounded a, Enum a, Integral n) => SemigroupAct (Sum n) (EnumBoundedIntAct a) 
(Semigroup (Sum n), Integral n, Enum a) => SemigroupAct (Sum n) (EnumIntAct a) 
(Semigroup (Product n), Monoid w, Whole n) => SemigroupAct (Product n) (Repeat w)

The implementation uses times1p which is defined very efficiently for most semigroups.

(Semigroup (SelfAct g), Semigroup g) => SemigroupAct (SelfAct g) (SelfAct g) 
(Semigroup (Option g), SemigroupAct g a, Semigroup g) => SemigroupAct (Option g) (OptionSet g a) 

class (Monoid g, SemigroupAct g a) => MonoidAct g a Source

Represents an action of monoid g to set a.

Laws: Endo . act must be a homomorphism of monoids.

newtype OptionSet g a Source

A wrapper for constructing a monoid action from Option.

Constructors

OptionSet 

Fields

getOptionSet :: a
 

newtype SelfAct a Source

A wrapper for a group acting on itself.

Constructors

SelfAct a 

Instances

newtype Repeat a Source

A wrapper for represeting the action of natural numbers with multiplication on a monoid.

Constructors

Repeat 

Fields

unwrapRepeat :: a
 

Instances

Functor Repeat 
Eq a => Eq (Repeat a) 
(Eq (Repeat a), Ord a) => Ord (Repeat a) 
Read a => Read (Repeat a) 
Show a => Show (Repeat a) 
(Semigroup (Product n), Monoid w, Whole n) => SemigroupAct (Product n) (Repeat w)

The implementation uses times1p which is defined very efficiently for most semigroups.