happstack-data-6.0.0: Happstack data manipulation libraries

PortabilityNot portable
Stabilityexperimental
Maintainerhapps@googlegroups.com

Happstack.Data.Default

Contents

Description

Provides default values for Haskell datatypes.

Synopsis

The interface

class Data DefaultD a => Default a whereSource

The Default class provides a defaultValue value, which is the default value for that type.

There is no instance for arbitrary types by default, but if you declare an instance without providing the value then one will be built using the first constructor. defaultValue is used to provide values for any arguments of the constructor.

If you want an instance for all types then import Happstack.Data.Default.Generic.

Methods

defaultValue :: aSource

Writing your own instances

defaultDefaultValue :: (Data DefaultD a, Default a) => aSource

This is the defaultValue that is used in an instance if you don't specify one. It may be a useful building block when writing your own instances.

Advanced usage

data DefaultD a Source

When writing your own generic functions for Default you may need to access the class method through this datatype rather than directly.

Constructors

DefaultD 

Fields

defaultValueD :: a
 

Instances

Default t => Sat (DefaultD t) 

defaultProxy :: Proxy DefaultDSource

When writing your own generic functions for Default you may need this, the proxy value.