Copyright | (c) Justin Le 2018 |
---|---|

License | BSD-3 |

Maintainer | justin@jle.im |

Stability | unstable |

Portability | portable |

Safe Haskell | None |

Language | Haskell2010 |

Derived methods for `Eq`

and `Ord`

, using Generics.OneLiner and
GHC.Generics.

Can be used for any types (deriving `Generic`

) where every field is an
instance of `Eq`

(or `Ord`

).

Also includes a newtype wrapper that imbues any such data type with
instant `Eq`

and `Ord`

instances, which can one day be used with
*DerivingVia* syntax to derive instances automatically.

- newtype GOrd a = GOrd {
- getGOrd :: a

- gEquals :: forall a. (ADT a, Constraints a Eq) => a -> a -> Bool
- gNotEquals :: forall a. (ADT a, Constraints a Eq) => a -> a -> Bool
- gCompare :: forall a. (ADT a, Constraints a Ord) => a -> a -> Ordering
- gLTE :: forall a. (ADT a, Constraints a Ord) => a -> a -> Bool
- gLT :: forall a. (ADT a, Constraints a Ord) => a -> a -> Bool
- gGTE :: forall a. (ADT a, Constraints a Ord) => a -> a -> Bool
- gGT :: forall a. (ADT a, Constraints a Ord) => a -> a -> Bool
- gMax :: forall a. (ADT a, Constraints a Ord) => a -> a -> a
- gMin :: forall a. (ADT a, Constraints a Ord) => a -> a -> a

# Newtype wrapper

If `a`

is a data type whose fields are all instances of `Eq`

, then

has a `GOrd`

a`Eq`

instance.

If `a`

is a data type whose fields are all instances of `Ord`

, then

has a `GOrd`

a`Ord`

instance.

Will one day be able to be used with *DerivingVia* syntax, to derive
instances automatically.

Functor GOrd Source # | |

Foldable GOrd Source # | |

Traversable GOrd Source # | |

(ADT a, Constraints a Eq) => Eq (GOrd a) Source # | |

Data a => Data (GOrd a) Source # | |

(ADT a, Constraints a Eq, Constraints a Ord) => Ord (GOrd a) Source # | |

Read a => Read (GOrd a) Source # | |

Show a => Show (GOrd a) Source # | |

Generic (GOrd a) Source # | |

type Rep (GOrd a) Source # | |

# Generics-derived methods

## Eq

gNotEquals :: forall a. (ADT a, Constraints a Eq) => a -> a -> Bool Source #