sockets-and-pipes: Support for the Sockets and Pipes book
This package contains some utilities that support Sockets and Pipes (available on Leanpub), as well as re-exports from all the libraries mentioned in the book.
Code in this package
Original contributions from this package:
Chapters
List of modules that make a significant appearance in each chapter:
Chapter | Module | Purpose | |
---|---|---|---|
1 | Handles | System.IO | Writing to a file |
Control.Exception.Safe | Using bracket to ensure
the file handle is closed | ||
2 | Chunks | Data.Text | Text is a chunk of characters |
Data.Text.IO | Reading and writing files using
Text instead of String | ||
3 | Bytes | Data.Word | What a byte is |
Data.ByteString | ByteString is a chunk of bytes | ||
Data.Text.Encoding | Conversions between ByteString
and Text | ||
Data.String | How ByteString works with
OverloadedStrings
| ||
Data.ByteString.Char8 | |||
System.IO | Putting Handle s into binary mode | ||
4 | Sockets | Network.Socket | Opening and closing sockets |
Network.Socket.ByteString | Writing to and reading from sockets | ||
System.Timeout | Giving up quickly when a service does not respond | ||
5 | HTTP | ASCII | Expressing HTTP messages as strings |
ASCII.Char | |||
SocketsAndPipes.Serve | Our first rudimentary web server | ||
6 | HTTP types | Data.ByteString | Defining datatypes for the parts of an HTTP message |
Data.ByteString.Lazy | |||
7 | Encoding | Data.Text.Lazy | Efficient string concatenations |
Data.Text.Lazy.Builder | |||
Data.ByteString.Builder | |||
Data.Time | Simple performance testing | ||
Data.Foldable | Encoding repetitions with foldMap | ||
8 | Responding | Network.Socket.ByteString.Lazy | Sending responses constructed by
bytestring Builder |
SocketsAndPipes.Serve | New web server using the encoding functions | ||
Data.Int | Contrasting Integer , Int ,
and Int64 | ||
9 | Content types | Data.Text.Lazy.Builder.Int | Building a text response body |
Text.Blaze.Html | Building an HTML response body | ||
Text.Blaze.Html5 | |||
Text.Blaze.Html.Renderer.Utf8 | |||
Data.Aeson | Building a JSON response body | ||
10 | Change | Control.Concurrent.STM.TVar | Shared state for request-handling threads |
Control.Monad.STM | |||
11 | Streaming | Data.ByteString.Builder | Chunked HTTP message encoding |
12 | ListT IO | Pipes | Representing files and chunked HTTP message bodies as I/O streams |
13 | Request parsing | The remaining chapters are in progress. | |
14 | Reading headers | ||
15 | Body parsing | ||
16 | Connection reuse | ||
17 | Producers and Consumers |
Libraries
Re-exported modules, grouped by the package that each module originally comes from:
ascii - ASCII, ASCII.Char
aeson - Data.Aeson
async - Control.Concurrent.Async
base
File handles - System.IO
Integer conversions - Data.Bits
Miscellania - System.Timeout, Control.Monad, Data.Foldable, Data.List
blaze-html - Text.Blaze.Html, Text.Blaze.Html5, Text.Blaze.Html5.Attributes, Text.Blaze.Html.Renderer.Utf8
bytestring
Strict - Data.ByteString
Lazy - Data.ByteString.Lazy
Builder - Data.ByteString.Builder
Data.ByteString.Char8 - This is included mostly to discuss why we don't use it.
network
Network.Socket - The Socket type, operations for opening and closing sockets
Network.Socket.ByteString - Socket read/write operations with strict byte strings
Network.Socket.ByteString.Lazy - Socket read/write operations with lazy byte strings
pipes
Pipes - ListT
safe-exceptions - Control.Exception.Safe
stm - Control.Monad.STM, Control.Concurrent.STM.TVar
text
Strict - Data.Text, Data.Text.Encoding, Data.Text.IO
Lazy - Data.Text.Lazy, Data.Text.Lazy.Encoding, Data.Text.Lazy.IO
Builder - Data.Text.Lazy.Builder, Data.Text.Lazy.Builder.Int
time - Data.Time
Modules
[Index] [Quick Jump]
- ASCII
- ASCII.Char
- Control
- Control.Concurrent
- Control.Concurrent.Async
- Control.Concurrent.STM
- Control.Concurrent.STM.TVar
- Exception
- Control.Exception.Safe
- Control.Monad
- Control.Monad.STM
- Control.Concurrent
- Data
- Data.Aeson
- Data.Bits
- Data.ByteString
- Data.ByteString.Builder
- Data.ByteString.Char8
- Data.ByteString.Lazy
- Data.Char
- Data.Foldable
- Data.Int
- Data.List
- Data.Text
- Data.Text.Encoding
- Data.Text.IO
- Data.Text.Lazy
- Data.Text.Lazy.Builder
- Data.Text.Lazy.Builder.Int
- Data.Text.Lazy.Encoding
- Data.Text.Lazy.IO
- Data.Text.Lazy.Builder
- Data.Time
- Data.Word
- Network
- Network.Socket
- Network.Socket.ByteString
- Network.Socket.ByteString.Lazy
- Network.Socket.ByteString
- Network.Socket
- Pipes
- SocketsAndPipes
- System
- System.IO
- System.Timeout
- Text
- Blaze
- Text.Blaze.Html
- Renderer
- Text.Blaze.Html.Renderer.Utf8
- Renderer
- Text.Blaze.Html5
- Text.Blaze.Html5.Attributes
- Text.Blaze.Html
- Blaze
Downloads
- sockets-and-pipes-0.2.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1, 0.2, 0.3, 1.0.0.0 |
---|---|
Dependencies | aeson (>=1.3 && <1.6), ascii (>=1.0 && <1.1), async (>=2.2 && <2.3), base (>=4.12 && <4.16), blaze-html (>=0.9 && <0.10), bytestring (>=0.10 && <0.12), containers (>=0.5.7 && <0.7), network (>=3.1.2 && <3.2), pipes (>=4.3.9 && <4.4), safe-exceptions (>=0.1.7.0 && <0.2), stm (>=2.5 && <2.6), text (>=1.2.3 && <1.3), time (>=1.9 && <1.12) [details] |
Tested with | ghc ==9.0.1, ghc ==8.10.3, ghc ==8.8.4, ghc ==8.6.5 |
License | Apache-2.0 |
Author | Chris Martin, Julie Moronuki |
Maintainer | Joy of Haskell <hello@joyofhaskell.com> |
Category | HTTP, Network, Streaming, Text |
Source repo | head: git clone git://github.com/joyofhaskell/sockets-and-pipes.git |
Uploaded | by chris_martin at 2021-05-01T08:25:46Z |
Distributions | |
Downloads | 647 total (1 in the last 30 days) |
Rating | 2.0 (votes: 1) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2021-05-01 [all 1 reports] |