1 -----------------------------------------------------------------------------
3 -- Module : Control.Monad.Identity
4 -- Copyright : (c) Andy Gill 2001,
5 -- (c) Oregon Graduate Institute of Science and Technology, 2001
6 -- License : BSD-style (see the file libraries/base/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : portable
12 -- The Identity monad.
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.
20 -----------------------------------------------------------------------------
22 module Control.Monad.X.Identity (
27 import Prelude(Functor(..),Monad(..))
31 -- ---------------------------------------------------------------------------
34 -- Abstraction for wrapping up a object.
35 -- If you have an monadic function, say:
37 -- example :: Int -> Identity Int
38 -- example x = return (x*x)
40 -- you can "run" it, using
42 -- Main> runIdentity (example 42)
46 newtype Identity a = I { unI :: a }
48 instance Functor Identity where
51 instance Monad Identity where