929b242fa6dcf0fb635c67c97d8a27cbdcc63f0c
[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 -- The MonadTrans class.
13 --
14 --        Inspired by the paper
15 --        /Functional Programming with Overloading and
16 --            Higher-Order Polymorphism/, 
17 --          Mark P Jones (<http://www.cse.ogi.edu/~mpj>)
18 --                Advanced School of Functional Programming, 1995.
19 -----------------------------------------------------------------------------
20
21 module Control.Monad.Trans (
22         MonadTrans(..),
23         MonadIO(..),  
24   ) where
25
26 import Prelude
27
28 import System.IO
29
30 -- ---------------------------------------------------------------------------
31 -- MonadTrans class
32 --
33 -- Monad to facilitate stackable Monads.
34 -- Provides a way of digging into an outer
35 -- monad, giving access to (lifting) the inner monad.
36
37 class MonadTrans t where
38         lift :: Monad m => m a -> t m a
39
40 class (Monad m) => MonadIO m where
41         liftIO :: IO a -> m a
42
43 instance MonadIO IO where
44         liftIO = id