
9 Sep
2008
9 Sep
'08
7:05 a.m.
2008/9/9 Daryoush Mehrtash
The MaybeT transformer is defined as:
newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe a)}
instance Functor m => Functor (MaybeT m) where
fmap f x = MaybeT $ fmap (fmap f) $ runMaybeT x
....
Question: What does "runMaybeT x" mean?
If you mean "what does it do?" then the answer is that it unwraps the MaybeT so that you can get to the inner value. If you mean "how does it do it?" then I believe the best thing is to read some of the chapters in RWH because I think I recognise a rather common Haskell-pattern here. I don't remember which ones, but I'm sure others on this list have better memory than I do ;-) If this isn't what you were looking for, then I haven't understood the question :-) /M