[Haskell-cafe] type checking that I can't figure out ....
Vasili I. Galchin
vigalchin at gmail.com
Wed Jun 3 00:16:38 EDT 2009
Hi Michael,
Let me look tomorrow morning. In any case, many thanks!
Kind regards,
Vasili
On Tue, Jun 2, 2009 at 11:12 PM, Michael Snoyman <michael at snoyman.com>wrote:
> > remLookupFwd :: (ReVars m t) => SimplRe t -> ReM m t (ReInfo t)
> > remLookupFwd re
> > = do fwd <- gets resFwdMap
> > -- let { Just reinfo = M.lookup fwd re } --
> PROBLEM
> > reinfo <- liftMaybe $ M.lookup re fwd --
> PROBLEM
> > return reinfo
> >
> > liftMaybe :: Monad m => Maybe a -> m a
> > liftMaybe Nothing = fail "Nothing"
> > liftMaybe (Just x) = return x
>
> I made two changes:
>
> 1. You had the arguments to M.lookup backwards.
> 2. lookup does not return any generalized Monad, just Maybe (I think that
> should be changed). I added the simple liftMaybe function to convert the
> Maybe result into something that will work with your state monad.
>
> Michael
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090603/4b231be5/attachment.html
More information about the Haskell-Cafe
mailing list