Safe Haskell | None |
---|---|
Language | Haskell2010 |
Text.StringConvert
Description
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.
- class FromString a where
- fromString :: FromString a => String -> a
- class ToString a where
- toString :: ToString a => a -> String
- s :: (ToString a, FromString b) => a -> b
Documentation
class FromString a where Source #
Minimal complete definition
Methods
fromString :: String -> a Source #
Instances
fromString :: FromString a => String -> a Source #
class ToString a where 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.
Minimal complete definition
s :: (ToString a, FromString b) => a -> b Source #