template-default: declaring Default instances just got even easier

[ bsd3, data, library ] [ Propose Tags ] [ Report a vulnerability ]

Declaring instances of the Default type class has always been pretty mechanical. This package makes the compiler do the mechanical bit. This has the benefit that even less thought is required, and the instance will automatically be corrected when the definition of the data type changes (say, to add more arguments to the constructor). Usage looks like this, for example:

(-# LANGUAGE TemplateHaskell #-)
import Data.Default.TH
data List a = Nil | Cons a (List a)
deriveDefault ''List

This example results in the following instance:

instance Data.Default.Default (List a_ad2) where
  Data.Default.def = Nil

Modules

[Last Documentation]

  • Data
    • Default
      • Data.Default.TH

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1, 0.1.1, 0.1.2
Dependencies base (>=3 && <6), data-default, template-haskell (>=2.4 && <2.11) [details]
License BSD-3-Clause
Copyright Daniel Wagner 2012
Author Daniel Wagner
Maintainer Daniel Wagner <daniel@wagner-home.com>
Category Data
Home page https://github.com/haskell-pkg-janitors/template-default
Uploaded by DanielWagner at 2016-06-03T05:31:47Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2274 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2016-11-24 [all 3 reports]