Safe Haskell | None |
---|---|
Language | Haskell2010 |
Provides universal conversions between any two string-like types.
Out-of-the-box, Text
(both lazy and strict), ByteString
(both lazy and
strict), and String, are supported.
To hook custom string types into the conversion mechanism, implement both
FromString
and ToString
for your type, and optionally provide special
cases for conversions to and from some other string-like type by
implementing StringConvert
directly.
- class FromString a where
- fromString :: String -> a
- class ToString a where
- class StringConvert a b where
- s :: a -> b
Documentation
class FromString a where Source
fromString :: String -> a Source
Defines how a given type should be converted to String. If at all possible, the conversion should be loss-less, and if encodings are involved, UTF-8 should be the default.
class StringConvert a b where Source
Defines conversions between two given stringish types.