The template-default package

[Tags: bsd3, library]

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

Properties

Versions0.1, 0.1.1
Dependenciesbase (>=3 && <6), data-default, template-haskell (>=2.4 && <2.9)
LicenseBSD3
CopyrightDaniel Wagner 2012
AuthorDaniel Wagner
MaintainerDaniel Wagner <daniel@wagner-home.com>
CategoryData
Home pagehttps://github.com/haskell-pkg-janitors/template-default
Upload dateThu Mar 21 22:10:24 UTC 2013
Uploaded byGregoryCollins
DistributionsNixOS:0.1.1
Downloads184 total (12 in last 30 days)

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees