deriving-compat-0.5.9: Backports of GHC deriving extensions

Copyright | (C) 2015-2017 Ryan Scott
License | BSD-style (see the file LICENSE)
Maintainer | Ryan Scott
Portability | Template Haskell
Safe Haskell | None
Language | Haskell2010

Data.Ix.Deriving

Contents

- `Ix`
- `deriveIx` limitations

Description

Exports functions to mechanically derive `Ix` instances.

Synopsis

- deriveIx :: Name -> Q [Dec]
- makeRange :: Name -> Q Exp
- makeUnsafeIndex :: Name -> Q Exp
- makeInRange :: Name -> Q Exp

# `Ix`

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

Generates a `Ix` instance declaration for the given data type or data family instance.

makeRange :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `range` (without requiring an `Ix` instance).

makeUnsafeIndex :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `unsafeIndex` (without requiring an `Ix` instance).

makeInRange :: Name -> Q Exp Source #

Generates a lambda expression which behaves like `inRange` (without requiring an `Ix` instance).

# `deriveIx` limitations

Be aware of the following potential gotchas:

- Type variables of kind `*` are assumed to have `Ix` constraints. If this is not desirable, use `makeRange` or one of its cousins.