ListLike-4.7.8.2: Generalized support for list-like structures

Copyright | Copyright (C) 2007 John Goerzen
License | BSD3
Maintainer | David Fox <dsf@seereason.com>, Andreas Abel
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell2010

Data.ListLike.String

Description

String-like functions

Written by John Goerzen, jgoerzen@complete.org

Synopsis

- class IsString s => StringLike s where
  - toString :: s -> String
  - lines :: ListLike full s => s -> full
  - words :: ListLike full s => s -> full
  - unlines :: ListLike full s => full -> s
  - unwords :: ListLike full s => full -> s
  - show :: Show a => a -> s
  - fromStringLike :: StringLike s' => s -> s'
  - fromText :: Text -> s
  - fromLazyText :: Text -> s
- fromString :: IsString a => String -> a

# Documentation

class IsString s => StringLike s where #

An extension to `ListLike` for those data types that are similar to a `String`. Minimal complete definition is `toString` and `fromString`.

Minimal complete definition

toString

Methods

toString :: s -> String #

Converts the structure to a `String`

lines :: ListLike full s => s -> full #

Breaks a string into a list of strings

words :: ListLike full s => s -> full #

Breaks a string into a list of words

unlines :: ListLike full s => full -> s #

Joins lines

unwords :: ListLike full s => full -> s #

Joins words

show :: Show a => a -> s #

Generalize the `Show` method t return any `StringLike`.

fromStringLike :: StringLike s' => s -> s' #

Deprecated: Use fromString . toString or something more efficient using local knowledge

fromText :: Text -> s #

Override this to avoid extra `String` conversions.

fromLazyText :: Text -> s #

Override this to avoid extra `String` conversions.

#### Instances

Instances details

StringLike CharString # |
Instance details Defined in Data.ListLike.CharString Methods toString :: CharString -> String # lines :: ListLike full CharString => CharString -> full # words :: ListLike full CharString => CharString -> full # unlines :: ListLike full CharString => full -> CharString # unwords :: ListLike full CharString => full -> CharString # show :: Show a => a -> CharString # fromStringLike :: StringLike s' => CharString -> s' # fromText :: Text -> CharString # fromLazyText :: Text -> CharString #
StringLike CharStringLazy # |
Instance details Defined in Data.ListLike.CharString Methods toString :: CharStringLazy -> String # lines :: ListLike full CharStringLazy => CharStringLazy -> full # words :: ListLike full CharStringLazy => CharStringLazy -> full # unlines :: ListLike full CharStringLazy => full -> CharStringLazy # unwords :: ListLike full CharStringLazy => full -> CharStringLazy # show :: Show a => a -> CharStringLazy # fromStringLike :: StringLike s' => CharStringLazy -> s' # fromText :: Text -> CharStringLazy # fromLazyText :: Text -> CharStringLazy #
StringLike Chars # |
Instance details Defined in Data.ListLike.Chars Methods toString :: Chars -> String # lines :: ListLike full Chars => Chars -> full # words :: ListLike full Chars => Chars -> full # unlines :: ListLike full Chars => full -> Chars # unwords :: ListLike full Chars => full -> Chars # show :: Show a => a -> Chars # fromStringLike :: StringLike s' => Chars -> s' # fromText :: Text -> Chars # fromLazyText :: Text -> Chars #
StringLike Text # |
Instance details Defined in Data.ListLike.Text.Text Methods toString :: Text -> String # lines :: ListLike full Text => Text -> full # words :: ListLike full Text => Text -> full # unlines :: ListLike full Text => full -> Text # unwords :: ListLike full Text => full -> Text # show :: Show a => a -> Text # fromStringLike :: StringLike s' => Text -> s' # fromText :: Text -> Text # fromLazyText :: Text -> Text #
StringLike Builder # |
Instance details Defined in Data.ListLike.Text.Builder Methods toString :: Builder -> String # lines :: ListLike full Builder => Builder -> full # words :: ListLike full Builder => Builder -> full # unlines :: ListLike full Builder => full -> Builder # unwords :: ListLike full Builder => full -> Builder # show :: Show a => a -> Builder # fromStringLike :: StringLike s' => Builder -> s' # fromText :: Text -> Builder # fromLazyText :: Text -> Builder #
StringLike Text # |
Instance details Defined in Data.ListLike.Text.TextLazy Methods toString :: Text -> String # lines :: ListLike full Text => Text -> full # words :: ListLike full Text => Text -> full # unlines :: ListLike full Text => full -> Text # unwords :: ListLike full Text => full -> Text # show :: Show a => a -> Text # fromStringLike :: StringLike s' => Text -> s' # fromText :: Text -> Text # fromLazyText :: Text -> Text #
StringLike String # |
Instance details Defined in Data.ListLike.Instances Methods toString :: String -> String # lines :: ListLike full String => String -> full # words :: ListLike full String => String -> full # unlines :: ListLike full String => full -> String # unwords :: ListLike full String => full -> String # show :: Show a => a -> String # fromStringLike :: StringLike s' => String -> s' # fromText :: Text -> String # fromLazyText :: Text -> String #
StringLike (Seq Char) # |
Instance details Defined in Data.ListLike.Instances Methods toString :: Seq Char -> String # lines :: ListLike full (Seq Char) => Seq Char -> full # words :: ListLike full (Seq Char) => Seq Char -> full # unlines :: ListLike full (Seq Char) => full -> Seq Char # unwords :: ListLike full (Seq Char) => full -> Seq Char # show :: Show a => a -> Seq Char # fromStringLike :: StringLike s' => Seq Char -> s' # fromText :: Text -> Seq Char # fromLazyText :: Text -> Seq Char #
StringLike (DList Char) # |
Instance details Defined in Data.ListLike.DList Methods toString :: DList Char -> String # lines :: ListLike full (DList Char) => DList Char -> full # words :: ListLike full (DList Char) => DList Char -> full # unlines :: ListLike full (DList Char) => full -> DList Char # unwords :: ListLike full (DList Char) => full -> DList Char # show :: Show a => a -> DList Char # fromStringLike :: StringLike s' => DList Char -> s' # fromText :: Text -> DList Char # fromLazyText :: Text -> DList Char #
StringLike (FMList Char) # |
Instance details Defined in Data.ListLike.FMList Methods toString :: FMList Char -> String # lines :: ListLike full (FMList Char) => FMList Char -> full # words :: ListLike full (FMList Char) => FMList Char -> full # unlines :: ListLike full (FMList Char) => full -> FMList Char # unwords :: ListLike full (FMList Char) => full -> FMList Char # show :: Show a => a -> FMList Char # fromStringLike :: StringLike s' => FMList Char -> s' # fromText :: Text -> FMList Char # fromLazyText :: Text -> FMList Char #
StringLike (UTF8 ByteString) # |
Instance details Defined in Data.ListLike.UTF8 Methods toString :: UTF8 ByteString -> String # lines :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full # words :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full # unlines :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString # unwords :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString # show :: Show a => a -> UTF8 ByteString # fromStringLike :: StringLike s' => UTF8 ByteString -> s' # fromText :: Text -> UTF8 ByteString # fromLazyText :: Text -> UTF8 ByteString #
StringLike (UTF8 ByteString) # |
Instance details Defined in Data.ListLike.UTF8 Methods toString :: UTF8 ByteString -> String # lines :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full # words :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full # unlines :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString # unwords :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString # show :: Show a => a -> UTF8 ByteString # fromStringLike :: StringLike s' => UTF8 ByteString -> s' # fromText :: Text -> UTF8 ByteString # fromLazyText :: Text -> UTF8 ByteString #
StringLike (Vector Char) # |
Instance details Defined in Data.ListLike.Vector.Vector Methods toString :: Vector Char -> String # lines :: ListLike full (Vector Char) => Vector Char -> full # words :: ListLike full (Vector Char) => Vector Char -> full # unlines :: ListLike full (Vector Char) => full -> Vector Char # unwords :: ListLike full (Vector Char) => full -> Vector Char # show :: Show a => a -> Vector Char # fromStringLike :: StringLike s' => Vector Char -> s' # fromText :: Text -> Vector Char # fromLazyText :: Text -> Vector Char #
StringLike (Vector Char) # |
Instance details Defined in Data.ListLike.Vector.Storable Methods toString :: Vector Char -> String # lines :: ListLike full (Vector Char) => Vector Char -> full # words :: ListLike full (Vector Char) => Vector Char -> full # unlines :: ListLike full (Vector Char) => full -> Vector Char # unwords :: ListLike full (Vector Char) => full -> Vector Char # show :: Show a => a -> Vector Char # fromStringLike :: StringLike s' => Vector Char -> s' # fromText :: Text -> Vector Char # fromLazyText :: Text -> Vector Char #
StringLike (Vector Char) # |
Instance details Defined in Data.ListLike.Vector.Unboxed Methods toString :: Vector Char -> String # lines :: ListLike full (Vector Char) => Vector Char -> full # words :: ListLike full (Vector Char) => Vector Char -> full # unlines :: ListLike full (Vector Char) => full -> Vector Char # unwords :: ListLike full (Vector Char) => full -> Vector Char # show :: Show a => a -> Vector Char # fromStringLike :: StringLike s' => Vector Char -> s' # fromText :: Text -> Vector Char # fromLazyText :: Text -> Vector Char #
(Eq (v Char), Vector v Char) => StringLike (v Char) # |
Instance details Defined in Data.ListLike.Vector.Generic Methods toString :: v Char -> String # lines :: ListLike full (v Char) => v Char -> full # words :: ListLike full (v Char) => v Char -> full # unlines :: ListLike full (v Char) => full -> v Char # unwords :: ListLike full (v Char) => full -> v Char # show :: Show a => a -> v Char # fromStringLike :: StringLike s' => v Char -> s' # fromText :: Text -> v Char # fromLazyText :: Text -> v Char #
(Integral i, Ix i) => StringLike (Array i Char) # |
Instance details Defined in Data.ListLike.Instances Methods toString :: Array i Char -> String # lines :: ListLike full (Array i Char) => Array i Char -> full # words :: ListLike full (Array i Char) => Array i Char -> full # unlines :: ListLike full (Array i Char) => full -> Array i Char # unwords :: ListLike full (Array i Char) => full -> Array i Char # show :: Show a => a -> Array i Char # fromStringLike :: StringLike s' => Array i Char -> s' # fromText :: Text -> Array i Char # fromLazyText :: Text -> Array i Char #

fromString :: IsString a => String -> a #