From fc1231ca6e008582fb6a669cb9d0607059e82cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Benencia?= Date: Sat, 24 Aug 2013 12:17:13 -0300 Subject: Lazymail monad --- Lazymail.hs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Lazymail.hs') diff --git a/Lazymail.hs b/Lazymail.hs index 9347b2e..70a6b96 100644 --- a/Lazymail.hs +++ b/Lazymail.hs @@ -6,3 +6,21 @@ - -} +module Lazymail where + +import Control.Monad.Reader +import Control.Monad.State + +import Config(LazymailConfig, customConfig) +import State(LazymailState, initialState) + +{- Lazymail monad is a ReaderT around a StateT with IO at the bottom of the + - stack. + -} +type Lazymail = ReaderT LazymailConfig (StateT LazymailState IO) + +run :: Lazymail a -> IO (a, LazymailState) +run k = + let config = customConfig + state = initialState + in runStateT (runReaderT k config) state \ No newline at end of file -- cgit v1.2.3