diff options
author | RyanGlScott <ryan.gl.scott@gmail.com> | 2015-10-17 16:43:22 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-10-17 16:51:15 +0200 |
commit | fff02548d237655dea39f108364d7ebe6d0e122d (patch) | |
tree | 786e21326956e27fb7c1a7c955fd4ef9644cc86d /libraries | |
parent | 603a369dbf46c70759d680708ae48326f7121b28 (diff) | |
download | haskell-fff02548d237655dea39f108364d7ebe6d0e122d.tar.gz |
Move Control.Monad.IO.Class to base from transformers
See Trac #10773
Remove Control.Monad.IO.Class from `transformers`. Updates
`transformers` submodule.
See Trac #10773
Test Plan: ./validate
Reviewers: ekmett, hvr, bgamari, austin
Reviewed By: hvr, bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1147
GHC Trac Issues: #10773
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Control/Monad/IO/Class.hs | 36 | ||||
-rw-r--r-- | libraries/base/base.cabal | 1 | ||||
-rw-r--r-- | libraries/base/changelog.md | 3 | ||||
m--------- | libraries/transformers | 0 |
4 files changed, 40 insertions, 0 deletions
diff --git a/libraries/base/Control/Monad/IO/Class.hs b/libraries/base/Control/Monad/IO/Class.hs new file mode 100644 index 0000000000..b2c419c3a7 --- /dev/null +++ b/libraries/base/Control/Monad/IO/Class.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE Safe #-} +----------------------------------------------------------------------------- +-- | +-- Module : Control.Monad.IO.Class +-- Copyright : (c) Andy Gill 2001, +-- (c) Oregon Graduate Institute of Science and Technology, 2001 +-- License : BSD-style (see the file LICENSE) +-- +-- Maintainer : R.Paterson@city.ac.uk +-- Stability : experimental +-- Portability : portable +-- +-- Class of monads based on @IO@. +----------------------------------------------------------------------------- + +module Control.Monad.IO.Class ( + MonadIO(..) + ) where + +-- | Monads in which 'IO' computations may be embedded. +-- Any monad built by applying a sequence of monad transformers to the +-- 'IO' monad will be an instance of this class. +-- +-- Instances should satisfy the following laws, which state that 'liftIO' +-- is a transformer of monads: +-- +-- * @'liftIO' . 'return' = 'return'@ +-- +-- * @'liftIO' (m >>= f) = 'liftIO' m >>= ('liftIO' . f)@ + +class (Monad m) => MonadIO m where + -- | Lift a computation from the 'IO' monad. + liftIO :: IO a -> m a + +instance MonadIO IO where + liftIO = id diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index 326f4579fd..7a0ef9865a 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -115,6 +115,7 @@ Library Control.Monad Control.Monad.Fix Control.Monad.Instances + Control.Monad.IO.Class Control.Monad.ST Control.Monad.ST.Lazy Control.Monad.ST.Lazy.Safe diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index 34493ac47e..ff03562c33 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -56,6 +56,9 @@ * Made `PatternMatchFail`, `RecSelError`, `RecConError`, `RecUpdError`, `NoMethodError`, and `AssertionFailed` newtypes (#10738) + * New module `Control.Monad.IO.Class` (previously provided by `transformers` + package). (#10773) + * The `Generic` instance for `Proxy` is now poly-kinded (#10775) * add `Data.List.NonEmpty` and `Data.Semigroup` (to become diff --git a/libraries/transformers b/libraries/transformers -Subproject 078c7daf36ea1fa1ecb63b04dbe667a443e1304 +Subproject 0c7207e9702afb5344cc33892eb6da9126a85cf |