| Portability | Not portable |
|---|---|
| Stability | experimental |
| Maintainer | happs@googlegroups.com |
Happstack.Data.Normalize
Description
Normalizing Haskell values.
- class Data NormalizeD a => Normalize a where
- normalize :: a -> a
- normalizeRecursively :: a -> a
- defaultNormalize :: Normalize a => a -> a
- defaultNormalizeRecursively :: Normalize a => a -> a
- data NormalizeD a = NormalizeD {
- normalizeD :: a -> a
- normalizeRecursivelyD :: a -> a
- normalizeProxy :: Proxy NormalizeD
The interface
class Data NormalizeD a => Normalize a whereSource
The Normalize class provides a normalize function, which
is intended to normalize values only at the top-level constructor,
and a normalizeRecursively function, which is intended to
normalize all the subvalues and then normalize the top-level
constructor.
There is a default instance that matches all types, where normalize
is id and normalizeRecursively applies normalizeRecursively to
all of its children and then normalize to the result.
If you want to actually do some normalization for a certain type, then just define an instance for that type; this will take precedence over the default instance.
Instances
| Data NormalizeD a => Normalize a |
Writing your own instances
defaultNormalize :: Normalize a => a -> aSource
defaultNormalizeRecursively :: Normalize a => a -> aSource
This is the normalizeRecursively function in the default
Normalize instance. It may be a useful building block when writing
your own instances.
Advanced usage
data NormalizeD a Source
When writing your own generic functions for Normalize you may
need to access the class methods through this datatype rather than
directly.
Constructors
| NormalizeD | |
Fields
| |
Instances
| Normalize t => Sat (NormalizeD t) |
normalizeProxy :: Proxy NormalizeDSource
When writing your own generic functions for Normalize you may
need this, the proxy value.