Haskellers are usually familiar with monoids. A monoid has an appending operation
mappend and an identity element
mempty. A Semigroup has an append
<>, but does not require an
mempty element. A Monoid can be made a Semigroup with just
instance Semigroup MyMonoid
More formally, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. A semigroup generalizes a monoid in that there might not exist an identity element. It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, thus the name semigroup.
Data.List.NonEmpty were added to
base as of 18.104.22.168. This package now offers a backwards-compatible API and some tools for deriving semigroups with generics.
Contributions and bug reports are welcome!
Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.
ST, which were added in
IO, as well as for
Generic1instances back to GHC 7.2, and expose the
Data.Semigroup.Genericmodule on GHC 7.2
- Depend on the
bytestring-builderpackage to ensure
Semigroupinstances for bytestring
ShortByteStringare always defined
- Allow building with
Add the missing instance for
Added support for
Removed the partial functions
sortWithto match the "Comprehensive comprehensions" paper and
times1pin favor of
Cleaned up imports to remove warnings on GHC 7.10.
Restored the ability to build on GHC < 7.6. (
Generic1deriving was only added in GHC 7.6)
GSemigroupclass for generically deriving Semigroup instances.
Arg a bwhich only compares for equality/order on its first argument, which can be used to compute
Arginstance to avoid orphans for GHC 7.10+.
- Added missing
Data.Monoid.Genericmodule to source control.
Semigroupinstances for various Builder constructions in
deepseqversion bound for GHC 7.10 compatibility.
timesNare now reduced to accepting only a
Wholedoesn't exist in GHC 7.10's Numeric.Natural, and
natsversion 1 has removed support for the class.
Data.Coerce.coerceon GHC 7.8+ to reduce the number of eta-expansions in the resulting core.
- Avoid conflict with pending
instance NFData a => NFData (NonEmpty a)
NFDatainstances for the types in Data.Semigroup
Fixed a Trustworthiness problem for GHC 7.8+
Nathan van Doorn fixed a number of embarrassing bugs in the
instance IsList NonEmpty
Allow for manual removal of dependencies to support advanced sandbox users who explicitly want to avoid compiling certain dependencies they know they aren't using.
We will fix bugs caused by any combination of these package flags, but the API of the package should be considered the default build configuration with all of the package dependency flags enabled.
Will now build as full-fledged
SafeHaskell if you configure with -f-hashable.
Added some missing
ghc-primon GHC 7.4.
Added instances for 'Generic', 'Foldable', 'Traversable', 'Enum', 'Functor', 'Hashable', 'Applicative', 'Monad' and 'MonadFix'
Vastly widened the dependency bound on
- Updated to support the new version of
- Added an instance for
Added the missing instance for
Added support for
(<>)in terms of
Numeric.Naturalto a separate