Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
Chapters
List of modules that make a significant appearance in each chapter:
Setup
- Relude - Alternate prelude that includes a lot of standard utilities
- System.Directory, System.FilePath - Determining where our data files should go
1 - Handles
- System.IO - Writing to a file
- Control.Monad.Trans.Resource - Using
allocate
to ensure that file handles are closed
2 - Chunks
- Data.Text -
Text
is a chunk of characters - Data.Text.IO - Reading and writing files using
Text
instead ofString
3 - Bytes
- Data.ByteString -
ByteString
is a chunk of bytes - Data.Text.Encoding - Conversions between
ByteString
andText
4 - Sockets
- Network.Socket - Opening and closing sockets, resolving network addresses
- Network.Socket.ByteString - Writing to and reading from sockets
5 - HTTP
- ASCII, ASCII.Char - Expressing HTTP messages as strings using the
string
quasi-quoter - Network.Simple.TCP - Listening for client connections using
serve
6 - HTTP types
- ASCII.Decimal, Data.ByteString.Lazy - Defining datatypes for the parts of an HTTP message
7 - Encoding
- Data.Text.Lazy, Data.Text.Lazy.Builder - Efficient text concatenations with
Builder
- Data.ByteString.Lazy, Data.ByteString.Builder - Efficient byte string concatenations with
Builder
- Data.Time - Simple performance testing with
getCurrentTime
anddiffUTCTime
8 - Responding
- No additional imports in this chapter
9 - Content types
- Data.Text.Lazy.Builder.Int, Data.Text.Lazy.IO, Data.Text.Lazy.Encoding - Building a text response body
- Text.Blaze.Html, Text.Blaze.Html5, Text.Blaze.Html.Renderer.Utf8 - Building an HTML response body
- Data.Aeson, Data.Aeson.Key, Data.Aeson.KeyMap - Building a JSON response body
10 - Change
- Control.Concurrent.STM - Shared
TVar
state for request-handling threads - Control.Concurrent.Async - Demonstrating thread safety with
replicateConcurrently_
11 - Streaming
- Control.Concurrent - Slowing things down with
threadDelay
12 - ListT IO
- List.Transformer - Representing files and chunked HTTP message bodies as I/O streams
13 - Parsing
- Data.Map.Strict - Mapping resource names to file paths
- Data.Attoparsec.ByteString - Parsing HTTP requests
14 - Errors
- Unfork - Thread-safe logging
The remaining chapters are in progress:
15 - Reading the head
16 - Reading the body
17 - Connection reuse
Libraries
Re-exported modules, grouped by the package that each module originally comes from:
ascii - ASCII, ASCII.Char, ASCII.Decimal
aeson - Data.Aeson, Data.Aeson.Key, Data.Aeson.KeyMap
async - Control.Concurrent.Async
base
- File handles - System.IO
- Fundamental data types - Data.Char
- Miscellanea - Control.Concurrent, Control.Monad
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 - To discuss why we don't use it
containers - Data.Map.Strict
directory - System.Directory
filepath - System.FilePath
list-transformer - List.Transformer
network
- Network.Socket - The Socket type, operations for opening and closing sockets
- Network.Socket.ByteString - Socket read/write operations with strict byte strings
network-simple
- Network.Simple.TCP - Sockets that listen for incoming client connections
relude - Relude
resourcet - Control.Monad.Trans.Resource
safe-exceptions - Control.Exception.Safe
stm - Control.Monad.STM, Control.Concurrent.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
unfork - Unfork