Kuncak wrote:
| Why don't we have "deriving Functor" in Haskell?
Tom Pledger answered:
| I don't know how significant this is, but types
| declared as Functor instances have kind (*->*),
| whereas types with any derived instances have kind *.
This might be the historical reason why Functor i not
derived in Haskell, because when it was decided what classes
were derivable, there did not exist any constructor classes.
But, it is very much possible to make a deriving
Functor. The people doing `polytypic' or `generic'
programming have shown this.
The question is of course, where to stop? There are so many
other classes which are also derivable. The Only Good
Solution would be for the Haskell programmer to make her/his
own deriving extensions.
The (or at least, my) hope is that there will be an
extension to Haskell soon (called "Generic Haskell") which
will make this easy to do. There already is a preprocessor
that does similar things, called "PolyP".
Regards,
Koen.
References:
http://www.cs.chalmers.se/~patrikj/poly/
http://www.students.cs.uu.nl/people/jwit/GenericHaskell.html
--
Koen Claessen http://www.cs.chalmers.se/~koen
phone:+46-31-772 5424 e-mail:[EMAIL PROTECTED]
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden