multiple methods pattern bug(?)

2002-04-11 Thread Ch. A. Herrmann

Hi,

the following instance declaration doesn't work any
more with ghc-5.02.3, it worked before.

 newtype ST state a = ST { unST :: state - (a,state) }
 
 instance Monad (ST c) where
  return x  = ST (\state - (x,state))  
 (m = f) = ST (\state - let (x,state1) = unST m state
   (y,state2) = unST (f x) state1
   in (y,state2)) 

Error message:
Can't handle multiple methods defined by one pattern binding
(m = f)
= ST (\ state
  - let
   (y, state2) = ...
   (x, state1) = ...
 in (y, state2))

What can I do instead?

--
 Christoph
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs



RE: multiple methods pattern bug(?)

2002-04-11 Thread Simon Marlow


 the following instance declaration doesn't work any
 more with ghc-5.02.3, it worked before.
 
  newtype ST state a = ST { unST :: state - (a,state) }
  
  instance Monad (ST c) where
   return x  = ST (\state - (x,state))  
  (m = f) = ST (\state - let (x,state1) = unST m state
(y,state2) = unST (f x) state1
in (y,state2)) 
 
 Error message:
 Can't handle multiple methods defined by one pattern binding
   (m = f)
   = ST (\ state
 - let
  (y, state2) = ...
  (x, state1) = ...
in (y, state2))
 
 What can I do instead?

Remove the parentheses on the left hand side - that's not legal Haskell
98.  The error message is a bit cryptic though, the renamer should
really spot that it isn't a valid pattern binding first.

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs