relude-1.2.2.0: Safe, performant, user-friendly and lightweight Haskell Standard Library

Copyright | (c) 2016 Stephen Diehl (c) 2016-2018 Serokell (c) 2018-2023 Kowainik
License | MIT
Maintainer | Kowainik <xrom.xkov@gmail.com>
Stability | Stable
Portability | Portable
Safe Haskell | Safe
Language | Haskell2010

Relude.String

Description

Type classes for conversion between different string representations.

The table below represents the `relude` concept of conversion between the following types:

- `Text`
- `String`
- `ByteString`
- `LText`
- `LByteString`
- `ShortByteString`

From \ To | `Text` | `String` | `ByteString` | `LText` | `LByteString` | `ShortByteString`
--- | --- | --- | --- | --- | --- | ---
`Text` | ~ | `toString` | `encodeUtf8` | `toLazy`/`toLText` | `encodeUtf8` | `encodeUtf8`
`String` | `toText` | ~ | `encodeUtf8` | `toLText` | `encodeUtf8` | `encodeUtf8`
`ByteString` | `decodeUtf8` | `decodeUtf8` | ~ | `decodeUtf8` | `toLazy` | `toShort`
`LText` | `toStrict`/`toText` | `toString` | `encodeUtf8` | ~ | `encodeUtf8` | `encodeUtf8`
`LByteString` | `decodeUtf8` | `decodeUtf8` | `toStrict` | `decodeUtf8` | ~ | ``toShort` . `toStrict``
`ShortByteString` | `decodeUtf8` | `decodeUtf8` | `fromShort` | `decodeUtf8` | ``toLazy` . `fromShort`` | ~

Synopsis

- module Relude.String.Reexport
- module Relude.String.Conversion

# Documentation

module Relude.String.Reexport

Reexport data types and functions to work with `Text`, `ByteString`, `ShortByteString`.

module Relude.String.Conversion

Conversion functions between `Text`, `String`, `ByteString`. Also some read|show helper functions.