th-utilities

Collection of useful functions for use with Template Haskell

https://github.com/fpco/th-utilities#readme

Version on this page:0.2.4.0
LTS Haskell 22.14:0.2.5.0
Stackage Nightly 2024-03-28:0.2.5.0
Latest on Hackage:0.2.5.0

See all snapshots th-utilities appears in

MIT licensed
Maintained by Michael Sloan
This version can be pinned in stack with:th-utilities-0.2.4.0@sha256:ba19cd8441aa43dbaed40e9055bb5a7cbd7cf9e154f5253c6bf9293af8b1f96b,1869

Module documentation for 0.2.4.0

th-utilities

Build Status

The ‘th-utilities’ package provides a number of useful utilities for Template Haskell. In particular:

  • TH.Derive provides a convenient system for using TH to derive typeclass instances. It allows for open registration of TH derivers, and reuses instance syntax for invoking them.

  • TH.ReifyDataType provides utilities for reifying simplified datatype info. It omits details that you don’t usually want to handle, making it much more straightforward to generate code based on datatype structure.

  • TH.RelativePaths provides utilities for loading files based on paths relative to the cabal file. This is particularly handy for loading code into ghci even when its current dir isn’t the package dir. Ideally, this module would be used by everyone who currently uses qAddDependentFile.

  • TH.Utilities provides a miscellaneous set of utilities that are useful within this package and elsewhere.

Changes

ChangeLog

0.2.4.0

  • Compatibility with GHC-8.10

  • Behavior change in reification of type family instances. Instead of erroring if the instance mentions a kind variable, now just ignores it.

0.2.3.1

  • Compatibility with GHC-8.8

0.2.3.0

  • Improved fix to the type variable behavior with GHC <= 7.10. Uses Any in place of type variables instead of (), to allow for more kinds than just * and Constraint.

0.2.2.0

  • Fixes derive and instantiator mechanisms to work with ghc 7.10 and earlier. Previously, invocation was broken when type variables were used.

  • Fixes freeVarsT - it now looks through more constructors of Type.

  • Adds dequalifyTyVars to dequalify every type variable.

0.2.0.1

  • Fixes build on 7.8

  • Fixes warnings

0.2.0.0

  • Adds TH.ReifySimple, which supports reifying most of the information TH users care about.

  • Adds some utilities based on SYB, which is often useful for TH.

  • Makes relative path stuff less noisyi with GHCi.

0.1.0.0

  • First public release