Simon Peyton-Jones <[EMAIL PROTECTED]>  writes
>
>> - The simple-context restriction.  
>> ...
>> My default position is not to change.  Question: who, apart from
>> Ralf, has actually tripped over the lack of contexts of the
>> form (C (a t1 .. tn)) in Haskell 1.4?  Is their lack a real
>> problem in practice?

Are you talking about contexts in general, or only contexts in function signatures?

For me, the most powerful argument in favor of generalizing contexts is the 
possibility of defining monad transformers, as described in "Monad Transformers and 
Modular Interpreters" by Liang, Hudak and Jones. (Because I love this paper so much. 
:)  I think I convinced you of this once before, when MPC support was being added to 
GHC. One has applications in class declarations, and non-variable arguments in 
instance declarations:

class (Monad m, Monad (t m)) => MonadT t m where
  lift :: m a -> t m a

instance (Monad m, Monad (StateT s m)) => MonadT (StateT s) m where
  lift m = \s -> m >>= \x -> return (s,x)

If the definitions from the paper can be turned into valid Haskell 98 w.l.o.g. now, 
then I'm happy.

--FC



Reply via email to