from-string

Instances of 'From' for common string types

https://codeberg.org/xt/from

Stackage Nightly 2025-10-26:1.0.0.2
Latest on Hackage:1.0.0.2

See all snapshots from-string appears in

Apache-2.0 licensed by XT
Maintained by [email protected]
This version can be pinned in stack with:from-string-1.0.0.2@sha256:853394a3e7b6be7e8462d34c1b59aed239e50837366cbb891d5f28d52ec0354e,2666

Module documentation for 1.0.0.2

Depends on 4 packages(full list with versions):

from-string

Note that this package is a part of the “project” that includes from and from-string. For the general rationale behind this idea, see README.md under the project root.

This Haskell library package provides the From typeclass instances for the conversion of following types:

  • String
  • bytestring:
    • Strict ByteString
    • Lazy ByteString
    • Builder for ByteString
    • ShortByteString
  • text:
    • Strict Text
    • Lazy Text
    • Builder for Text

Whenever encoding/decoding happens, this library assumes that the aforementioned types internally contains either

  • a sequence of Unicode characters, or
  • a sequence of bytes in UTF-8.

This should be a reasonable assumption for practical software development. If you need any other assumption, you should specify the accurate conversion in the code, instead of ‘from’.

See the From.String module documentation for more detail.

Changes

Changelog for from-string

All notable changes to this project should be documented in this file.

The format is based on Keep a Changelog, and this project adheres to the Haskell Package Versioning Policy.

1.0.0.2 - 2025-10-24

Changed

  • Split the test code into ordinary test and code generation test. The code generation test will not be run by default (by Hackage or Stackage, for example).

1.0.0.1 - 2025-10-24

Changed

  • Set upper/lower bound for the dependencies: bytestring, text, and from.

1.0.0.0 - 2025-10-24

Initial release.

Added

  • From instances for string-related types. Any of the following types can be converted from one to another using from:
    • Prelude.String
    • Data.Text.Text
    • Data.Text.Lazy.Text
    • Data.Text.Lazy.Builder.Builder
    • Data.ByteString.ByteString
    • Data.ByteString.Lazy.ByteString
    • Data.ByteString.Builder.Builder
    • Data.ByteString.Short.ShortByteString
  • When the conversion crosses the boundary of the byte-sequence types and the character-sequence types, UTF-8 is assumed.