th-fold-0.0.0.1: TH fold generator

Language.Haskell.TH.Fold

Description

This is "very old" code and I'd like to clean it up, but it more or less works so it's a pretty low priority right now.

My apologies for inflicting this code upon the world ( ;-) ), but I did not see anything else "out there", so I figured I'd provide a seed crystal around which something better might form.

Synopsis

Documentation

fold :: Name -> ExpQSource

Generate a very basic fold operation given the Name of a type constructor. Data constructors of the specified type become function parameters to the fold, in the same order the type defines them. Simple recursive references in the type's constructors become recursive calls to the fold.

At present this only properly handles very simple types. Basically, that means types that have no parameters, types with one parameter where the only recursion is via field slots with types of the form 'T a' where a is the type of the parameter, and more complicated types without recursion.