From my [previous question](https://stackoverflow.com/questions/15488992/haskell-infinite-type), I've been trying to work out some monadic code. To start, here is a state machine function I'm using:

```
import Control.Monad
import Control.Monad.Error

newtype FSM m = FSM { unFSM :: String -> m (String, FSM m) } 

fsm f []     = return []
fsm f (r:rs) = do
    (xs, f') <- unFSM f r  
    liftM (xs:) (fsm f' rs) 

```

Now, this compiles fine:

```
exclaim :: (Monad m) => FSM m
exclaim = FSM exclaim'
exclaim' xs = return (xs ++ "!", exclaim)

```

But this doesn't, because of the type declaration:

```
question :: (MonadError String m) => FSM m
question = FSM question'
question' xs 
    | last xs == '?' = throwError "Already a question"
    | otherwise      = return (xs ++ "?", question)

```

The error is `Non type-variable argument`, which I think is referring to the `String` after `MonadError`. If I remove the type declaration, I get `Could not deduce` instead. I understand enabling FlexibleContexts just "fixes" this but is there something simpler I could be doing to allow me to throw errors? I'd rather not be enabling all sorts of compiler extensions.

Full code [here](http://hpaste.org/84333).