module Pandora.Pattern.Object.Group (Group (..)) where

import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))
import Pandora.Pattern.Object.Monoid (Monoid)

infixl 6 -

{- |
> When providing a new instance, you should ensure it satisfies the two laws:
> * Right absorption: x + invert x ≡ zero
> * Left absorption: invert x + x ≡ zero
-}

class Monoid a => Group a where
	{-# MINIMAL invert #-}
	invert :: a -> a

	(-) :: a -> a -> a
	a
x - a
y = a
x a -> a -> a
forall a. Semigroup a => a -> a -> a
+ a -> a
forall a. Group a => a -> a
invert a
y