376602107f99ac569aa5bca79132fa22d63edbf2
[ghc-base.git] / Control / Monad / Trans.hs
1 -----------------------------------------------------------------------------
2 -- 
3 -- Module      :  Control.Monad.Trans
4 -- Copyright   :  (c) Andy Gill 2001,
5 --                (c) Oregon Graduate Institute of Science and Technology, 2001
6 -- License     :  BSD-style (see the file libraries/core/LICENSE)
7 -- 
8 -- Maintainer  :  libraries@haskell.org
9 -- Stability   :  experimental
10 -- Portability :  portable
11 --
12 -- $Id: Trans.hs,v 1.1 2001/06/28 14:15:02 simonmar Exp $
13 --
14 -- The MonadTrans class.
15 --
16 --        Inspired by the paper
17 --        \em{Functional Programming with Overloading and
18 --            Higher-Order Polymorphism},
19 --          \A[HREF="http://www.cse.ogi.edu/~mpj"]{Mark P Jones},
20 --                Advanced School of Functional Programming, 1995.}
21 -----------------------------------------------------------------------------
22
23 module Control.Monad.Trans (
24         MonadTrans(..),
25         MonadIO(..),  
26   ) where
27
28 import Prelude
29
30 import System.IO
31
32 -- ---------------------------------------------------------------------------
33 -- MonadTrans class
34 --
35 -- Monad to facilitate stackable Monads.
36 -- Provides a way of digging into an outer
37 -- monad, giving access to (lifting) the inner monad.
38
39 class MonadTrans t where
40         lift :: Monad m => m a -> t m a
41
42 class (Monad m) => MonadIO m where
43         liftIO :: IO a -> m a
44
45 instance MonadIO IO where
46         liftIO = id