Data.String.Conversions

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 #

Methods

convertString :: a -> b #

#### Instances

Instances details

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

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

# type synonyms

type StrictByteString = ByteString #

type SBS = ByteString #

type LazyByteString = ByteString #

type LBS = ByteString #

type StrictText = Text #

type ST = Text #

type LazyText = Text #

type LT = Text #

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 #

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!