λ. John Hughes, "Generalising Monads to Arrows"
data (Read x) => T x = ...」というようにデータ型を定義しても、型「
Readのインスタンスだということを推論してくれないのは、僕もずっと不満に思ってた。(Restricted Datatypes in Haskell を参照)
[2005-03-27 追記] 圏論が何故プログラミングに役立つかということについての説明が良かったので、以下に引用しておく。
Some might find it surprising that something so abstract as category theory should turn out to be useful for something so concrete as programming. After all, category theory is, in a sense, so abstract as to be rather unsatisfying: it is `all definitions and no theorems', almost everything turns out to be a category if you look at it long enough, to say something is a category is actually to say very little about it. The same is true of most categorical concepts: they have very many possible instantiations, and so to say that something is, for example, a monad, is to say very little. This extreme generality is one reason why it is hard for the beginner to develop good intuitions about category theory, but it is hardly surprising: category theory was, after all, developed to be a `theory of everything', a framework into which very many different mathematical structures would fit. But why should a theory so abstract be of any use for programming?
The answer is simple: as computer scientists, we value abstraction! When we design the interface to a software component, we want it to reveal as little as possible about the implementation. We want to be able to replace the implementation with many alternatives, many other `instances' of the same `concept'. When we design a generic interface to many program libraries, it is even more important that the interface we choose have a wide variety of implementations. It is the very generality of the monad concept which we value so highly, it is because category theory is so abstract that its concepts are so useful for programming.