[Haskell] rigid variables

Rodney D Price rodprice at raytheon.com
Thu Jul 20 12:48:02 EDT 2006


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?

Thanks,

-Rod

--
module Store where

import Control.Monad.Error
import Control.Concurrent.STM

data StoreError = Default String

instance Error StoreError where
     noMsg  = Default "Store error"
     strMsg = Default

instance MonadError StoreError STM where
     throwError (Default msg) = return msg




More information about the Haskell mailing list