string-conversions-0.4.0.1: Simplifies dealing with different types for strings

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.String.Conversions

Contents

- class and conversions
- type synonyms

Description

A type class for converting strings. Supported types are:

- `String`
- strict `ByteString`
- lazy `ByteString`
- strict `Text`
- lazy `Text`

Assumes UTF-8 encoding for both types of ByteStrings.

Synopsis

- class ConvertibleStrings a b where
  - convertString :: a -> b
- cs :: ConvertibleStrings a b => a -> b
- type StrictByteString = ByteString
- type SBS = ByteString
- type LazyByteString = ByteString
- type LBS = ByteString
- type StrictText = Text
- type ST = Text
- type LazyText = Text
- type LT = Text
- (<>) :: Semigroup a => a -> a -> a

# class and conversions

class ConvertibleStrings a b where Source #

Methods

convertString :: a -> b Source #

#### Instances

Instances details

ConvertibleStrings LazyByteString LazyByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyByteString -> LazyByteString Source #
ConvertibleStrings LazyByteString LazyText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyByteString -> LazyText Source #
ConvertibleStrings LazyByteString StrictByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyByteString -> StrictByteString Source #
ConvertibleStrings LazyByteString StrictText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyByteString -> StrictText Source #
ConvertibleStrings LazyByteString String Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyByteString -> String Source #
ConvertibleStrings LazyText LazyByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyText -> LazyByteString Source #
ConvertibleStrings LazyText LazyText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyText -> LazyText Source #
ConvertibleStrings LazyText StrictByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyText -> StrictByteString Source #
ConvertibleStrings LazyText StrictText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyText -> StrictText Source #
ConvertibleStrings LazyText String Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: LazyText -> String Source #
ConvertibleStrings StrictByteString LazyByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictByteString -> LazyByteString Source #
ConvertibleStrings StrictByteString LazyText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictByteString -> LazyText Source #
ConvertibleStrings StrictByteString StrictByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictByteString -> StrictByteString Source #
ConvertibleStrings StrictByteString StrictText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictByteString -> StrictText Source #
ConvertibleStrings StrictByteString String Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictByteString -> String Source #
ConvertibleStrings StrictText LazyByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictText -> LazyByteString Source #
ConvertibleStrings StrictText LazyText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictText -> LazyText Source #
ConvertibleStrings StrictText StrictByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictText -> StrictByteString Source #
ConvertibleStrings StrictText StrictText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictText -> StrictText Source #
ConvertibleStrings StrictText String Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: StrictText -> String Source #
ConvertibleStrings String LazyByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: String -> LazyByteString Source #
ConvertibleStrings String LazyText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: String -> LazyText Source #
ConvertibleStrings String StrictByteString Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: String -> StrictByteString Source #
ConvertibleStrings String StrictText Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: String -> StrictText Source #
ConvertibleStrings String String Source # |
Instance details Defined in Data.String.Conversions Methods convertString :: String -> String Source #

cs :: ConvertibleStrings a b => a -> b Source #

# type synonyms

type StrictByteString = ByteString Source #

type SBS = ByteString Source #

type LazyByteString = ByteString Source #

type LBS = ByteString Source #

type StrictText = Text Source #

type ST = Text Source #

type LazyText = Text Source #

type LT = Text Source #

Generic string concatenation (with ghc >= 7.4 this is a re-export from Data.Monoid to avoid clashes.)

(<>) :: Semigroup a => a -> a -> a infixr 6 Source #

An associative operation.

#### Examples

Expand

    >>> [1,2,3] <> [4,5,6]
    [1,2,3,4,5,6]

    >>> Just [1, 2, 3] <> Just [4, 5, 6]
    Just [1,2,3,4,5,6]

    >>> putStr "Hello, " <> putStrLn "World!"
    Hello, World!