happstack-data-6.0.1: Happstack data manipulation libraries

PortabilityNot portable
Stabilityexperimental
Maintainerhapps@googlegroups.com
Safe HaskellNone

Happstack.Data.Normalize

Contents

Description

Normalizing Haskell values.

Synopsis

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

Writing your own instances

defaultNormalize :: Normalize a => a -> aSource

This is the normalize function in the default Normalize instance. It may be a useful building block when writing your own instances.

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

normalizeD :: a -> a
 
normalizeRecursivelyD :: a -> a
 

Instances

normalizeProxy :: Proxy NormalizeDSource

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