HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulestring-conv-0.2.0Haskell2010

Data.String.Conv

  • 1 type
  • 1 class
  • 4 values
classclass StringConv a b where
#

A type class to standardize string conversions. With this type class you only need to remember one function for converting between any two string variants. This package includes support for String, ByteString, and Text as well as the Lazy and Strict variants where necessary.

This type class lets you control how conversion should behave when failure is possible. Strict mode will cause an exception to be thrown when decoding fails. Lenient mode will attempt to recover, inserting a replacement character for invalid bytes.

StringConv's toS function is most useful when you have a fully defined string conversion with a fixed (non-polymorphic) input and output type. Of course you can still use it when you don't have a fixed type. In that case you might need to specify a type class constraint such as StringConv s String.

Methods

Instances25StringConv, …
valuetoS :: StringConv a b => a -> b
#

Universal string conversion function for strict decoding.

valuetoSL :: StringConv a b => a -> b
#

Universal string conversion function for lenient decoding.

datadata Leniency
#

Data type representing the two leniency modes defining how decoding failure is handled.

Instances6Bounded, Enum, Eq, Ord, Read, Show
  • Bounded LeniencyDefined in string-conv-0.2.0 · Data.String.Conv
  • Enum LeniencyDefined in string-conv-0.2.0 · Data.String.Conv
  • Eq LeniencyDefined in string-conv-0.2.0 · Data.String.Conv
  • Ord LeniencyDefined in string-conv-0.2.0 · Data.String.Conv
  • Read LeniencyDefined in string-conv-0.2.0 · Data.String.Conv
  • Show LeniencyDefined in string-conv-0.2.0 · Data.String.Conv