Copyright | (C) 2015-2016 Ryan Scott |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | Ryan Scott |

Portability | Template Haskell |

Safe Haskell | None |

Language | Haskell2010 |

Exports functions to mechanically derive `Ord`

, `Ord1`

, and `Ord2`

instances.

- deriveOrd :: Name -> Q [Dec]
- makeCompare :: Name -> Q Exp
- makeLT :: Name -> Q Exp
- makeLE :: Name -> Q Exp
- makeGT :: Name -> Q Exp
- makeGE :: Name -> Q Exp
- makeMax :: Name -> Q Exp
- makeMin :: Name -> Q Exp
- deriveOrd1 :: Name -> Q [Dec]
- makeLiftCompare :: Name -> Q Exp
- makeCompare1 :: Name -> Q Exp
- deriveOrd2 :: Name -> Q [Dec]
- makeLiftCompare2 :: Name -> Q Exp
- makeCompare2 :: Name -> Q Exp

`Ord`

deriveOrd :: Name -> Q [Dec] Source #

Generates an `Ord`

instance declaration for the given data type or data
family instance.

makeLT :: Name -> Q Exp Source #

Generates a lambda expression which behaves like '(<)' (without
requiring an `Ord`

instance).

makeLE :: Name -> Q Exp Source #

Generates a lambda expression which behaves like '(<=)' (without
requiring an `Ord`

instance).

makeGT :: Name -> Q Exp Source #

Generates a lambda expression which behaves like '(>)' (without
requiring an `Ord`

instance).

makeGE :: Name -> Q Exp Source #

Generates a lambda expression which behaves like '(>=)' (without
requiring an `Ord`

instance).

`Ord1`

deriveOrd1 :: Name -> Q [Dec] Source #

Generates an `Ord1`

instance declaration for the given data type or data
family instance.

makeLiftCompare :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `liftCompare`

(without
requiring an `Ord1`

instance).

This function is not available with `transformers-0.4`

.

makeCompare1 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `compare1`

(without
requiring an `Ord1`

instance).

`Ord2`

deriveOrd2 :: Name -> Q [Dec] Source #

Generates an `Ord2`

instance declaration for the given data type or data
family instance.

This function is not available with `transformers-0.4`

.

makeLiftCompare2 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `liftCompare2`

(without
requiring an `Ord2`

instance).

This function is not available with `transformers-0.4`

.

makeCompare2 :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `compare2`

(without
requiring an `Ord2`

instance).

This function is not available with `transformers-0.4`

.

`deriveOrd`

limitations

Be aware of the following potential gotchas:

- Type variables of kind
`*`

are assumed to have`Ord`

constraints. Type variables of kind`* -> *`

are assumed to have`Ord1`

constraints. Type variables of kind`* -> * -> *`

are assumed to have`Ord2`

constraints. If this is not desirable, use`makeCompare`

or one of its cousins. - The
`Ord1`

class had a different definition in`transformers-0.4`

, and as a result,`deriveOrd1`

implements different instances for the`transformers-0.4`

`Ord1`

than it otherwise does. Also,`makeLiftCompare`

is not available when this library is built against`transformers-0.4`

, only 'makeCompare1. - The
`Ord2`

class is not available in`transformers-0.4`

, and as a result, neither are Template Haskell functions that deal with`Ord2`

when this library is built against`transformers-0.4`

.