template-default

Version 0.1.2 revision 0 uploaded by DanielWagner.

Package meta

Synopsis
declaring Default instances just got even easier
Description

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
Author
Daniel Wagner
Bug reports
n/a
Category
Data
Copyright
Daniel Wagner 2012
Homepage
https://github.com/haskell-pkg-janitors/template-default
Maintainer
Daniel Wagner <daniel@wagner-home.com>
Package URL
n/a
Stability
n/a

Components