HAppS-Data-0.9.3: HAppS data manipulation librariesSource codeContentsIndex
HAppS.Data.Default
PortabilityNot portable
Stabilityexperimental
MaintainerAlexJacobson@HAppS.org
Contents
The interface
Writing your own instances
Advanced usage
Description
Provides default values for Haskell datatypes.
Synopsis
class Data DefaultD a => Default a where
defaultValue :: a
defaultDefaultValue :: (Data DefaultD a, Default a) => a
data DefaultD a = DefaultD {
defaultValueD :: a
}
defaultProxy :: Proxy DefaultD
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 HAppS.Data.Default.Generic.

Methods
defaultValue :: aSource
show/hide Instances
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
defaultValueD :: a
show/hide Instances
defaultProxy :: Proxy DefaultDSource
When writing your own generic functions for Default you may need this, the proxy value.
Produced by Haddock version 2.4.2