On Thu, Jul 20, 2006 at 10:48:02AM -0600, Rodney D Price wrote: > > I've gotten this sort of error several times, which mysteriously > disappears when I add more functions to the code: > > storeError.hs:13:38: > Couldn't match expected type `a' (a rigid variable) > against inferred type `String' > `a' is bound by the type signature for `throwError' > at <no location info> > Expected type: a > Inferred type: String > In the first argument of `return', namely `msg' > In the call (return msg) > > (This is GHCi.) The code is below. The type variable a can't be > bound to String, obviously, but a relative novice like myself has no > idea why. Can someone tell me?
> instance MonadError StoreError STM where > throwError (Default msg) = return msg throwError :: e -> m a The return type is wrong. throwError needs to be able to return an arbitrary type, which is more than a bit tricky. It looks like in STM you might only be able to do this using "check". -- David Roundy _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell