[Haskell-cafe] I really donot know how to use `newtype` ?

zaxis z_axis at 163.com
Fri Nov 27 07:15:27 EST 2009


import Control.Monad.State
import Control.Monad.Reader

data XConf = XConf {}
data XState = XState {}

newtype X a = X (ReaderT XConf (StateT XState IO) a)

> :t StateT
StateT :: (s -> m (a, s)) -> StateT s m a

> :t ReaderT
ReaderT :: (r -> m a) -> ReaderT r m a

then how to use `X` ?  Would you mind explaining the newtype X in detail ?

Sinerely!

-----
fac n = foldr (*) 1 [1..n]
-- 
View this message in context: http://old.nabble.com/I-really-donot-know-how-to-use-%60newtype%60---tp26541671p26541671.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list