Hello community, here is the log from the commit of package ghc-lifted-base for openSUSE:Factory checked in at 2015-05-21 08:12:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-lifted-base (Old) and /work/SRC/openSUSE:Factory/.ghc-lifted-base.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-lifted-base" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-lifted-base/ghc-lifted-base.changes 2014-04-02 17:19:04.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-lifted-base.new/ghc-lifted-base.changes 2015-05-21 08:12:55.000000000 +0200 @@ -1,0 +2,6 @@ +Tue Apr 21 19:42:56 UTC 2015 - [email protected] + +- update to 0.2.3.6 +* no upstream changelog + +------------------------------------------------------------------- Old: ---- lifted-base-0.2.1.0.tar.gz New: ---- lifted-base-0.2.3.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-lifted-base.spec ++++++ --- /var/tmp/diff_new_pack.u9sZyU/_old 2015-05-21 08:12:56.000000000 +0200 +++ /var/tmp/diff_new_pack.u9sZyU/_new 2015-05-21 08:12:56.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-lifted-base # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,23 +18,31 @@ %global pkg_name lifted-base -Name: ghc-lifted-base -Version: 0.2.1.0 +%bcond_with tests + +Name: ghc-%{pkg_name} +Version: 0.2.3.6 Release: 0 -Summary: lifted IO operations from the base library +Summary: Lifted IO operations from the base library License: BSD-3-Clause Group: System/Libraries -Url: http://hackage.haskell.org/package/%{pkg_name} -Source0: http://hackage.haskell.org/packages/archive/%{pkg_name}/%{version}/%{pkg_name}-%{version}.tar.gz +Url: https://hackage.haskell.org/package/%{pkg_name} +Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: ghc-Cabal-devel BuildRequires: ghc-rpm-macros # Begin cabal-rpm deps: -BuildRequires: ghc-base-unicode-symbols-devel BuildRequires: ghc-monad-control-devel BuildRequires: ghc-transformers-base-devel +%if %{with tests} +BuildRequires: ghc-HUnit-devel +BuildRequires: ghc-test-framework-devel +BuildRequires: ghc-test-framework-hunit-devel +BuildRequires: ghc-transformers-compat-devel +BuildRequires: ghc-transformers-devel +%endif # End cabal-rpm deps %description @@ -45,15 +53,16 @@ version of a function from 'base', just ask me to add it or send me a patch. The package includes a copy of the 'monad-peel' testsuite written by Anders -Kaseorg The tests can be performed using 'cabal test' +Kaseorg The tests can be performed using 'cabal test'. %package devel Summary: Haskell %{pkg_name} library development files Group: Development/Libraries/Other -Provides: %{name}-static = %{version}-%{release} -Requires: %{name} = %{version}-%{release} Requires: ghc-compiler = %{ghc_version} +Requires(post): ghc-compiler = %{ghc_version} +Requires(postun): ghc-compiler = %{ghc_version} +Requires: %{name} = %{version}-%{release} %description devel This package provides the Haskell %{pkg_name} library development files. @@ -68,6 +77,11 @@ %install %ghc_lib_install +%check +%if %{with tests} +%cabal test +%endif + %post devel %ghc_pkg_recache ++++++ lifted-base-0.2.1.0.tar.gz -> lifted-base-0.2.3.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Concurrent/Chan/Lifted.hs new/lifted-base-0.2.3.6/Control/Concurrent/Chan/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Concurrent/Chan/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Concurrent/Chan/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleContexts #-} @@ -40,9 +39,7 @@ import Control.Concurrent.Chan ( Chan ) import qualified Control.Concurrent.Chan as Chan import System.IO ( IO ) - --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) +import Prelude ( (.) ) -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -54,32 +51,31 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'Chan.newChan'. -newChan ∷ MonadBase IO m ⇒ m (Chan a) +newChan :: MonadBase IO m => m (Chan a) newChan = liftBase Chan.newChan {-# INLINABLE newChan #-} -- | Generalized version of 'Chan.writeChan'. -writeChan ∷ MonadBase IO m ⇒ Chan a → a → m () -writeChan chan = liftBase ∘ Chan.writeChan chan +writeChan :: MonadBase IO m => Chan a -> a -> m () +writeChan chan = liftBase . Chan.writeChan chan {-# INLINABLE writeChan #-} -- | Generalized version of 'Chan.readChan'. -readChan ∷ MonadBase IO m ⇒ Chan a → m a -readChan = liftBase ∘ Chan.readChan +readChan :: MonadBase IO m => Chan a -> m a +readChan = liftBase . Chan.readChan {-# INLINABLE readChan #-} -- | Generalized version of 'Chan.dupChan'. -dupChan ∷ MonadBase IO m ⇒ Chan a → m (Chan a) -dupChan = liftBase ∘ Chan.dupChan +dupChan :: MonadBase IO m => Chan a -> m (Chan a) +dupChan = liftBase . Chan.dupChan {-# INLINABLE dupChan #-} -- | Generalized version of 'Chan.getChanContents'. -getChanContents ∷ MonadBase IO m ⇒ Chan a → m [a] -getChanContents = liftBase ∘ Chan.getChanContents +getChanContents :: MonadBase IO m => Chan a -> m [a] +getChanContents = liftBase . Chan.getChanContents {-# INLINABLE getChanContents #-} -- | Generalized version of 'Chan.writeList2Chan'. -writeList2Chan ∷ MonadBase IO m ⇒ Chan a → [a] → m () -writeList2Chan chan = liftBase ∘ Chan.writeList2Chan chan +writeList2Chan :: MonadBase IO m => Chan a -> [a] -> m () +writeList2Chan chan = liftBase . Chan.writeList2Chan chan {-# INLINABLE writeList2Chan #-} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Concurrent/Lifted.hs new/lifted-base-0.2.3.6/Control/Concurrent/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Concurrent/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Concurrent/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, UnicodeSyntax, NoImplicitPrelude, FlexibleContexts, RankNTypes #-} +{-# LANGUAGE CPP, NoImplicitPrelude, FlexibleContexts, RankNTypes #-} #if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} @@ -55,9 +55,9 @@ -- * Communication abstractions , module Control.Concurrent.MVar.Lifted , module Control.Concurrent.Chan.Lifted -#if !MIN_VERSION_base(4,6,0) , module Control.Concurrent.QSem.Lifted , module Control.Concurrent.QSemN.Lifted +#if !MIN_VERSION_base(4,7,0) , module Control.Concurrent.SampleVar.Lifted #endif @@ -86,6 +86,7 @@ -------------------------------------------------------------------------------- -- from base: +import Prelude ( (.) ) import Data.Bool ( Bool ) import Data.Int ( Int ) import Data.Function ( ($) ) @@ -100,9 +101,6 @@ import Control.Concurrent ( ThreadId ) import qualified Control.Concurrent as C --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) - -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -117,9 +115,9 @@ -- from lifted-base (this package): import Control.Concurrent.MVar.Lifted import Control.Concurrent.Chan.Lifted -#if !MIN_VERSION_base(4,6,0) import Control.Concurrent.QSem.Lifted import Control.Concurrent.QSemN.Lifted +#if !MIN_VERSION_base(4,7,0) import Control.Concurrent.SampleVar.Lifted #endif import Control.Exception.Lifted ( throwTo @@ -135,7 +133,7 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'C.myThreadId'. -myThreadId ∷ MonadBase IO m ⇒ m ThreadId +myThreadId :: MonadBase IO m => m ThreadId myThreadId = liftBase C.myThreadId {-# INLINABLE myThreadId #-} @@ -144,7 +142,7 @@ -- Note that, while the forked computation @m ()@ has access to the captured -- state, all its side-effects in @m@ are discarded. It is run only for its -- side-effects in 'IO'. -fork ∷ MonadBaseControl IO m ⇒ m () → m ThreadId +fork :: MonadBaseControl IO m => m () -> m ThreadId fork = liftBaseDiscard C.forkIO {-# INLINABLE fork #-} @@ -154,9 +152,9 @@ -- Note that, while the forked computation @m ()@ has access to the captured -- state, all its side-effects in @m@ are discarded. It is run only for its -- side-effects in 'IO'. -forkWithUnmask ∷ MonadBaseControl IO m ⇒ ((∀ a. m a → m a) → m ()) → m ThreadId -forkWithUnmask f = liftBaseWith $ \runInIO → - C.forkIOWithUnmask $ \unmask → +forkWithUnmask :: MonadBaseControl IO m => ((forall a. m a -> m a) -> m ()) -> m ThreadId +forkWithUnmask f = liftBaseWith $ \runInIO -> + C.forkIOWithUnmask $ \unmask -> void $ runInIO $ f $ liftBaseOp_ unmask {-# INLINABLE forkWithUnmask #-} #endif @@ -168,8 +166,8 @@ -- @action@ and the @and_then@ function have access to the captured -- state, all their side-effects in @m@ are discarded. They're run -- only for their side-effects in 'IO'. -forkFinally ∷ MonadBaseControl IO m - ⇒ m a → (Either SomeException a → m ()) → m ThreadId +forkFinally :: MonadBaseControl IO m + => m a -> (Either SomeException a -> m ()) -> m ThreadId forkFinally action and_then = mask $ \restore -> fork $ try (restore action) >>= and_then @@ -177,8 +175,8 @@ #endif -- | Generalized version of 'C.killThread'. -killThread ∷ MonadBase IO m ⇒ ThreadId → m () -killThread = liftBase ∘ C.killThread +killThread :: MonadBase IO m => ThreadId -> m () +killThread = liftBase . C.killThread {-# INLINABLE killThread #-} #if MIN_VERSION_base(4,4,0) @@ -187,8 +185,8 @@ -- Note that, while the forked computation @m ()@ has access to the captured -- state, all its side-effects in @m@ are discarded. It is run only for its -- side-effects in 'IO'. -forkOn ∷ MonadBaseControl IO m ⇒ Int → m () → m ThreadId -forkOn = liftBaseDiscard ∘ C.forkOn +forkOn :: MonadBaseControl IO m => Int -> m () -> m ThreadId +forkOn = liftBaseDiscard . C.forkOn {-# INLINABLE forkOn #-} -- | Generalized version of 'C.forkOnWithUnmask'. @@ -196,59 +194,59 @@ -- Note that, while the forked computation @m ()@ has access to the captured -- state, all its side-effects in @m@ are discarded. It is run only for its -- side-effects in 'IO'. -forkOnWithUnmask ∷ MonadBaseControl IO m ⇒ Int → ((∀ a. m a → m a) → m ()) → m ThreadId -forkOnWithUnmask cap f = liftBaseWith $ \runInIO → - C.forkOnWithUnmask cap $ \unmask → +forkOnWithUnmask :: MonadBaseControl IO m => Int -> ((forall a. m a -> m a) -> m ()) -> m ThreadId +forkOnWithUnmask cap f = liftBaseWith $ \runInIO -> + C.forkOnWithUnmask cap $ \unmask -> void $ runInIO $ f $ liftBaseOp_ unmask {-# INLINABLE forkOnWithUnmask #-} -- | Generalized version of 'C.getNumCapabilities'. -getNumCapabilities ∷ MonadBase IO m ⇒ m Int +getNumCapabilities :: MonadBase IO m => m Int getNumCapabilities = liftBase C.getNumCapabilities {-# INLINABLE getNumCapabilities #-} #if MIN_VERSION_base(4,6,0) -- | Generalized version of 'C.setNumCapabilities'. -setNumCapabilities ∷ MonadBase IO m ⇒ Int → m () -setNumCapabilities = liftBase ∘ C.setNumCapabilities +setNumCapabilities :: MonadBase IO m => Int -> m () +setNumCapabilities = liftBase . C.setNumCapabilities {-# INLINABLE setNumCapabilities #-} #endif -- | Generalized version of 'C.threadCapability'. -threadCapability ∷ MonadBase IO m ⇒ ThreadId → m (Int, Bool) -threadCapability = liftBase ∘ C.threadCapability +threadCapability :: MonadBase IO m => ThreadId -> m (Int, Bool) +threadCapability = liftBase . C.threadCapability {-# INLINABLE threadCapability #-} #endif -- | Generalized version of 'C.yield'. -yield ∷ MonadBase IO m ⇒ m () +yield :: MonadBase IO m => m () yield = liftBase C.yield {-# INLINABLE yield #-} -- | Generalized version of 'C.threadDelay'. -threadDelay ∷ MonadBase IO m ⇒ Int → m () -threadDelay = liftBase ∘ C.threadDelay +threadDelay :: MonadBase IO m => Int -> m () +threadDelay = liftBase . C.threadDelay {-# INLINABLE threadDelay #-} -- | Generalized version of 'C.threadWaitRead'. -threadWaitRead ∷ MonadBase IO m ⇒ Fd → m () -threadWaitRead = liftBase ∘ C.threadWaitRead +threadWaitRead :: MonadBase IO m => Fd -> m () +threadWaitRead = liftBase . C.threadWaitRead {-# INLINABLE threadWaitRead #-} -- | Generalized version of 'C.threadWaitWrite'. -threadWaitWrite ∷ MonadBase IO m ⇒ Fd → m () -threadWaitWrite = liftBase ∘ C.threadWaitWrite +threadWaitWrite :: MonadBase IO m => Fd -> m () +threadWaitWrite = liftBase . C.threadWaitWrite {-# INLINABLE threadWaitWrite #-} #if !MIN_VERSION_base(4,6,0) -- | Generalized version of 'C.mergeIO'. -merge ∷ MonadBase IO m ⇒ [a] → [a] → m [a] +merge :: MonadBase IO m => [a] -> [a] -> m [a] merge xs ys = liftBase $ C.mergeIO xs ys {-# INLINABLE merge #-} -- | Generalized version of 'C.nmergeIO'. -nmerge ∷ MonadBase IO m ⇒ [[a]] → m [a] -nmerge = liftBase ∘ C.nmergeIO +nmerge :: MonadBase IO m => [[a]] -> m [a] +nmerge = liftBase . C.nmergeIO {-# INLINABLE nmerge #-} #endif @@ -257,28 +255,28 @@ -- Note that, while the forked computation @m ()@ has access to the captured -- state, all its side-effects in @m@ are discarded. It is run only for its -- side-effects in 'IO'. -forkOS ∷ MonadBaseControl IO m ⇒ m () → m ThreadId +forkOS :: MonadBaseControl IO m => m () -> m ThreadId forkOS = liftBaseDiscard C.forkOS {-# INLINABLE forkOS #-} -- | Generalized version of 'C.isCurrentThreadBound'. -isCurrentThreadBound ∷ MonadBase IO m ⇒ m Bool +isCurrentThreadBound :: MonadBase IO m => m Bool isCurrentThreadBound = liftBase C.isCurrentThreadBound {-# INLINABLE isCurrentThreadBound #-} -- | Generalized version of 'C.runInBoundThread'. -runInBoundThread ∷ MonadBaseControl IO m ⇒ m a → m a +runInBoundThread :: MonadBaseControl IO m => m a -> m a runInBoundThread = liftBaseOp_ C.runInBoundThread {-# INLINABLE runInBoundThread #-} -- | Generalized version of 'C.runInUnboundThread'. -runInUnboundThread ∷ MonadBaseControl IO m ⇒ m a → m a +runInUnboundThread :: MonadBaseControl IO m => m a -> m a runInUnboundThread = liftBaseOp_ C.runInUnboundThread {-# INLINABLE runInUnboundThread #-} #if MIN_VERSION_base(4,6,0) -- | Generalized versio of 'C.mkWeakThreadId'. -mkWeakThreadId ∷ MonadBase IO m ⇒ ThreadId → m (Weak ThreadId) -mkWeakThreadId = liftBase ∘ C.mkWeakThreadId +mkWeakThreadId :: MonadBase IO m => ThreadId -> m (Weak ThreadId) +mkWeakThreadId = liftBase . C.mkWeakThreadId {-# INLINABLE mkWeakThreadId #-} #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Concurrent/MVar/Lifted.hs new/lifted-base-0.2.3.6/Control/Concurrent/MVar/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Concurrent/MVar/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Concurrent/MVar/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,9 +1,7 @@ {-# LANGUAGE CPP - , UnicodeSyntax , NoImplicitPrelude , FlexibleContexts - , TupleSections - #-} + , TupleSections #-} #if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} @@ -44,6 +42,10 @@ #else , addMVarFinalizer #endif +#if MIN_VERSION_base(4,7,0) + , withMVarMasked + , tryReadMVar +#endif ) where @@ -52,6 +54,7 @@ -------------------------------------------------------------------------------- -- from base: +import Prelude ( (.) ) import Data.Bool ( Bool(False, True) ) import Data.Function ( ($) ) import Data.Functor ( fmap ) @@ -76,9 +79,6 @@ import Control.Monad ( (>>=), (>>), fail ) #endif --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) - -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -96,89 +96,89 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'MVar.newEmptyMVar'. -newEmptyMVar ∷ MonadBase IO m ⇒ m (MVar a) +newEmptyMVar :: MonadBase IO m => m (MVar a) newEmptyMVar = liftBase MVar.newEmptyMVar {-# INLINABLE newEmptyMVar #-} -- | Generalized version of 'MVar.newMVar'. -newMVar ∷ MonadBase IO m ⇒ a → m (MVar a) -newMVar = liftBase ∘ MVar.newMVar +newMVar :: MonadBase IO m => a -> m (MVar a) +newMVar = liftBase . MVar.newMVar {-# INLINABLE newMVar #-} -- | Generalized version of 'MVar.takeMVar'. -takeMVar ∷ MonadBase IO m ⇒ MVar a → m a -takeMVar = liftBase ∘ MVar.takeMVar +takeMVar :: MonadBase IO m => MVar a -> m a +takeMVar = liftBase . MVar.takeMVar {-# INLINABLE takeMVar #-} -- | Generalized version of 'MVar.putMVar'. -putMVar ∷ MonadBase IO m ⇒ MVar a → a → m () +putMVar :: MonadBase IO m => MVar a -> a -> m () putMVar mv x = liftBase $ MVar.putMVar mv x {-# INLINABLE putMVar #-} -- | Generalized version of 'MVar.readMVar'. -readMVar ∷ MonadBase IO m ⇒ MVar a → m a -readMVar = liftBase ∘ MVar.readMVar +readMVar :: MonadBase IO m => MVar a -> m a +readMVar = liftBase . MVar.readMVar {-# INLINABLE readMVar #-} -- | Generalized version of 'MVar.swapMVar'. -swapMVar ∷ MonadBase IO m ⇒ MVar a → a → m a +swapMVar :: MonadBase IO m => MVar a -> a -> m a swapMVar mv x = liftBase $ MVar.swapMVar mv x {-# INLINABLE swapMVar #-} -- | Generalized version of 'MVar.tryTakeMVar'. -tryTakeMVar ∷ MonadBase IO m ⇒ MVar a → m (Maybe a) -tryTakeMVar = liftBase ∘ MVar.tryTakeMVar +tryTakeMVar :: MonadBase IO m => MVar a -> m (Maybe a) +tryTakeMVar = liftBase . MVar.tryTakeMVar {-# INLINABLE tryTakeMVar #-} -- | Generalized version of 'MVar.tryPutMVar'. -tryPutMVar ∷ MonadBase IO m ⇒ MVar a → a → m Bool +tryPutMVar :: MonadBase IO m => MVar a -> a -> m Bool tryPutMVar mv x = liftBase $ MVar.tryPutMVar mv x {-# INLINABLE tryPutMVar #-} -- | Generalized version of 'MVar.isEmptyMVar'. -isEmptyMVar ∷ MonadBase IO m ⇒ MVar a → m Bool -isEmptyMVar = liftBase ∘ MVar.isEmptyMVar +isEmptyMVar :: MonadBase IO m => MVar a -> m Bool +isEmptyMVar = liftBase . MVar.isEmptyMVar {-# INLINABLE isEmptyMVar #-} -- | Generalized version of 'MVar.withMVar'. -withMVar ∷ MonadBaseControl IO m ⇒ MVar a → (a → m b) → m b -withMVar = liftBaseOp ∘ MVar.withMVar +withMVar :: MonadBaseControl IO m => MVar a -> (a -> m b) -> m b +withMVar = liftBaseOp . MVar.withMVar {-# INLINABLE withMVar #-} -- | Generalized version of 'MVar.modifyMVar_'. -modifyMVar_ ∷ (MonadBaseControl IO m) ⇒ MVar a → (a → m a) → m () -modifyMVar_ mv = modifyMVar mv ∘ (fmap (, ()) ∘) +modifyMVar_ :: (MonadBaseControl IO m) => MVar a -> (a -> m a) -> m () +modifyMVar_ mv = modifyMVar mv . (fmap (, ()) .) {-# INLINABLE modifyMVar_ #-} -- | Generalized version of 'MVar.modifyMVar'. -modifyMVar ∷ (MonadBaseControl IO m) ⇒ MVar a → (a → m (a, b)) → m b +modifyMVar :: (MonadBaseControl IO m) => MVar a -> (a -> m (a, b)) -> m b #if MIN_VERSION_base(4,3,0) -modifyMVar mv f = control $ \runInIO → mask $ \restore → do - aborted ← newIORef True +modifyMVar mv f = control $ \runInIO -> mask $ \restore -> do + aborted <- newIORef True let f' x = do - (x', a) ← f x + (x', a) <- f x liftBase $ mask_ $ do writeIORef aborted False MVar.putMVar mv x' return a - x ← MVar.takeMVar mv - stM ← restore (runInIO (f' x)) `onException` MVar.putMVar mv x - abort ← readIORef aborted + x <- MVar.takeMVar mv + stM <- restore (runInIO (f' x)) `onException` MVar.putMVar mv x + abort <- readIORef aborted when abort $ MVar.putMVar mv x return stM #else modifyMVar mv f = control $ \runInIO -> block $ do - aborted ← newIORef True + aborted <- newIORef True let f' x = do - (x', a) ← f x + (x', a) <- f x liftBase $ block $ do writeIORef aborted False MVar.putMVar mv x' return a - x ← MVar.takeMVar mv - stM ← unblock (runInIO (f' x)) `onException` MVar.putMVar mv x - abort ← readIORef aborted + x <- MVar.takeMVar mv + stM <- unblock (runInIO (f' x)) `onException` MVar.putMVar mv x + abort <- readIORef aborted when abort $ MVar.putMVar mv x return stM #endif @@ -186,23 +186,23 @@ #if MIN_VERSION_base(4,6,0) -- | Generalized version of 'MVar.modifyMVarMasked_'. -modifyMVarMasked_ ∷ (MonadBaseControl IO m) ⇒ MVar a → (a → m a) → m () -modifyMVarMasked_ mv = modifyMVarMasked mv ∘ (fmap (, ()) ∘) +modifyMVarMasked_ :: (MonadBaseControl IO m) => MVar a -> (a -> m a) -> m () +modifyMVarMasked_ mv = modifyMVarMasked mv . (fmap (, ()) .) {-# INLINABLE modifyMVarMasked_ #-} -- | Generalized version of 'MVar.modifyMVarMasked'. -modifyMVarMasked ∷ (MonadBaseControl IO m) ⇒ MVar a → (a → m (a, b)) → m b -modifyMVarMasked mv f = control $ \runInIO → mask_ $ do - aborted ← newIORef True +modifyMVarMasked :: (MonadBaseControl IO m) => MVar a -> (a -> m (a, b)) -> m b +modifyMVarMasked mv f = control $ \runInIO -> mask_ $ do + aborted <- newIORef True let f' x = do - (x', a) ← f x + (x', a) <- f x liftBase $ do writeIORef aborted False MVar.putMVar mv x' return a - x ← MVar.takeMVar mv - stM ← runInIO (f' x) `onException` MVar.putMVar mv x - abort ← readIORef aborted + x <- MVar.takeMVar mv + stM <- runInIO (f' x) `onException` MVar.putMVar mv x + abort <- readIORef aborted when abort $ MVar.putMVar mv x return stM {-# INLINABLE modifyMVarMasked #-} @@ -213,15 +213,25 @@ -- -- Note any monadic side effects in @m@ of the \"finalizer\" computation are -- discarded. -mkWeakMVar ∷ MonadBaseControl IO m ⇒ MVar a → m () → m (Weak (MVar a)) -mkWeakMVar = liftBaseDiscard ∘ MVar.mkWeakMVar +mkWeakMVar :: MonadBaseControl IO m => MVar a -> m () -> m (Weak (MVar a)) +mkWeakMVar = liftBaseDiscard . MVar.mkWeakMVar {-# INLINABLE mkWeakMVar #-} #else -- | Generalized version of 'MVar.addMVarFinalizer'. -- -- Note any monadic side effects in @m@ of the \"finalizer\" computation are -- discarded. -addMVarFinalizer ∷ MonadBaseControl IO m ⇒ MVar a → m () → m () -addMVarFinalizer = liftBaseDiscard ∘ MVar.addMVarFinalizer +addMVarFinalizer :: MonadBaseControl IO m => MVar a -> m () -> m () +addMVarFinalizer = liftBaseDiscard . MVar.addMVarFinalizer {-# INLINABLE addMVarFinalizer #-} #endif + +#if MIN_VERSION_base (4,7,0) +-- | Generalized version of 'MVar.withMVarMasked'. +withMVarMasked :: MonadBaseControl IO m => MVar a -> (a -> m b) -> m b +withMVarMasked = liftBaseOp . MVar.withMVarMasked + +-- | Generalized version of 'MVar.tryReadMVar'. +tryReadMVar :: MonadBase IO m => MVar a -> m (Maybe a) +tryReadMVar = liftBase . MVar.tryReadMVar +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Concurrent/QSem/Lifted.hs new/lifted-base-0.2.3.6/Control/Concurrent/QSem/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Concurrent/QSem/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Concurrent/QSem/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,5 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-deprecations #-} {-# LANGUAGE CPP #-} -{-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleContexts #-} @@ -35,9 +35,7 @@ import qualified Control.Concurrent.QSem as QSem import Data.Int ( Int ) import System.IO ( IO ) - --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) +import Prelude ( (.) ) -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -49,17 +47,16 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'QSem.newQSem'. -newQSem ∷ MonadBase IO m ⇒ Int → m QSem -newQSem = liftBase ∘ QSem.newQSem +newQSem :: MonadBase IO m => Int -> m QSem +newQSem = liftBase . QSem.newQSem {-# INLINABLE newQSem #-} -- | Generalized version of 'QSem.waitQSem'. -waitQSem ∷ MonadBase IO m ⇒ QSem → m () -waitQSem = liftBase ∘ QSem.waitQSem +waitQSem :: MonadBase IO m => QSem -> m () +waitQSem = liftBase . QSem.waitQSem {-# INLINABLE waitQSem #-} -- | Generalized version of 'QSem.signalQSem'. -signalQSem ∷ MonadBase IO m ⇒ QSem → m () -signalQSem = liftBase ∘ QSem.signalQSem +signalQSem :: MonadBase IO m => QSem -> m () +signalQSem = liftBase . QSem.signalQSem {-# INLINABLE signalQSem #-} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Concurrent/QSemN/Lifted.hs new/lifted-base-0.2.3.6/Control/Concurrent/QSemN/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Concurrent/QSemN/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Concurrent/QSemN/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,5 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-deprecations #-} {-# LANGUAGE CPP #-} -{-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleContexts #-} @@ -35,9 +35,7 @@ import qualified Control.Concurrent.QSemN as QSemN import Data.Int ( Int ) import System.IO ( IO ) - --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) +import Prelude ( (.) ) -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -49,17 +47,16 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'QSemN.newQSemN'. -newQSemN ∷ MonadBase IO m ⇒ Int → m QSemN -newQSemN = liftBase ∘ QSemN.newQSemN +newQSemN :: MonadBase IO m => Int -> m QSemN +newQSemN = liftBase . QSemN.newQSemN {-# INLINABLE newQSemN #-} -- | Generalized version of 'QSemN.waitQSemN'. -waitQSemN ∷ MonadBase IO m ⇒ QSemN → Int → m () -waitQSemN sem = liftBase ∘ QSemN.waitQSemN sem +waitQSemN :: MonadBase IO m => QSemN -> Int -> m () +waitQSemN sem = liftBase . QSemN.waitQSemN sem {-# INLINABLE waitQSemN #-} -- | Generalized version of 'QSemN.signalQSemN'. -signalQSemN ∷ MonadBase IO m ⇒ QSemN → Int → m () -signalQSemN sem = liftBase ∘ QSemN.signalQSemN sem +signalQSemN :: MonadBase IO m => QSemN -> Int -> m () +signalQSemN sem = liftBase . QSemN.signalQSemN sem {-# INLINABLE signalQSemN #-} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Concurrent/SampleVar/Lifted.hs new/lifted-base-0.2.3.6/Control/Concurrent/SampleVar/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Concurrent/SampleVar/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Concurrent/SampleVar/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleContexts #-} @@ -38,9 +37,7 @@ import qualified Control.Concurrent.SampleVar as SampleVar import Data.Bool ( Bool ) import System.IO ( IO ) - --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) +import Prelude ( (.) ) -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -52,32 +49,31 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'SampleVar.newEmptySampleVar'. -newEmptySampleVar ∷ MonadBase IO m ⇒ m (SampleVar a) +newEmptySampleVar :: MonadBase IO m => m (SampleVar a) newEmptySampleVar = liftBase SampleVar.newEmptySampleVar {-# INLINABLE newEmptySampleVar #-} -- | Generalized version of 'SampleVar.newSampleVar'. -newSampleVar ∷ MonadBase IO m ⇒ a → m (SampleVar a) -newSampleVar = liftBase ∘ SampleVar.newSampleVar +newSampleVar :: MonadBase IO m => a -> m (SampleVar a) +newSampleVar = liftBase . SampleVar.newSampleVar {-# INLINABLE newSampleVar #-} -- | Generalized version of 'SampleVar.emptySampleVar'. -emptySampleVar ∷ MonadBase IO m ⇒ SampleVar a → m () -emptySampleVar = liftBase ∘ SampleVar.emptySampleVar +emptySampleVar :: MonadBase IO m => SampleVar a -> m () +emptySampleVar = liftBase . SampleVar.emptySampleVar {-# INLINABLE emptySampleVar #-} -- | Generalized version of 'SampleVar.readSampleVar'. -readSampleVar ∷ MonadBase IO m ⇒ SampleVar a → m a -readSampleVar = liftBase ∘ SampleVar.readSampleVar +readSampleVar :: MonadBase IO m => SampleVar a -> m a +readSampleVar = liftBase . SampleVar.readSampleVar {-# INLINABLE readSampleVar #-} -- | Generalized version of 'SampleVar.writeSampleVar'. -writeSampleVar ∷ MonadBase IO m ⇒ SampleVar a → a → m () -writeSampleVar sv = liftBase ∘ SampleVar.writeSampleVar sv +writeSampleVar :: MonadBase IO m => SampleVar a -> a -> m () +writeSampleVar sv = liftBase . SampleVar.writeSampleVar sv {-# INLINABLE writeSampleVar #-} -- | Generalized version of 'SampleVar.isEmptySampleVar'. -isEmptySampleVar ∷ MonadBase IO m ⇒ SampleVar a → m Bool -isEmptySampleVar = liftBase ∘ SampleVar.isEmptySampleVar +isEmptySampleVar :: MonadBase IO m => SampleVar a -> m Bool +isEmptySampleVar = liftBase . SampleVar.isEmptySampleVar {-# INLINABLE isEmptySampleVar #-} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Control/Exception/Lifted.hs new/lifted-base-0.2.3.6/Control/Exception/Lifted.hs --- old/lifted-base-0.2.1.0/Control/Exception/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Control/Exception/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,10 +1,7 @@ {-# LANGUAGE CPP - , UnicodeSyntax , NoImplicitPrelude , ExistentialQuantification - , FlexibleContexts - , ImpredicativeTypes - #-} + , FlexibleContexts #-} #if MIN_VERSION_base(4,3,0) {-# LANGUAGE RankNTypes #-} -- for mask @@ -77,10 +74,11 @@ -------------------------------------------------------------------------------- -- from base: +import Prelude ( (.) ) import Data.Function ( ($) ) import Data.Either ( Either(Left, Right), either ) import Data.Maybe ( Maybe ) -import Control.Monad ( Monad, (>>=), return, liftM ) +import Control.Monad ( (>>=), return, liftM ) import System.IO.Error ( IOError ) import System.IO ( IO ) @@ -118,9 +116,6 @@ import Data.Bool ( Bool ) #endif --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) - -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -129,7 +124,7 @@ , liftBaseWith, restoreM , control, liftBaseOp_ ) -#if MIN_VERSION_base(4,3,0) || defined (__HADDOCK__) +#if defined (__HADDOCK__) import Control.Monad.Trans.Control ( liftBaseOp ) #endif @@ -140,17 +135,17 @@ -------------------------------------------------------------------------------- -- |Generalized version of 'E.throwIO'. -throwIO ∷ (MonadBase IO m, Exception e) ⇒ e → m a -throwIO = liftBase ∘ E.throwIO +throwIO :: (MonadBase IO m, Exception e) => e -> m a +throwIO = liftBase . E.throwIO {-# INLINABLE throwIO #-} -- |Generalized version of 'E.ioError'. -ioError ∷ MonadBase IO m ⇒ IOError → m a -ioError = liftBase ∘ E.ioError +ioError :: MonadBase IO m => IOError -> m a +ioError = liftBase . E.ioError {-# INLINABLE ioError #-} -- | Generalized version of 'C.throwTo'. -throwTo ∷ (MonadBase IO m, Exception e) ⇒ ThreadId → e → m () +throwTo :: (MonadBase IO m, Exception e) => ThreadId -> e -> m () throwTo tid e = liftBase $ C.throwTo tid e {-# INLINABLE throwTo #-} @@ -162,43 +157,43 @@ -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -catch ∷ (MonadBaseControl IO m, Exception e) - ⇒ m a -- ^ The computation to run - → (e → m a) -- ^ Handler to invoke if an exception is raised - → m a -catch a handler = control $ \runInIO → +catch :: (MonadBaseControl IO m, Exception e) + => m a -- ^ The computation to run + -> (e -> m a) -- ^ Handler to invoke if an exception is raised + -> m a +catch a handler = control $ \runInIO -> E.catch (runInIO a) - (\e → runInIO $ handler e) + (\e -> runInIO $ handler e) {-# INLINABLE catch #-} -- |Generalized version of 'E.catches'. -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -catches ∷ MonadBaseControl IO m ⇒ m a → [Handler m a] → m a -catches a handlers = control $ \runInIO → +catches :: MonadBaseControl IO m => m a -> [Handler m a] -> m a +catches a handlers = control $ \runInIO -> E.catches (runInIO a) - [ E.Handler $ \e → runInIO $ handler e - | Handler handler ← handlers + [ E.Handler $ \e -> runInIO $ handler e + | Handler handler <- handlers ] {-# INLINABLE catches #-} -- |Generalized version of 'E.Handler'. -data Handler m a = ∀ e. Exception e ⇒ Handler (e → m a) +data Handler m a = forall e. Exception e => Handler (e -> m a) -- |Generalized version of 'E.catchJust'. -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -catchJust ∷ (MonadBaseControl IO m, Exception e) - ⇒ (e → Maybe b) -- ^ Predicate to select exceptions - → m a -- ^ Computation to run - → (b → m a) -- ^ Handler - → m a -catchJust p a handler = control $ \runInIO → +catchJust :: (MonadBaseControl IO m, Exception e) + => (e -> Maybe b) -- ^ Predicate to select exceptions + -> m a -- ^ Computation to run + -> (b -> m a) -- ^ Handler + -> m a +catchJust p a handler = control $ \runInIO -> E.catchJust p (runInIO a) - (\e → runInIO (handler e)) + (\e -> runInIO (handler e)) {-# INLINABLE catchJust #-} @@ -210,9 +205,9 @@ -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -handle ∷ (MonadBaseControl IO m, Exception e) ⇒ (e → m a) → m a → m a -handle handler a = control $ \runInIO → - E.handle (\e → runInIO (handler e)) +handle :: (MonadBaseControl IO m, Exception e) => (e -> m a) -> m a -> m a +handle handler a = control $ \runInIO -> + E.handle (\e -> runInIO (handler e)) (runInIO a) {-# INLINABLE handle #-} @@ -220,10 +215,10 @@ -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -handleJust ∷ (MonadBaseControl IO m, Exception e) - ⇒ (e → Maybe b) → (b → m a) → m a → m a -handleJust p handler a = control $ \runInIO → - E.handleJust p (\e → runInIO (handler e)) +handleJust :: (MonadBaseControl IO m, Exception e) + => (e -> Maybe b) -> (b -> m a) -> m a -> m a +handleJust p handler a = control $ \runInIO -> + E.handleJust p (\e -> runInIO (handler e)) (runInIO a) {-# INLINABLE handleJust #-} @@ -231,24 +226,24 @@ -- ** The @try@ functions -------------------------------------------------------------------------------- -sequenceEither ∷ MonadBaseControl IO m ⇒ Either e (StM m a) → m (Either e a) -sequenceEither = either (return ∘ Left) (liftM Right ∘ restoreM) +sequenceEither :: MonadBaseControl IO m => Either e (StM m a) -> m (Either e a) +sequenceEither = either (return . Left) (liftM Right . restoreM) {-# INLINE sequenceEither #-} -- |Generalized version of 'E.try'. -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -try ∷ (MonadBaseControl IO m, Exception e) ⇒ m a → m (Either e a) -try m = liftBaseWith (\runInIO → E.try (runInIO m)) >>= sequenceEither +try :: (MonadBaseControl IO m, Exception e) => m a -> m (Either e a) +try m = liftBaseWith (\runInIO -> E.try (runInIO m)) >>= sequenceEither {-# INLINABLE try #-} -- |Generalized version of 'E.tryJust'. -- -- Note, when the given computation throws an exception any monadic -- side effects in @m@ will be discarded. -tryJust ∷ (MonadBaseControl IO m, Exception e) ⇒ (e → Maybe b) → m a → m (Either b a) -tryJust p m = liftBaseWith (\runInIO → E.tryJust p (runInIO m)) >>= sequenceEither +tryJust :: (MonadBaseControl IO m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a) +tryJust p m = liftBaseWith (\runInIO -> E.tryJust p (runInIO m)) >>= sequenceEither {-# INLINABLE tryJust #-} @@ -257,8 +252,8 @@ -------------------------------------------------------------------------------- -- |Generalized version of 'E.evaluate'. -evaluate ∷ MonadBase IO m ⇒ a → m a -evaluate = liftBase ∘ E.evaluate +evaluate :: MonadBase IO m => a -> m a +evaluate = liftBase . E.evaluate {-# INLINABLE evaluate #-} @@ -268,50 +263,49 @@ #if MIN_VERSION_base(4,3,0) -- |Generalized version of 'E.mask'. -mask ∷ MonadBaseControl IO m ⇒ ((∀ a. m a → m a) → m b) → m b -mask = liftBaseOp E.mask ∘ liftRestore +mask :: MonadBaseControl IO m => ((forall a. m a -> m a) -> m b) -> m b +mask f = control $ \runInBase -> + E.mask $ \g -> runInBase $ f $ liftBaseOp_ g {-# INLINABLE mask #-} -liftRestore ∷ MonadBaseControl IO m - ⇒ ((∀ a. m a → m a) → b) - → ((∀ a. IO a → IO a) → b) -liftRestore f r = f $ liftBaseOp_ r -{-# INLINE liftRestore #-} - -- |Generalized version of 'E.mask_'. -mask_ ∷ MonadBaseControl IO m ⇒ m a → m a +mask_ :: MonadBaseControl IO m => m a -> m a mask_ = liftBaseOp_ E.mask_ {-# INLINABLE mask_ #-} -- |Generalized version of 'E.uninterruptibleMask'. -uninterruptibleMask ∷ MonadBaseControl IO m ⇒ ((∀ a. m a → m a) → m b) → m b -uninterruptibleMask = liftBaseOp E.uninterruptibleMask ∘ liftRestore +uninterruptibleMask + :: MonadBaseControl IO m => ((forall a. m a -> m a) -> m b) -> m b +uninterruptibleMask f = + control $ \runInBase -> + E.uninterruptibleMask $ \g -> runInBase $ f $ liftBaseOp_ g + {-# INLINABLE uninterruptibleMask #-} -- |Generalized version of 'E.uninterruptibleMask_'. -uninterruptibleMask_ ∷ MonadBaseControl IO m ⇒ m a → m a +uninterruptibleMask_ :: MonadBaseControl IO m => m a -> m a uninterruptibleMask_ = liftBaseOp_ E.uninterruptibleMask_ {-# INLINABLE uninterruptibleMask_ #-} -- |Generalized version of 'E.getMaskingState'. -getMaskingState ∷ MonadBase IO m ⇒ m MaskingState +getMaskingState :: MonadBase IO m => m MaskingState getMaskingState = liftBase E.getMaskingState {-# INLINABLE getMaskingState #-} #if MIN_VERSION_base(4,4,0) -- |Generalized version of 'E.allowInterrupt'. -allowInterrupt ∷ MonadBase IO m ⇒ m () +allowInterrupt :: MonadBase IO m => m () allowInterrupt = liftBase E.allowInterrupt {-# INLINABLE allowInterrupt #-} #endif #else -- |Generalized version of 'E.block'. -block ∷ MonadBaseControl IO m ⇒ m a → m a +block :: MonadBaseControl IO m => m a -> m a block = liftBaseOp_ E.block {-# INLINABLE block #-} -- |Generalized version of 'E.unblock'. -unblock ∷ MonadBaseControl IO m ⇒ m a → m a +unblock :: MonadBaseControl IO m => m a -> m a unblock = liftBaseOp_ E.unblock {-# INLINABLE unblock #-} #endif @@ -320,7 +314,7 @@ -- | Generalized version of 'E.blocked'. -- returns @True@ if asynchronous exceptions are blocked in the -- current thread. -blocked ∷ MonadBase IO m ⇒ m Bool +blocked :: MonadBase IO m => m Bool blocked = liftBase E.blocked {-# INLINABLE blocked #-} #endif @@ -350,15 +344,15 @@ -- it will be more efficient to write: -- -- @'liftBaseOp' ('E.bracket' acquire release)@ -bracket ∷ MonadBaseControl IO m - ⇒ m a -- ^ computation to run first (\"acquire resource\") - → (a → m b) -- ^ computation to run last (\"release resource\") - → (a → m c) -- ^ computation to run in-between - → m c -bracket before after thing = control $ \runInIO → +bracket :: MonadBaseControl IO m + => m a -- ^ computation to run first (\"acquire resource\") + -> (a -> m b) -- ^ computation to run last (\"release resource\") + -> (a -> m c) -- ^ computation to run in-between + -> m c +bracket before after thing = control $ \runInIO -> E.bracket (runInIO before) - (\st → runInIO $ restoreM st >>= after) - (\st → runInIO $ restoreM st >>= thing) + (\st -> runInIO $ restoreM st >>= after) + (\st -> runInIO $ restoreM st >>= thing) {-# INLINABLE bracket #-} -- |Generalized version of 'E.bracket_'. @@ -372,12 +366,12 @@ -- it will be more efficient to write: -- -- @'liftBaseOp_' ('E.bracket_' acquire release)@ -bracket_ ∷ MonadBaseControl IO m - ⇒ m a -- ^ computation to run first (\"acquire resource\") - → m b -- ^ computation to run last (\"release resource\") - → m c -- ^ computation to run in-between - → m c -bracket_ before after thing = control $ \runInIO → +bracket_ :: MonadBaseControl IO m + => m a -- ^ computation to run first (\"acquire resource\") + -> m b -- ^ computation to run last (\"release resource\") + -> m c -- ^ computation to run in-between + -> m c +bracket_ before after thing = control $ \runInIO -> E.bracket_ (runInIO before) (runInIO after) (runInIO thing) @@ -403,16 +397,16 @@ -- type 'IO' it will be more efficient to write: -- -- @'liftBaseOp' ('E.bracketOnError' acquire release)@ -bracketOnError ∷ MonadBaseControl IO m - ⇒ m a -- ^ computation to run first (\"acquire resource\") - → (a → m b) -- ^ computation to run last (\"release resource\") - → (a → m c) -- ^ computation to run in-between - → m c +bracketOnError :: MonadBaseControl IO m + => m a -- ^ computation to run first (\"acquire resource\") + -> (a -> m b) -- ^ computation to run last (\"release resource\") + -> (a -> m c) -- ^ computation to run in-between + -> m c bracketOnError before after thing = - control $ \runInIO → + control $ \runInIO -> E.bracketOnError (runInIO before) - (\st → runInIO $ restoreM st >>= after) - (\st → runInIO $ restoreM st >>= thing) + (\st -> runInIO $ restoreM st >>= after) + (\st -> runInIO $ restoreM st >>= thing) {-# INLINABLE bracketOnError #-} @@ -424,11 +418,11 @@ -- -- Note, any monadic side effects in @m@ of the \"afterward\" -- computation will be discarded. -finally ∷ MonadBaseControl IO m - ⇒ m a -- ^ computation to run first - → m b -- ^ computation to run afterward (even if an exception was raised) - → m a -finally a sequel = control $ \runInIO → +finally :: MonadBaseControl IO m + => m a -- ^ computation to run first + -> m b -- ^ computation to run afterward (even if an exception was raised) + -> m a +finally a sequel = control $ \runInIO -> E.finally (runInIO a) (runInIO sequel) {-# INLINABLE finally #-} @@ -437,8 +431,8 @@ -- -- Note, any monadic side effects in @m@ of the \"afterward\" -- computation will be discarded. -onException ∷ MonadBaseControl IO m ⇒ m a → m b → m a -onException m what = control $ \runInIO → +onException :: MonadBaseControl IO m => m a -> m b -> m a +onException m what = control $ \runInIO -> E.onException (runInIO m) (runInIO what) {-# INLINABLE onException #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Data/IORef/Lifted.hs new/lifted-base-0.2.3.6/Data/IORef/Lifted.hs --- old/lifted-base-0.2.1.0/Data/IORef/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Data/IORef/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE UnicodeSyntax #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleContexts #-} @@ -45,9 +44,7 @@ import qualified Data.IORef as R import System.IO ( IO ) import System.Mem.Weak ( Weak ) - --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) +import Prelude ( (.) ) -- from transformers-base: import Control.Monad.Base ( MonadBase, liftBase ) @@ -62,50 +59,50 @@ -------------------------------------------------------------------------------- -- | Generalized version of 'R.newIORef'. -newIORef ∷ MonadBase IO m ⇒ a → m (IORef a) -newIORef = liftBase ∘ R.newIORef +newIORef :: MonadBase IO m => a -> m (IORef a) +newIORef = liftBase . R.newIORef {-# INLINABLE newIORef #-} -- | Generalized version of 'R.readIORef'. -readIORef ∷ MonadBase IO m ⇒ IORef a → m a -readIORef = liftBase ∘ R.readIORef +readIORef :: MonadBase IO m => IORef a -> m a +readIORef = liftBase . R.readIORef {-# INLINABLE readIORef #-} -- | Generalized version of 'R.writeIORef'. -writeIORef ∷ MonadBase IO m ⇒ IORef a → a → m () -writeIORef r = liftBase ∘ R.writeIORef r +writeIORef :: MonadBase IO m => IORef a -> a -> m () +writeIORef r = liftBase . R.writeIORef r {-# INLINABLE writeIORef #-} -- | Generalized version of 'R.modifyIORef'. -modifyIORef ∷ MonadBase IO m ⇒ IORef a → (a → a) → m () -modifyIORef r = liftBase ∘ R.modifyIORef r +modifyIORef :: MonadBase IO m => IORef a -> (a -> a) -> m () +modifyIORef r = liftBase . R.modifyIORef r {-# INLINABLE modifyIORef #-} -- | Generalized version of 'R.atomicModifyIORef'. -atomicModifyIORef ∷ MonadBase IO m ⇒ IORef a → (a → (a, b)) → m b -atomicModifyIORef r = liftBase ∘ R.atomicModifyIORef r +atomicModifyIORef :: MonadBase IO m => IORef a -> (a -> (a, b)) -> m b +atomicModifyIORef r = liftBase . R.atomicModifyIORef r {-# INLINABLE atomicModifyIORef #-} #if MIN_VERSION_base(4,6,0) -- | Generalized version of 'R.modifyIORef''. -modifyIORef' ∷ MonadBase IO m ⇒ IORef a → (a → a) → m () -modifyIORef' r = liftBase ∘ R.modifyIORef' r +modifyIORef' :: MonadBase IO m => IORef a -> (a -> a) -> m () +modifyIORef' r = liftBase . R.modifyIORef' r {-# INLINABLE modifyIORef' #-} -- | Generalized version of 'R.atomicModifyIORef''. -atomicModifyIORef' ∷ MonadBase IO m ⇒ IORef a → (a → (a, b)) → m b -atomicModifyIORef' r = liftBase ∘ R.atomicModifyIORef' r +atomicModifyIORef' :: MonadBase IO m => IORef a -> (a -> (a, b)) -> m b +atomicModifyIORef' r = liftBase . R.atomicModifyIORef' r {-# INLINABLE atomicModifyIORef' #-} -- | Generalized version of 'R.atomicWriteIORef'. -atomicWriteIORef ∷ MonadBase IO m ⇒ IORef a → a → m () -atomicWriteIORef r = liftBase ∘ R.atomicWriteIORef r +atomicWriteIORef :: MonadBase IO m => IORef a -> a -> m () +atomicWriteIORef r = liftBase . R.atomicWriteIORef r #endif -- | Generalized version of 'R.mkWeakIORef'. -- -- Note any monadic side effects in @m@ of the \"finalizer\" computation -- are discarded. -mkWeakIORef ∷ MonadBaseControl IO m ⇒ IORef a → m () → m (Weak (IORef a)) -mkWeakIORef = liftBaseDiscard ∘ R.mkWeakIORef +mkWeakIORef :: MonadBaseControl IO m => IORef a -> m () -> m (Weak (IORef a)) +mkWeakIORef = liftBaseDiscard . R.mkWeakIORef {-# INLINABLE mkWeakIORef #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Foreign/Marshal/Utils/Lifted.hs new/lifted-base-0.2.3.6/Foreign/Marshal/Utils/Lifted.hs --- old/lifted-base-0.2.1.0/Foreign/Marshal/Utils/Lifted.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/lifted-base-0.2.3.6/Foreign/Marshal/Utils/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -0,0 +1,44 @@ +{-# LANGUAGE CPP #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE FlexibleContexts #-} + +#if __GLASGOW_HASKELL__ >= 702 +{-# LANGUAGE Trustworthy #-} +#endif + +{- | +Module : Foreign.Marshal.Utils.Lifted +Copyright : Bas van Dijk, Anders Kaseorg, Michael Steele +License : BSD-style + +Maintainer : Bas van Dijk <[email protected]> +Stability : experimental +Portability : non-portable (extended exceptions) + +This is a wrapped version of "Foreign.Marshal.Utils" with types generalized +from 'IO' to all monads in either 'MonadBase' or 'MonadBaseControl'. +-} + +module Foreign.Marshal.Utils.Lifted + ( with + ) where + +-- from base: +import qualified Foreign as F +import System.IO ( IO ) +import Prelude ( (.) ) + +-- from monad-control: +import Control.Monad.Trans.Control ( MonadBaseControl + , liftBaseOp ) + +-- |Generalized version of 'F.with'. +-- +-- Note, when the given function throws an exception any monadic side +-- effects in @m@ will be discarded. +with :: (MonadBaseControl IO m, F.Storable a) + => a -- ^ value to be poked + -> (F.Ptr a -> m b) -- ^ computation to run + -> m b +with = liftBaseOp . F.with +{-# INLINEABLE with #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/Setup.hs new/lifted-base-0.2.3.6/Setup.hs --- old/lifted-base-0.2.1.0/Setup.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/Setup.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,44 +1,2 @@ -#! /usr/bin/env runhaskell - -{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-} - -module Main (main) where - - -------------------------------------------------------------------------------- --- Imports -------------------------------------------------------------------------------- - --- from base -import System.IO ( IO ) - --- from cabal -import Distribution.Simple ( defaultMainWithHooks - , simpleUserHooks - , UserHooks(haddockHook) - ) - -import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) ) -import Distribution.Simple.Program ( userSpecifyArgs ) -import Distribution.Simple.Setup ( HaddockFlags ) -import Distribution.PackageDescription ( PackageDescription(..) ) - - -------------------------------------------------------------------------------- --- Cabal setup program which sets the CPP define '__HADDOCK __' when haddock is run. -------------------------------------------------------------------------------- - -main ∷ IO () -main = defaultMainWithHooks hooks - where - hooks = simpleUserHooks { haddockHook = haddockHook' } - --- Define __HADDOCK__ for CPP when running haddock. -haddockHook' ∷ PackageDescription → LocalBuildInfo → UserHooks → HaddockFlags → IO () -haddockHook' pkg lbi = - haddockHook simpleUserHooks pkg (lbi { withPrograms = p }) - where - p = userSpecifyArgs "haddock" ["--optghc=-D__HADDOCK__"] (withPrograms lbi) - - --- The End --------------------------------------------------------------------- +import Distribution.Simple +main = defaultMain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/System/Timeout/Lifted.hs new/lifted-base-0.2.3.6/System/Timeout/Lifted.hs --- old/lifted-base-0.2.1.0/System/Timeout/Lifted.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/System/Timeout/Lifted.hs 2015-02-13 20:59:16.000000000 +0100 @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP, UnicodeSyntax, NoImplicitPrelude, FlexibleContexts #-} +{-# LANGUAGE CPP, NoImplicitPrelude, FlexibleContexts #-} #if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} @@ -22,15 +22,13 @@ module System.Timeout.Lifted ( timeout ) where -- from base: +import Prelude ( (.) ) import Data.Int ( Int ) import Data.Maybe ( Maybe(Nothing, Just), maybe ) import Control.Monad ( (>>=), return, liftM ) import System.IO ( IO ) import qualified System.Timeout as T ( timeout ) --- from base-unicode-symbols: -import Data.Function.Unicode ( (∘) ) - -- from monad-control: import Control.Monad.Trans.Control ( MonadBaseControl, restoreM, liftBaseWith ) @@ -41,7 +39,7 @@ -- Note that when the given computation times out any side effects of @m@ are -- discarded. When the computation completes within the given time the -- side-effects are restored on return. -timeout ∷ MonadBaseControl IO m ⇒ Int → m a → m (Maybe a) -timeout t m = liftBaseWith (\runInIO → T.timeout t (runInIO m)) >>= - maybe (return Nothing) (liftM Just ∘ restoreM) +timeout :: MonadBaseControl IO m => Int -> m a -> m (Maybe a) +timeout t m = liftBaseWith (\runInIO -> T.timeout t (runInIO m)) >>= + maybe (return Nothing) (liftM Just . restoreM) {-# INLINABLE timeout #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/lifted-base.cabal new/lifted-base-0.2.3.6/lifted-base.cabal --- old/lifted-base-0.2.1.0/lifted-base.cabal 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/lifted-base.cabal 2015-02-13 20:59:16.000000000 +0100 @@ -1,5 +1,5 @@ Name: lifted-base -Version: 0.2.1.0 +Version: 0.2.3.6 Synopsis: lifted IO operations from the base library License: BSD3 License-file: LICENSE @@ -9,7 +9,7 @@ Homepage: https://github.com/basvandijk/lifted-base Bug-reports: https://github.com/basvandijk/lifted-base/issues Category: Control -Build-type: Custom +Build-type: Simple Cabal-version: >= 1.8 Description: @lifted-base@ exports IO operations from the base library lifted to any instance of 'MonadBase' or 'MonadBaseControl'. @@ -37,19 +37,19 @@ Exposed-modules: Control.Exception.Lifted Control.Concurrent.MVar.Lifted Control.Concurrent.Chan.Lifted + Control.Concurrent.QSem.Lifted + Control.Concurrent.QSemN.Lifted Control.Concurrent.Lifted Data.IORef.Lifted + Foreign.Marshal.Utils.Lifted System.Timeout.Lifted - if impl(ghc < 7.6) + if impl(ghc < 7.8) Exposed-modules: - Control.Concurrent.QSem.Lifted - Control.Concurrent.QSemN.Lifted Control.Concurrent.SampleVar.Lifted Build-depends: base >= 3 && < 5 - , base-unicode-symbols >= 0.1.1 && < 0.3 , transformers-base >= 0.4 && < 0.5 - , monad-control >= 0.3 && < 0.4 + , monad-control >= 0.3 && < 1.1 Include-dirs: include Includes: inlinable.h @@ -64,13 +64,14 @@ hs-source-dirs: test build-depends: lifted-base - , base >= 3 && < 5 - , transformers >= 0.2 && < 0.4 - , transformers-base >= 0.4 && < 0.5 - , monad-control >= 0.3 && < 0.4 - , HUnit >= 1.2.2 && < 1.3 - , test-framework >= 0.2.4 && < 0.9 - , test-framework-hunit >= 0.2.4 && < 0.4 + , base >= 3 && < 5 + , transformers >= 0.3 && < 0.5 + , transformers-base >= 0.4.4 && < 0.5 + , transformers-compat >= 0.3 && < 0.5 + , monad-control >= 1.0.0.3 && < 1.1 + , HUnit >= 1.2.2 && < 1.3 + , test-framework >= 0.2.4 && < 0.9 + , test-framework-hunit >= 0.2.4 && < 0.4 Include-dirs: include Includes: inlinable.h @@ -88,7 +89,7 @@ build-depends: lifted-base , base >= 3 && < 5 - , transformers >= 0.2 && < 0.4 + , transformers >= 0.2 && < 0.5 , criterion >= 0.5 && < 0.9 - , monad-control >= 0.3 && < 0.4 + , monad-control >= 0.3 && < 1.1 , monad-peel >= 0.1 && < 0.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lifted-base-0.2.1.0/test/test.hs new/lifted-base-0.2.3.6/test/test.hs --- old/lifted-base-0.2.1.0/test/test.hs 2013-06-04 18:23:28.000000000 +0200 +++ new/lifted-base-0.2.3.6/test/test.hs 2015-02-13 20:59:16.000000000 +0100 @@ -17,7 +17,8 @@ import Control.Monad.Trans.Maybe import Control.Monad.Trans.Reader import Control.Monad.Trans.Writer -import Control.Monad.Trans.Error +import Control.Monad.Trans.Except + import Control.Monad.Trans.State import qualified Control.Monad.Trans.RWS as RWS @@ -44,17 +45,17 @@ , testSuite "MaybeT" $ fmap fromJust . runMaybeT , testSuite "ReaderT" $ flip runReaderT "reader state" , testSuite "WriterT" runWriterT' - , testSuite "ErrorT" runErrorT' + , testSuite "ExceptT" runExceptT' , testSuite "StateT" $ flip evalStateT "state state" , testSuite "RWST" $ \m -> runRWST' m "RWS in" "RWS state" - , testCase "ErrorT throwError" case_throwError + , testCase "ExceptT throwE" case_throwE , testCase "WriterT tell" case_tell ] where runWriterT' :: Functor m => WriterT [Int] m a -> m a runWriterT' = fmap fst . runWriterT - runErrorT' :: Functor m => ErrorT String m () -> m () - runErrorT' = fmap (either (const ()) id) . runErrorT + runExceptT' :: Functor m => ExceptT String m () -> m () + runExceptT' = fmap (either (const ()) id) . runExceptT runRWST' :: (Monad m, Functor m) => RWS.RWST r [Int] s m a -> r -> s -> m a runRWST' m r s = fmap fst $ RWS.evalRWST m r s @@ -134,11 +135,11 @@ k <- readIORef i k @?= 4 -case_throwError :: Assertion -case_throwError = do +case_throwE :: Assertion +case_throwE = do i <- newIORef one - Left "throwError" <- runErrorT $ - (liftBase (writeIORef i 2) >> throwError "throwError") + Left "throwE" <- runExceptT $ + (liftBase (writeIORef i 2) >> throwE "throwE") `finally` (liftBase $ writeIORef i 3) j <- readIORef i
