RE: composed contexts

1998-11-06 Thread Simon Peyton-Jones

 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.

No, neither can, and that's not going to change for
Haskell 98. There is a raft of generalisations to the class
system (implemented in Hugs and GHC) but which would require
a much bigger upheaval to Haskell 98.  They are all going to
be in Haskell 2 (IMHO).  But for H98, sorry.

S





RE: composed contexts

1998-11-06 Thread Frank A. Christoph

 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.

No, neither can, and that's not going to change for
Haskell 98. There is a raft of generalisations to the class
system (implemented in Hugs and GHC) but which would require
a much bigger upheaval to Haskell 98.  They are all going to
be in Haskell 2 (IMHO).  But for H98, sorry.

Oops.  Sorry, I forgot that the MPC stuff, etc. wasn't going into Haskell 98.  I guess 
with all the crossfire I'm getting confused about H98 and H2.

--FC






RE: composed contexts

1998-11-05 Thread Frank A. Christoph

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