lazyio 0.0.3.2 → 0.0.3.3
raw patch · 3 files changed
+13/−11 lines, 3 filesdep +unsafe
Dependencies added: unsafe
Files
- lazyio.cabal +6/−4
- src/System/IO/Lazy.hs +5/−5
- src/System/IO/Lazy/Applicative.hs +2/−2
lazyio.cabal view
@@ -1,5 +1,5 @@ Name: lazyio-Version: 0.0.3.2+Version: 0.0.3.3 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -14,7 +14,7 @@ That is, the LazyIO action is only executed as far as necessary in order to provide the required data. Tested-With: GHC==6.8.2, GHC==6.12.1-Tested-With: GHC==7.4.1+Tested-With: GHC==7.4.1, GHC==7.6.3 Cabal-Version: >=1.6 Build-Type: Simple Source-Repository head@@ -24,7 +24,7 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/lazyio/- tag: 0.0.3.2+ tag: 0.0.3.3 Flag splitBase description: Choose the new smaller, split-up base package.@@ -34,7 +34,9 @@ default: False Library- Build-Depends: transformers >=0.2 && <0.4+ Build-Depends:+ unsafe >=0.0 && <0.1,+ transformers >=0.2 && <0.4 If flag(splitBase) Build-Depends: base >=2 && <5 Else
src/System/IO/Lazy.hs view
@@ -1,9 +1,9 @@ {- | Caution: -- Although this module calls 'unsafeInterleaveIO' for you,+- Although this module calls 'Unsafe.interleaveIO' for you, it cannot take the responsibility from you.- Using this module is still as unsafe as calling 'unsafeInterleaveIO' manually.+ Using this module is still as unsafe as calling 'Unsafe.interleaveIO' manually. Thus we recommend to wrap the lazy I/O monad into a custom @newtype@ with a restricted set of operations which is considered safe for interleaving I/O actions.@@ -46,7 +46,7 @@ import Control.Monad.Trans.State (StateT(StateT), mapStateT, evalStateT, {- runStateT, -} ) import Control.Monad (ap, {- liftM2, -} ) import Control.Applicative (Applicative(pure, (<*>)), )-import System.IO.Unsafe (unsafeInterleaveIO, )+import qualified System.Unsafe as Unsafe newtype T a = Cons {decons :: StateT RunAll IO a}@@ -57,8 +57,8 @@ instance Monad T where return x = Cons $ return x x >>= f = Cons $- mapStateT unsafeInterleaveIO . decons . f =<<- mapStateT unsafeInterleaveIO (decons x)+ mapStateT Unsafe.interleaveIO . decons . f =<<+ mapStateT Unsafe.interleaveIO (decons x) instance Functor T where fmap f = Cons . fmap f . decons
src/System/IO/Lazy/Applicative.hs view
@@ -1,9 +1,9 @@ module System.IO.Lazy.Applicative where import qualified Data.ApplicativeChain as Chain+import qualified System.Unsafe as Unsafe import Control.Applicative (Applicative(pure, (<*>)), ) import Control.Monad (liftM2, )-import System.IO.Unsafe (unsafeInterleaveIO, ) newtype T a = Cons {decons :: IO (Chain.T a)}@@ -20,7 +20,7 @@ -- instance MonadIO T where liftIO :: IO a -> T a-liftIO = Cons . unsafeInterleaveIO . fmap (Chain.Cons Chain.RunAll)+liftIO = Cons . Unsafe.interleaveIO . fmap (Chain.Cons Chain.RunAll) run :: T a -> IO a run = fmap Chain.result . decons