On Sat, Nov 21, 2009 at 06:20:40PM -0800, zaxis wrote: > newtype X a = X (ReaderT XConf (StateT XState IO) a) > #ifndef __HADDOCK__ > deriving (Functor, Monad, MonadIO, MonadState XState, MonadReader XConf, > Typeable) > #endif > > In `X (ReaderT XConf (StateT XState IO) a)`, X is a type constructor, how to > understand `(ReaderT XConf (StateT XState IO) a)` ?
Well, “ReaderT XConf (StateT XState IO) a” is *the* type :). It's a monad that is a Reader of XConf and has a State of XState. This means you can use, for example, ask :: X XConf and get :: X XState > And why use `#ifndef __HADDOCK__` ? Because Haddock used to have difficulties in processing some directives, like that “deriving (..., MonadState XState, ...)” which is part of the GeneralizedNewtypeDeriving extension. HTH, -- Felipe. _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
