Hi, folks.

I've got a working class and instances thereof.  I would now like to change 
the class such that error behaviour is specified by MonadError, for the 
moment throwing String errors.  When I try to add MonadError into the types I 
eventually hit the requirement for allow-undecidable-instances.  
Is there some way I can I avoid having to use this extension?


My starting point consists of:

class (Num i, Bounded i, Monad m) => MonadSource i m | m -> i where
    ...

newtype SourceT i m a = SourceT (StateT (Store i) m a)
    deriving (Functor, Monad, MonadIO, MonadTrans)

instance (Num i, Bounded i, Monad m) => MonadSource i (SourceT i m) where
    ...

I changed it to:

class (Num i, Bounded i, Monad m, MonadError String m)
        => MonadSource i m | m -> i where
    ....

newtype SourceT i m a = SourceT (StateT (Store i) m a)
        deriving (Functor, Monad, MonadIO, MonadTrans, MonadError e)

instance (Num i, Bounded i, Monad m, MonadError String m)
        => MonadSource i (SourceT i m) where
    ...



Thanks
Daniel
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to