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
- System.IO.StreamsThis module is a top-level convenience module which re-exports most of the
- System.IO.Streams.AttoparsecThis module is deprecated -- use
- System.IO.Streams.Attoparsec.ByteStringThis module provides support for parsing values from ByteString
- System.IO.Streams.Attoparsec.TextThis module provides support for parsing values from Text
- System.IO.Streams.BuilderBuffering for output streams based on bytestring builders. Buffering an output stream can often improve throughput by reducing the
- System.IO.Streams.ByteStringStream operations on ByteString.
- System.IO.Streams.CombinatorsGeneric stream manipulations
- System.IO.Streams.ConcurrentStream utilities for working with concurrent channels.
- System.IO.Streams.CoreCore types and functions for the io-streams library.
- System.IO.Streams.DebugConvenience module for debugging streams. Provides stream transformers
- System.IO.Streams.FileInput and output streams for files. The functions in this file use "with*" or "bracket" semantics, i.e. they
- System.IO.Streams.HandleInput and output streams for file Handles.
- System.IO.Streams.ListList conversions and utilities.
- System.IO.Streams.NetworkConverting network Sockets to streams.
- System.IO.Streams.ProcessA module adapting the functions from System.Process to work with
- System.IO.Streams.TextStream primitives for decoding and encoding Text values in UTF-8 format.
- System.IO.Streams.Tutorial
- System.IO.Streams.VectorVector conversions and utilities.
- System.IO.Streams.ZlibInterface to zlib and gzip compression for Bytestrings and Builders
Internal modules · 1
- System.IO.Streams.InternalInternal 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.23.0.0with GHC
- bytestring-0.12.2.0with GHC
- network-3.2.9.0in this set
- primitive-0.9.1.0in this set
- process-1.6.30.0with GHC
- text-2.1.4with GHC
- time-1.16.0.1with GHC
- transformers-0.6.3.0with GHC
- vector-0.13.2.0in this set
- zlib-bindings-0.1.1.5in this set