lazyio 0.1.0.4 → 0.1.0.5
raw patch · 2 files changed
+27/−25 lines, 2 filesdep +lazyiodep −special-functorsdep ~basedep ~transformers
Dependencies added: lazyio
Dependencies removed: special-functors
Dependency ranges changed: base, transformers
Files
- lazyio.cabal +11/−24
- src/Test/Main.hs +16/−1
lazyio.cabal view
@@ -1,5 +1,5 @@ Name: lazyio-Version: 0.1.0.4+Version: 0.1.0.5 License: BSD3 License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -29,7 +29,7 @@ The stack overflow is gone. Tested-With: GHC==6.8.2, GHC==6.12.1 Tested-With: GHC==7.4.1, GHC==7.6.3-Cabal-Version: >=1.6+Cabal-Version: >=1.10 Build-Type: Simple Extra-Source-Files: CHANGES@@ -41,26 +41,15 @@ Source-Repository this type: darcs location: http://code.haskell.org/~thielema/lazyio/- tag: 0.1.0.4--Flag splitBase- description: Choose the new smaller, split-up base package.--Flag buildTests- description: Build test executables- default: False+ tag: 0.1.0.5 Library Build-Depends: unsafe >=0.0 && <0.1,- transformers >=0.2 && <0.6- If flag(splitBase)- Build-Depends: base >=2 && <5- Else- Build-Depends:- special-functors >=1.0 && <1.1,- base >=1.0 && <2+ transformers >=0.2 && <0.7,+ base >=2 && <5 + Default-Language: Haskell98 GHC-Options: -Wall Hs-Source-Dirs: src Exposed-Modules:@@ -69,11 +58,9 @@ Data.ApplicativeChain System.IO.Lazy.Applicative --Executable test- If !flag(buildTests)- Buildable: False-+Test-Suite test-lazyio+ Type: exitcode-stdio-1.0+ Default-Language: Haskell98 GHC-Options: -Wall- Hs-source-dirs: src- Main-Is: Test/Main.hs+ Build-Depends: lazyio, transformers, base+ Main-Is: src/Test/Main.hs
src/Test/Main.hs view
@@ -6,6 +6,7 @@ import Control.Monad.Trans.Reader (ReaderT(ReaderT), runReaderT, ) import Control.Monad (liftM2, )+import Control.Applicative (liftA2, ) import Prelude hiding (getLine, ) @@ -48,6 +49,9 @@ getLine = ReaderT $ LazyIO.interleave . IO.hGetLine . getReadHandle +getLinePairApplicative :: HasReadHandle h => ReaderT h LazyIO.T (String, String)+getLinePairApplicative = liftA2 (,) getLine getLine+ getLinePair :: HasReadHandle h => ReaderT h LazyIO.T (String, String) getLinePair = do x <- getLine@@ -78,7 +82,8 @@ ReaderT $ \h -> LazyIO.interleave $ IO.hPutStrLn (getWriteHandle h) str runReadWriteTest ::- String -> String -> ReaderT ReadWriteHandle LazyIO.T a -> (a -> IO ()) -> IO ()+ String -> String ->+ ReaderT ReadWriteHandle LazyIO.T a -> (a -> IO ()) -> IO () runReadWriteTest inputContent outputContent action check = do writeFile inputName inputContent IO.withFile inputName IO.ReadMode $ \hr ->@@ -105,6 +110,16 @@ runReadTest "bla\nblub\n" (do a <- getLinePair+ return (snd a))+ (\str -> assert (str == "blub"))++ runReadTest "bla\n"+ (do a <- getLinePairApplicative+ return (fst a))+ (\str -> assert (str == "bla"))++ runReadTest "bla\nblub\n"+ (do a <- getLinePairApplicative return (snd a)) (\str -> assert (str == "blub"))