Generate default function implementations for complex type classes.


Version on this page:
LTS Haskell 22.23:0.0.3
Stackage Nightly 2024-05-27:0.0.3
Latest on Hackage:0.0.3

See all snapshots flexible-defaults appears in

LicenseRef-PublicDomain licensed and maintained by James Cook
This version can be pinned in stack with:flexible-defaults-,2821

Module documentation for

  • Language
    • Language.Haskell
      • Language.Haskell.TH
        • Language.Haskell.TH.FlexibleDefaults

Template Haskell code to implement default implementations for type-class functions based on which functions are already implemented. Currently extremely crude but still fairly effective.

When defining a type class with many functions, each of which can be implemented based on arbitrary subsets of the others, the standard default-implementation concept breaks down quite badly. This library provides a system by which more complex rules can be described for choosing default implementations based on which ones the user supplies. These implementations can additionally be given "suitability scores", so that when multiple possible choices could be made, the library can choose the "best" one.

Changes in Updated for Template Haskell changes in GHC 7.6

Changes in v0.0.0.3: Added a hack to fix under GHC 7.2.

Changes in v0.0.0.2: Nothing at all except setting 'buildable: False' under GHC 7.2.1.