a universal printer for Haskell?

C.Reinke C.Reinke@ukc.ac.uk
Wed, 20 Feb 2002 15:07:27 +0000

> You don't need meta-programming technology (reflection) to do things like
> generic prinitng. A generic programming extension of Haskell (like
> Generic Haskell, or derivable classes) can do the job for you.

Isn't generic programming usually based on a kind of compile-time
reflection (if the argument is of this type, do this, else..)?

And don't you write generic functions with the intention that the
implementation will figure out the approriate type-specific
variants, i.e., you write your code at a level of abstraction that
is not easily reached with the standard language tools -- a meta
level, where functions at different types are the first-class
objects of discourse?

I find it helpful to think of generic programming support as one way
of integrating well-behaved subsets of reflection and other
meta-programming techniques into Haskell. 

It is partly a trade-off: you get some of the features and avoid
some of the problems of a fully reflective architecture. It is also
a specialisation: by avoiding the full generality, the specific
subset of features can be designed in a structured fashion, with the
application domain in mind, making them easier to use for that domain.


(another fan of reflection and meta-programming, who would like to
 get their advantages without their disadvantages -- the latter are
 more clearly visible in a pure functional language than in Lisp)