Package1.5.2.2DataNetworkIO-Streams
io-streams
Simple, composable, and easy-to-use stream I/O
- Version1.5.2.2
- CategoryData, Network, IO-Streams
- LicenceBSD-3-Clause
- MaintainerGregory Collins <greg@gregorycollins.net>
- Pinned byhackage io-streams 1.5.2.2
- Sourcehackage.haskell.org/package/io-streams-1.5.2.2
Modules
20 modules- System.IO.Streams23This module is a top-level convenience module which re-exports most of the
- System.IO.Streams.Attoparsec3This module is deprecated -- use
- System.IO.Streams.Attoparsec.ByteString3This module provides support for parsing values from ByteString
- System.IO.Streams.Attoparsec.Text3This module provides support for parsing values from Text
- System.IO.Streams.Builder3Buffering for output streams based on bytestring builders. Buffering an output stream can often improve throughput by reducing the
- System.IO.Streams.ByteString26Stream operations on ByteString.
- System.IO.Streams.Combinators37Generic stream manipulations
- System.IO.Streams.Concurrent5Stream utilities for working with concurrent channels.
- System.IO.Streams.Core23Core types and functions for the io-streams library.
- System.IO.Streams.Debug4Convenience module for debugging streams. Provides stream transformers
- System.IO.Streams.File5Input and output streams for files. The functions in this file use "with*" or "bracket" semantics, i.e. they
- System.IO.Streams.Handle9Input and output streams for file Handles.
- System.IO.Streams.List8List conversions and utilities.
- System.IO.Streams.Network2Converting network Sockets to streams.
- System.IO.Streams.Process19A module adapting the functions from System.Process to work with
- System.IO.Streams.Text3Stream primitives for decoding and encoding Text values in UTF-8 format.
- System.IO.Streams.Tutorial0
- System.IO.Streams.Vector15Vector conversions and utilities.
- System.IO.Streams.Zlib8Interface to zlib and gzip compression for Bytestrings and Builders
Internal modules · 1
- System.IO.Streams.Internal28Internal implementation of the io-streams library, intended for library
Description
Overview
The io-streams library contains simple and easy-to-use primitives for I/O using streams. Most users will want to import the top-level convenience module System.IO.Streams, which re-exports most of the library:
import System.IO.Streams (InputStream, OutputStream) import qualified System.IO.Streams as Streams
For first-time users, io-streams comes with an included tutorial, which can be found in the System.IO.Streams.Tutorial module.
Features
The io-streams user API has two basic types: InputStream a and OutputStream a, and three fundamental I/O primitives:
-- read an item from an input stream Streams.read :: InputStream a -> IO (Maybe a) -- push an item back to an input stream Streams.unRead :: a -> InputStream a -> IO () -- write to an output stream Streams.write :: Maybe a -> OutputStream a -> IO ()
Streams can be transformed by composition and hooked together with provided combinators:
ghci> Streams.fromList [1,2,3::Int] >>= Streams.map (*10) >>= Streams.toList [10,20,30]
Stream composition leaves the original stream accessible:
ghci> input <- Streams.fromByteString "long string" ghci> wrapped <- Streams.takeBytes 4 input ghci> Streams.read wrapped Just "long" ghci> Streams.read wrapped Nothing ghci> Streams.read input Just " string"
Simple types and operations in the IO monad mean straightforward and simple exception handling and resource cleanup using Haskell standard library facilities like Control.Exception.bracket.
io-streams comes with:
functions to use files, handles, concurrent channels, sockets, lists, vectors, and more as streams. a variety of combinators for wrapping and transforming streams, including compression and decompression using zlib, controlling precisely how many bytes are read from or written to a stream, buffering output using bytestring builders, folds, maps, filters, zips, etc. support for parsing from streams using attoparsec. support for spawning processes and communicating with them using streams.
Depends on
11 packages- attoparsec-0.14.4in this set
- base-4.20.2.0with GHC
- bytestring-0.12.2.0with GHC
- network-3.2.8.0in this set
- primitive-0.9.1.0in this set
- process-1.6.26.1with GHC
- text-2.1.3with GHC
- time-1.12.2with GHC
- transformers-0.6.1.1with GHC
- vector-0.13.2.0in this set
- zlib-bindings-0.1.1.5in this set