Ben Franksen wrote: > My problem is that I still don't understand why this is so! I know of > course that pattern matching is strict, but I thought this should be ok > here, since I evaluate the declarations _before_ the body, so when > evaluation of the body demands the variable, it will be defined.
Another data point: It /has/ something to do with ErrorT. If I remove the ErrorT from the monad stack it works, even with the pattern matching in the variable lookup: newtype Eval a = Eval { unEval :: {- ErrorT String -} (StateT Env (Writer [String])) a } deriving ( Monad, MonadFix, MonadWriter [String], -- for warnings & other messages MonadState Env{- , MonadError String -} ) runEval :: Eval Value -> {- Either String -} Value runEval = fst . runWriter . flip evalStateT M.empty . {- runErrorT . -} unEval *Main> evaluate example 1 I am still lost as to how to make this work with ErrorT. Cheers Ben _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe