generic-deriving-1.12.3: Generic programming library for generalised deriving.

Safe HaskellSafe
LanguageHaskell2010

Generics.Deriving.Semigroup

Contents

Synopsis

Generic semigroup class

class GSemigroup a where #

Methods

gsappend :: a -> a -> a infixr 6 #

gsappend :: (Generic a, GSemigroup' (Rep a)) => a -> a -> a infixr 6 #

gstimes :: Integral b => b -> a -> a #

gsconcat :: NonEmpty a -> a #

Only available with base-4.9 or later

Instances

GSemigroup Ordering # 
GSemigroup () # 

Methods

gsappend :: () -> () -> () #

gstimes :: Integral b => b -> () -> () #

gsconcat :: NonEmpty () -> () #

GSemigroup Void # 

Methods

gsappend :: Void -> Void -> Void #

gstimes :: Integral b => b -> Void -> Void #

gsconcat :: NonEmpty Void -> Void #

GSemigroup All # 

Methods

gsappend :: All -> All -> All #

gstimes :: Integral b => b -> All -> All #

gsconcat :: NonEmpty All -> All #

GSemigroup Any # 

Methods

gsappend :: Any -> Any -> Any #

gstimes :: Integral b => b -> Any -> Any #

gsconcat :: NonEmpty Any -> Any #

GSemigroup [a] # 

Methods

gsappend :: [a] -> [a] -> [a] #

gstimes :: Integral b => b -> [a] -> [a] #

gsconcat :: NonEmpty [a] -> [a] #

GSemigroup a => GSemigroup (Maybe a) # 

Methods

gsappend :: Maybe a -> Maybe a -> Maybe a #

gstimes :: Integral b => b -> Maybe a -> Maybe a #

gsconcat :: NonEmpty (Maybe a) -> Maybe a #

GSemigroup a => GSemigroup (Identity a) # 

Methods

gsappend :: Identity a -> Identity a -> Identity a #

gstimes :: Integral b => b -> Identity a -> Identity a #

gsconcat :: NonEmpty (Identity a) -> Identity a #

Ord a => GSemigroup (Min a) # 

Methods

gsappend :: Min a -> Min a -> Min a #

gstimes :: Integral b => b -> Min a -> Min a #

gsconcat :: NonEmpty (Min a) -> Min a #

Ord a => GSemigroup (Max a) # 

Methods

gsappend :: Max a -> Max a -> Max a #

gstimes :: Integral b => b -> Max a -> Max a #

gsconcat :: NonEmpty (Max a) -> Max a #

GSemigroup (First a) # 

Methods

gsappend :: First a -> First a -> First a #

gstimes :: Integral b => b -> First a -> First a #

gsconcat :: NonEmpty (First a) -> First a #

GSemigroup (Last a) # 

Methods

gsappend :: Last a -> Last a -> Last a #

gstimes :: Integral b => b -> Last a -> Last a #

gsconcat :: NonEmpty (Last a) -> Last a #

GMonoid m => GSemigroup (WrappedMonoid m) # 
GSemigroup a => GSemigroup (Option a) # 

Methods

gsappend :: Option a -> Option a -> Option a #

gstimes :: Integral b => b -> Option a -> Option a #

gsconcat :: NonEmpty (Option a) -> Option a #

GSemigroup (NonEmpty a) # 

Methods

gsappend :: NonEmpty a -> NonEmpty a -> NonEmpty a #

gstimes :: Integral b => b -> NonEmpty a -> NonEmpty a #

gsconcat :: NonEmpty (NonEmpty a) -> NonEmpty a #

GSemigroup a => GSemigroup (Dual a) # 

Methods

gsappend :: Dual a -> Dual a -> Dual a #

gstimes :: Integral b => b -> Dual a -> Dual a #

gsconcat :: NonEmpty (Dual a) -> Dual a #

GSemigroup (Endo a) # 

Methods

gsappend :: Endo a -> Endo a -> Endo a #

gstimes :: Integral b => b -> Endo a -> Endo a #

gsconcat :: NonEmpty (Endo a) -> Endo a #

Num a => GSemigroup (Sum a) # 

Methods

gsappend :: Sum a -> Sum a -> Sum a #

gstimes :: Integral b => b -> Sum a -> Sum a #

gsconcat :: NonEmpty (Sum a) -> Sum a #

Num a => GSemigroup (Product a) # 

Methods

gsappend :: Product a -> Product a -> Product a #

gstimes :: Integral b => b -> Product a -> Product a #

gsconcat :: NonEmpty (Product a) -> Product a #

GSemigroup (First a) # 

Methods

gsappend :: First a -> First a -> First a #

gstimes :: Integral b => b -> First a -> First a #

gsconcat :: NonEmpty (First a) -> First a #

GSemigroup (Last a) # 

Methods

gsappend :: Last a -> Last a -> Last a #

gstimes :: Integral b => b -> Last a -> Last a #

gsconcat :: NonEmpty (Last a) -> Last a #

GSemigroup a => GSemigroup (Down a) # 

Methods

gsappend :: Down a -> Down a -> Down a #

gstimes :: Integral b => b -> Down a -> Down a #

gsconcat :: NonEmpty (Down a) -> Down a #

(Generic a, GSemigroup' * (Rep a)) => GSemigroup (Default a) #

Semigroups often have many sensible implementations of <> / gsappend, and therefore no sensible default. Indeed, there is no GSemigroup' instance for representations of sum types.

In other cases, one may wish to use the existing wrapper newtypes in base, such as the following (using First):

newtype FirstSemigroup = FirstSemigroup Bool
  deriving stock (Eq, Show)
  deriving (GSemigroup) via (First Bool)

Methods

gsappend :: Default a -> Default a -> Default a #

gstimes :: Integral b => b -> Default a -> Default a #

gsconcat :: NonEmpty (Default a) -> Default a #

GSemigroup b => GSemigroup (a -> b) # 

Methods

gsappend :: (a -> b) -> (a -> b) -> a -> b #

gstimes :: Integral b => b -> (a -> b) -> a -> b #

gsconcat :: NonEmpty (a -> b) -> a -> b #

GSemigroup (Either a b) # 

Methods

gsappend :: Either a b -> Either a b -> Either a b #

gstimes :: Integral b => b -> Either a b -> Either a b #

gsconcat :: NonEmpty (Either a b) -> Either a b #

(GSemigroup a, GSemigroup b) => GSemigroup (a, b) # 

Methods

gsappend :: (a, b) -> (a, b) -> (a, b) #

gstimes :: Integral b => b -> (a, b) -> (a, b) #

gsconcat :: NonEmpty (a, b) -> (a, b) #

GSemigroup (Proxy k s) # 

Methods

gsappend :: Proxy k s -> Proxy k s -> Proxy k s #

gstimes :: Integral b => b -> Proxy k s -> Proxy k s #

gsconcat :: NonEmpty (Proxy k s) -> Proxy k s #

(GSemigroup a, GSemigroup b, GSemigroup c) => GSemigroup (a, b, c) # 

Methods

gsappend :: (a, b, c) -> (a, b, c) -> (a, b, c) #

gstimes :: Integral b => b -> (a, b, c) -> (a, b, c) #

gsconcat :: NonEmpty (a, b, c) -> (a, b, c) #

GSemigroup a => GSemigroup (Const k a b) # 

Methods

gsappend :: Const k a b -> Const k a b -> Const k a b #

gstimes :: Integral b => b -> Const k a b -> Const k a b #

gsconcat :: NonEmpty (Const k a b) -> Const k a b #

Alternative f => GSemigroup (Alt * f a) # 

Methods

gsappend :: Alt * f a -> Alt * f a -> Alt * f a #

gstimes :: Integral b => b -> Alt * f a -> Alt * f a #

gsconcat :: NonEmpty (Alt * f a) -> Alt * f a #

(GSemigroup a, GSemigroup b, GSemigroup c, GSemigroup d) => GSemigroup (a, b, c, d) # 

Methods

gsappend :: (a, b, c, d) -> (a, b, c, d) -> (a, b, c, d) #

gstimes :: Integral b => b -> (a, b, c, d) -> (a, b, c, d) #

gsconcat :: NonEmpty (a, b, c, d) -> (a, b, c, d) #

(GSemigroup a, GSemigroup b, GSemigroup c, GSemigroup d, GSemigroup e) => GSemigroup (a, b, c, d, e) # 

Methods

gsappend :: (a, b, c, d, e) -> (a, b, c, d, e) -> (a, b, c, d, e) #

gstimes :: Integral b => b -> (a, b, c, d, e) -> (a, b, c, d, e) #

gsconcat :: NonEmpty (a, b, c, d, e) -> (a, b, c, d, e) #

(GSemigroup a, GSemigroup b, GSemigroup c, GSemigroup d, GSemigroup e, GSemigroup f) => GSemigroup (a, b, c, d, e, f) # 

Methods

gsappend :: (a, b, c, d, e, f) -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) #

gstimes :: Integral b => b -> (a, b, c, d, e, f) -> (a, b, c, d, e, f) #

gsconcat :: NonEmpty (a, b, c, d, e, f) -> (a, b, c, d, e, f) #

(GSemigroup a, GSemigroup b, GSemigroup c, GSemigroup d, GSemigroup e, GSemigroup f, GSemigroup g) => GSemigroup (a, b, c, d, e, f, g) # 

Methods

gsappend :: (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) #

gstimes :: Integral b => b -> (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) #

gsconcat :: NonEmpty (a, b, c, d, e, f, g) -> (a, b, c, d, e, f, g) #

(GSemigroup a, GSemigroup b, GSemigroup c, GSemigroup d, GSemigroup e, GSemigroup f, GSemigroup g, GSemigroup h) => GSemigroup (a, b, c, d, e, f, g, h) # 

Methods

gsappend :: (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) #

gstimes :: Integral b => b -> (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) #

gsconcat :: NonEmpty (a, b, c, d, e, f, g, h) -> (a, b, c, d, e, f, g, h) #

Default definition

gsappenddefault :: (Generic a, GSemigroup' (Rep a)) => a -> a -> a infixr 6 #

Internal semigroup class

class GSemigroup' f where #

Minimal complete definition

gsappend'

Methods

gsappend' :: f x -> f x -> f x infixr 6 #

Instances

GSemigroup' * U1 # 

Methods

gsappend' :: f x -> f x -> f x #

GSemigroup a => GSemigroup' * (K1 i a) # 

Methods

gsappend' :: f x -> f x -> f x #

(GSemigroup' * f, GSemigroup' * g) => GSemigroup' * ((:*:) f g) # 

Methods

gsappend' :: f x -> f x -> f x #

GSemigroup' * f => GSemigroup' * (M1 i c f) # 

Methods

gsappend' :: f x -> f x -> f x #