On Thu, Aug 03, 2006 at 08:40:26AM +0200, Harald ROTTER wrote: > Thanks for the hint, I will try to implement the suggested monadic > structure.
I realized perhaps I should have made the hint slightly more explicit by changing the name: newtype ParserT m a = ParserT { runParserT :: (PState -> m [(a, PState)])} But I know you would figure it out either way. :-) > As for the MonadState declaration: > > If I put > instance MonadState PState Parser > > then ghci complains: > Illegal instance declaration for 'MonadState PState Parser' > (The instance type must be of form (T a b c) > where T is not a synonym, and a,b,c are distict type variables) > In the instance declaration for 'MonadState PState Parser' > > I found out that invoking ghci with "-fglasgow-exts" solves the issue nut I > have to admit that I do not really understand what's so special about this > instance declaration to make it require the extensions. You would need -fglasgow-exts anyway for a multi-parameter (ie., two types, PState and Parser) instance. Haskell 98 has quite limited support for typeclasses, compared to current practice. I wouldn't worry much about the above error--but that said, I suspect your PState is a type synonym, which as the error message says is forbidden (in Haskell 98). Andrew _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell