RE: polymorphic type in state of state monad

2003-03-11 Thread Simon Peyton-Jones
| | > type State = Term a => [a] | | > data M a = M (State -> IO(State,a)) | | | | GHC yields a error message "Illegal polymorphic type". | | How to resolve this? I can tell you what it happening. If you have -fglasgow-exts on, the type for State is short for type State = forall a.

Re: polymorphic type in state of state monad

2003-03-10 Thread Andrew J Bromage
G'day all. On Tue, Mar 11, 2003 at 08:34:06AM +1300, Tom Pledger wrote: > If, on the other hand, you want to vary the state type *during* a > single monadic computation, it gets messy. You could try one of the > following. Very often, you just want to vary the state type for some portion of the

polymorphic type in state of state monad

2003-03-10 Thread Tom Pledger
Wang Meng writes: | Hi All, | | Any one of your have the experience of defining a state of a state monad | as a polymorphic type? | I want to have: | | > type State = Term a => [a] | > data M a = M (State -> IO(State,a)) | | GHC yields a error message "Illegal polymorphic type". | How

polymorphic type in state of state monad

2003-03-10 Thread Wang Meng
Hi All, Any one of your have the experience of defining a state of a state monad as a polymorphic type? I want to have: > type State = Term a => [a] > data M a = M (State -> IO(State,a)) GHC yields a error message "Illegal polymorphic type". How to resolve this? Thank you very much. -W-M-