origami-0.0.5: An un-SYB framework for transforming heterogenous data through folds

Safe HaskellNone
LanguageHaskell2010

Data.Origami.Internal.Fold

Contents

Description

Folds over the fold family rooted at FoldFamily.

Synopsis

The Fold structure and useful instances

data Fold dataCase dataField dataTy foldFamily ty Source

The fold. Bundles up the functions used to replace constructors in the fold family.

Constructors

Fold 

Fields

mkAtomic :: ty -> dataField
 
mkBifunct :: Name -> dataField -> dataField -> dataField
 
mkDataCase :: Name -> [dataField] -> dataCase
 
mkDataTy :: Name -> [dataCase] -> dataTy
 
mkFoldFamily :: [dataTy] -> foldFamily
 
mkFunct :: Name -> dataField -> dataField
 
mkNonatomic :: ty -> dataField
 
mkTrifunct :: Name -> dataField -> dataField -> dataField -> dataField
 
mkTy :: Name -> ty
 

idFold :: Fold DataCase DataField DataTy FoldFamily Ty Source

The identity Fold. Intended as a base to be modified.

errFold :: String -> Fold dataCase dataField dataTy foldFamily ty Source

The error Fold. Intended as a base to be modified.

monadicFold :: Monad m => Fold dataCase dataField dataTy foldFamily ty -> Fold (m dataCase) (m dataField) (m dataTy) (m foldFamily) (m ty) Source

Using the constructors from the base Fold, folds monadically in a bottom-up, left-to-right manner.

folding functions

foldFoldFamily :: Fold dataCase dataField dataTy foldFamily ty -> FoldFamily -> foldFamily Source

Monadically folds over a FoldFamily

foldDataTy :: Fold dataCase dataField dataTy foldFamily ty -> DataTy -> dataTy Source

Monadically folds over a DataTy

foldDataCase :: Fold dataCase dataField dataTy foldFamily ty -> DataCase -> dataCase Source

Monadically folds over a DataCase

foldDataField :: Fold dataCase dataField dataTy foldFamily ty -> DataField -> dataField Source

Monadically folds over a DataField

foldTy :: Fold dataCase dataField dataTy foldFamily ty -> Ty -> ty Source

Monadically folds over a FoldTy