Strafunski: Major New Edition
Strafunski is a bundle that provides support for generic programming
in Haskell, based on the concept of a functional strategy. Functional
strategies are generic functions that
(i) can be applied to any type,
(ii) allow generic traversal into subterms,
(iii) can be customized with type-specific behaviour,
(iv) are first-class citizens.
Strafunski consists of a combinator library (StrategyLib) and a
precompiler (DrIFT-Strafunski). Release 2.0 of StrategyLib and release
1.4 of the Strafunski variation on DrIFT are now available from:
This is what you might expect fom the page:
Questions and answers
Applications of Strafunski
Below we describe changes with respect to the previous release,
and we give further pointers.
Changes with respect to the previous release include:
* Added many combinators to the library, and split up the module
- The top-level module StrategyLib which imports all other
- A range of `theme' modules into which combinators are grouped
according to the concerns they address. Among these are the
TraversalTheme, the FlowTheme, the EffectTheme, the KeyholeTheme,
the FixpointTheme, and more.
- A module StrategyOverloading that allows type-unifying and
type-preserving combinators to be treated in uniform manner.
- A module StrategyPrelude which defines basic combinators that
can be defined in term of truly primitive ones.
- Some modules that do not provide strategy combinators but
general utilities functions, such as MonadicFunctions, and
* The underlying term representation has been improved. Conversion
to/from this representation during generic traversal is now more
efficient. Also, instances of the Term class have been added for
the basic types Char, Int, 2-tuples, Either and Ratio.
* The various theme modules feature many of the combinators that
illustrate the design patterns for functional strategic programming
as presented in .
* Added a number of examples, including one that demonstrates
strategic programming on the abstract syntax of Haskell.
The new term representation was contributed by John Meacham.
Changes with respect to previous versions include:
* Merger of instances derivation rules with those of jDrIFT. In
particular, the rule for Term now supports the term representation
module based on Dynamic as available in StrategyLib version 2.0.
* Instance derivation for the ATermConvertible class, as available
in the Haskell ATerm Library.
* Command line option -r for generating instances only, i.e. not
repeating the contents of the input file itself.
* Command line option -g that allows global directives to be
specified on the command line instead of in the input file.
The DrIFT-Strafunski package was based on the original implementation
of DrIFT by Noel Winstanley and its updated implementation by Malcolm
Wallace. The new instance derivation rule for Term was contributed by
John Meacham. We hope DrIFT-Strafunski will soon be made redundant by
John's unifying implementation: jDrIFT.
The following papers provide useful background info:
 Ralf Laemmel and Joost Visser
Design Patterns for Functional Strategic Programming.
This paper seeks to provide practicing functional programmers with
pragmatic guidance in crafting their own strategic programs. It
presents the fundamentals and the support from a user's perspective,
and includes a catalogue of design patterns.
Read this paper if you want to use Strafunski.
 Ralf Laemmel and Joost Visser
Typed Combinators for Generic Traversal
This paper introduces the concept of functional strategies. It shows
how strategies are modelled inside Haskell, and it present the first
version of StrategyLib.
Read this paper if you want to know what makes Strafunksi work.
 Ralf Laemmel
A Polymorphic Symphony
This paper reconstructs functional strategies as an amalgamation of
certain bits of parametric polymorphism, type case, polytypism, and
Read this paper if you want to know how Strafunski can be
generalized and how it may look in future.
Feedback is much appreciated, and can be directed to the authors:
* Ralf Laemmel (mailto:email@example.com)
* Joost Visser (mailto:Joost.Visser@cwi.nl)