Module documentation for 0.1.2.1

one-liner-instances

This package uses machinery from one-liner in order to provide default
implementations for methods from Num, Fractional, Floating, Semigroup,
Monoid, Bounded, Eq, Ord, and Random. These will work for any types
(deriving Generic) whose fields are all instances of that typeclass.

For Num, Fractional, Floating, Semigroup, and Monoid, the types also
must have only a single constructor. Random methods offer variants with
single constructors (for performance) and with multiple constructors.

Comparisons

There are a few major design differences between generic-deriving and
one-liner, the package that this one is built on.

generic-deriving creates a separate “deriving” typeclass for every
typeclass one wants to generalize. So, there is a separate GMonoid
typeclass, a separate GEnum typeclass, etc.

one-liner instead creates a single typeclass (ADTRecord and Constraints)
to unify all generalizable typeclasses. Both the generic Monoid and generic
Num instances are built upon the same Constraints typeclass. From a
usability standpoint, one-liner allows one to easily create generic versions
of their own, custom typeclasses – something that generic-deriving does not
help with.

one-liner-instances, however, is simply a package using the one-liner
engine to provide generic instances for common classes where it is possible.

The main difference in practical usability between one-liner-instances and
generic-deriving themselves are few, but are mainly:

one-liner-instances has generic implementations for
Num/Fractional/Floating, and generic-deriving doesn’t. This is a
superficial difference, however, since nothing fundamental is preventing
generic-deriving from adding them in the future.

one-liner-instances provides newtype wrappers that can automatically
imbue appropriate types with instances, which can be used with the upcoming
DerivingVia syntax to automatically derive instances, or just used on
their own for convenience purposes.

generic-deriving does not aim to do this at this moment.

Integrates with the rest of the one-liner ecosystem, if one is already
using it to provide constraints for custom typeclasses.