| > I'd like to support Alex here: it is absolutely necessary to relax
| > condition 10 of SPJ's list.
| 
|         http://www.dcs.gla.ac.uk/~simonpj/multi-param.html
| 
| > Idioms like the one above (`Ord (s a)' or
| > `Show (s a)') arise too often and are completely natural.
|
| One of the great merits of imposing restrictions is that
| you hear about when they are irritating :-). (The reverse does
| not hold.)  Examples like this are jolly useful.
|
| Ralf: can you supply other examples?

Here is another one. It seems that condition 10 hinders the use of
abstraction. Consider the following innocent looking definitions

> data Tree a           =  Empty | Node (Tree a) a (Tree a)
>                          deriving (Show)

> data Cons a           =  Cons a (Tree a)
>                          deriving (Show)

and suppose that we want to abstract away `Cons's dependency on `Tree'.

> data Cons tree a      =  Cons a (tree a)
>                          deriving (Show)

Now, we have a context of the form

        instance (Show (tree a), Show a) => Show (Cons tree a)

which violates condition 10. And note that this might happen as soon as
you use higher-order polymorphism (types of kind * -> *).

Cheers, Ralf


Reply via email to