
12 Apr
2018
12 Apr
'18
11:59 a.m.
On Thu, Apr 12, 2018 at 11:25:57AM +0100, mike h wrote:
This is what I have
newtype EitherT m a b = EitherT {runEitherT :: m (Either a b)} instance Monad m => Functor (EitherT m a) where ---- fmap :: (a -> b) -> f a -> f b fmap f m = EitherT $ do mv <- runEitherT m case mv of Left _ -> return mv Right rv -> return $ Right (f rv)
Tricky error! The signature for this fmap is: fmap :: (b -> c) -> EitherT m a b -> EitherT m a c The offending line is: Left _ -> return mv You *think* you are returning `Either a c`, but are you really? Type HINTS for more :P -F