DrIFT is a type sensitive preprocessor for Haskell. The project extracts type declarations and directives from modules. The directives cause rules to be fired on the parsed type declarations, generating new code which is then appended to the bottom of the input file. The rules are expressed as Haskell code, and it is intended that the user can add new rules as required.
DrIFT automates instance derivation for classes that aren't supported by the standard compilers. In addition, instances can be produced in seperate modules to that containing the type declaration. This allows instances to be derived for a type after the original module has been compiled. As a bonus, simple utility functions can also be produced from a type.
Here are some key features of "DrIFT":
· DrIFT comes with a set of rules to produce instances for all derivable classes given in the Hasekell Prelude. There are also a number of extra useful rules to derive instances of a variety of useful classes.
· DrIFT performs import chasing to find the definition of a type.
· Code is generated using pretty-printing combinators. This means that the output is (fairly) well formatted, and easy on the eye.
· Effort has been made to make the rule interface as easy to use as possible. This is to allow users to add rules to generate code specific to their own projects. As the rules are themselves written in Haskell, the user doesn't have to learn a new language to express rules.
Currently supported derivations include:
Binary Data.Binary binary encoding of terms
BitsBinary efficient binary encoding of terms
GhcBinary byte sized binary encoding of terms
Arbitrary Derive reasonable Arbitrary for QuickCheck
Observable HOOD observable
NFData provides 'rnf' to reduce to normal form (deepSeq)
Typeable derive Typeable for Dynamic
FunctorM derive reasonable fmapM implementation
HFoldable Strafunski hfoldr
Monoid derive reasonable Data.Monoid implementation
RMapM derive reasonable rmapM implementation
Term Strafunski representation via Dynamic
ATermConvertible encode terms in the ATerm format
Haskell2Xml encode terms as XML (HaXml=1.14)
Parse parse values back from standard 'Show'
Query provide a QueryFoo class with 'is', 'has', 'from', and 'get' routines
from provides fromFoo for each constructor
get for label 'foo' provide foo_g to get it
has hasfoo for record types
is provides isFoo for each constructor
test output raw data for testing
un provides unFoo for unary constructors
update for label 'foo' provides 'foo_u' to update it and foo_s to set it
What's New in This Release:
· Numerous enhancements and bugfixes.