| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Text.Through
- class ToText a where
- toText :: a -> StrictText
- class FromText a where
- fromText :: StrictText -> a
- throughText :: (ToText a, FromText b) => a -> b
- type LazyByteString = ByteString
- type LazyText = Text
- type StrictByteString = ByteString
- type StrictText = Text
- data CI s :: * -> *
- lazyByteStringToLazyText :: LazyByteString -> LazyText
- lazyTextToLazyByteString :: LazyText -> LazyByteString
Type classes
Methods
toText :: a -> StrictText Source
Instances
| ToText StrictText | The identity instance is used so |
| ToText StrictByteString | Uses lenient decoding which replaces invalid characters with U+FFFD. |
| ToText LazyText | |
| ToText LazyByteString | Uses lenient decoding which replaces invalid characters with U+FFFD. |
| ToText [Char] | |
| ToText a => ToText (CI a) |
Methods
fromText :: StrictText -> a Source
Instances
| FromText StrictText | The identity instance is used so |
| FromText StrictByteString | |
| FromText LazyText | |
| FromText LazyByteString | |
| FromText [Char] | |
| (FoldCase a, FromText a) => FromText (CI a) |
Double conversion
throughText :: (ToText a, FromText b) => a -> b Source
Convert between all textual types.
Types and type aliases
type LazyByteString = ByteString Source
type StrictByteString = ByteString Source
type StrictText = Text Source
data CI s :: * -> *
A CI s provides Case Insensitive comparison for the string-like type s (for example: String, Text, ByteString, etc.).
Note that CI s has an instance for IsString which together with the OverloadedStrings language extension allows you to write case insensitive string literals as in:
> ("Content-Type" :: CI Text) == ("CONTENT-TYPE" :: CI Text) True Instances
| Eq s => Eq (CI s) | |
| Data s => Data (CI s) | |
| Ord s => Ord (CI s) | |
| (Read s, FoldCase s) => Read (CI s) | |
| Show s => Show (CI s) | |
| (IsString s, FoldCase s) => IsString (CI s) | |
| Monoid s => Monoid (CI s) | |
| FoldCase (CI s) | |
| NFData s => NFData (CI s) | |
| Hashable s => Hashable (CI s) | |
| (FoldCase a, FromText a) => FromText (CI a) | |
| ToText a => ToText (CI a) | |
| Typeable (* -> *) CI |
Provided for efficiency
lazyByteStringToLazyText :: LazyByteString -> LazyText Source
More efficient than throughText, replaces invalid characters with U+FFFD.
lazyTextToLazyByteString :: LazyText -> LazyByteString Source
More efficient than throughText