packages feed

resourcet 1.1.7.5 → 1.1.8

raw patch · 4 files changed

+18/−8 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Trans.Resource.Internal: instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (Control.Monad.Trans.Resource.Internal.ResourceT m)

Files

ChangeLog.md view
@@ -1,3 +1,8 @@+## 1.1.8++* Add `instance MonadFix ResourceT`+  [#281](https://github.com/snoyberg/conduit/pull/281)+ ## 1.1.7.5  * Inline the tutorial from SoH
Control/Monad/Trans/Resource/Internal.hs view
@@ -32,6 +32,7 @@ import Control.Exception (throw,Exception,SomeException) import Control.Applicative (Applicative (..), Alternative(..)) import Control.Monad (MonadPlus(..))+import Control.Monad.Fix (MonadFix(..)) import Control.Monad.Trans.Control     ( MonadTransControl (..), MonadBaseControl (..) ) import Control.Monad.Base (MonadBase, liftBase)@@ -246,6 +247,10 @@         a <- ma r         let ResourceT f' = f a         f' r++-- | @since 1.1.8+instance MonadFix m => MonadFix (ResourceT m) where+  mfix f = ResourceT $ \r -> mfix $ \a -> unResourceT (f a) r  instance MonadTrans ResourceT where     lift = ResourceT . const
README.md view
@@ -20,7 +20,7 @@  ResourceT is a monad transformer which creates a region of code where you can safely allocate resources. Let's write a simple example program: we'll ask the user for some input and pretend like it's a scarce resource that must be released. We'll then do something dangerous (potentially introducing a divide-by-zero error). We then want to immediately release our scarce resource and perform some long-running computation. -```haskell active+```haskell import Control.Monad.Trans.Resource import Control.Monad.IO.Class @@ -46,7 +46,7 @@  In this specific case, we could easily represent our code in terms of bracket with a little refactoring. -```haskell active+```haskell import Control.Exception (bracket)  main = do@@ -75,7 +75,7 @@  The first one is pretty easy to demonstrate: -```haskell active+```haskell import Control.Monad.Trans.Resource import Control.Monad.Trans.Class @@ -95,7 +95,7 @@  The `bracket` pattern is designed with nested resource allocations. For example, consider the following program which copies data from one file to another. We'll open up the source file using `withFile`, and then nest within it another `withFile` to open the destination file, and finally do the copying with both file handles. -```haskell active+```haskell {-# START_FILE main.hs #-} import System.IO import qualified Data.ByteString as S@@ -121,7 +121,7 @@  Let's demonstrate the interleaving example described above. To simplify the code, we'll use the conduit package for the actual chunking implementation. Notice when you run the program that there are never more than two file handles open at the same time. -```haskell active+```haskell import           Control.Monad.IO.Class (liftIO) import           Data.Conduit           (addCleanup, runResourceT, ($$), (=$)) import           Data.Conduit.Binary    (isolate, sinkFile, sourceFile)@@ -190,7 +190,7 @@ from the other. The canonical demonstration of resourcet combined with conduit is the file copy function: -```haskell active+```haskell import Data.Conduit import Data.Conduit.Binary @@ -204,7 +204,7 @@  However, since this function does not actually use any of ResourceT's added functionality, it can easily be implemented with the bracket pattern instead: -```haskell active+```haskell import Data.Conduit import Data.Conduit.Binary import System.IO
resourcet.cabal view
@@ -1,5 +1,5 @@ Name:                resourcet-Version:             1.1.7.5+Version:             1.1.8 Synopsis:            Deterministic allocation and freeing of scarce resources. description:         Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/resourcet>. License:             BSD3