Copyright | Copyright (C) 2007 John Goerzen |
---|---|
License | BSD3 |
Maintainer | David Fox <dsf@seereason.com>, Andreas Abel |
Stability | stable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 :: StringLike Text => Text -> s
- fromLazyText :: StringLike Text => Text -> s
- fromString :: IsString a => String -> a
Documentation
class IsString s => StringLike s where Source #
An extension to ListLike
for those data types that are similar
to a String
. Minimal complete definition is toString
and
fromString
.
toString :: s -> String Source #
Converts the structure to a String
lines :: ListLike full s => s -> full Source #
Breaks a string into a list of strings
words :: ListLike full s => s -> full Source #
Breaks a string into a list of words
unlines :: ListLike full s => full -> s Source #
Joins lines
unwords :: ListLike full s => full -> s Source #
Joins words
show :: Show a => a -> s Source #
Generalize the Show
method t return any StringLike
.
fromStringLike :: StringLike s' => s -> s' Source #
Deprecated: Use fromString . toString or something more efficient using local knowledge
fromText :: StringLike Text => Text -> s Source #
Override this to avoid extra String
conversions.
fromLazyText :: StringLike Text => Text -> s Source #
Override this to avoid extra String
conversions.
Instances
StringLike CharString Source # | |
Defined in Data.ListLike.CharString toString :: CharString -> String Source # lines :: ListLike full CharString => CharString -> full Source # words :: ListLike full CharString => CharString -> full Source # unlines :: ListLike full CharString => full -> CharString Source # unwords :: ListLike full CharString => full -> CharString Source # show :: Show a => a -> CharString Source # fromStringLike :: StringLike s' => CharString -> s' Source # fromText :: Text -> CharString Source # fromLazyText :: Text -> CharString Source # | |
StringLike CharStringLazy Source # | |
Defined in Data.ListLike.CharString toString :: CharStringLazy -> String Source # lines :: ListLike full CharStringLazy => CharStringLazy -> full Source # words :: ListLike full CharStringLazy => CharStringLazy -> full Source # unlines :: ListLike full CharStringLazy => full -> CharStringLazy Source # unwords :: ListLike full CharStringLazy => full -> CharStringLazy Source # show :: Show a => a -> CharStringLazy Source # fromStringLike :: StringLike s' => CharStringLazy -> s' Source # fromText :: Text -> CharStringLazy Source # fromLazyText :: Text -> CharStringLazy Source # | |
StringLike Chars Source # | |
Defined in Data.ListLike.Chars toString :: Chars -> String Source # lines :: ListLike full Chars => Chars -> full Source # words :: ListLike full Chars => Chars -> full Source # unlines :: ListLike full Chars => full -> Chars Source # unwords :: ListLike full Chars => full -> Chars Source # show :: Show a => a -> Chars Source # fromStringLike :: StringLike s' => Chars -> s' Source # fromText :: Text -> Chars Source # fromLazyText :: Text -> Chars Source # | |
StringLike Text Source # | |
Defined in Data.ListLike.Text.Text toString :: Text -> String Source # lines :: ListLike full Text => Text -> full Source # words :: ListLike full Text => Text -> full Source # unlines :: ListLike full Text => full -> Text Source # unwords :: ListLike full Text => full -> Text Source # show :: Show a => a -> Text Source # fromStringLike :: StringLike s' => Text -> s' Source # fromText :: Text -> Text Source # fromLazyText :: Text0 -> Text Source # | |
StringLike Builder Source # | |
Defined in Data.ListLike.Text.Builder toString :: Builder -> String Source # lines :: ListLike full Builder => Builder -> full Source # words :: ListLike full Builder => Builder -> full Source # unlines :: ListLike full Builder => full -> Builder Source # unwords :: ListLike full Builder => full -> Builder Source # show :: Show a => a -> Builder Source # fromStringLike :: StringLike s' => Builder -> s' Source # fromText :: Text -> Builder Source # fromLazyText :: Text -> Builder Source # | |
StringLike Text Source # | |
Defined in Data.ListLike.Text.TextLazy toString :: Text -> String Source # lines :: ListLike full Text => Text -> full Source # words :: ListLike full Text => Text -> full Source # unlines :: ListLike full Text => full -> Text Source # unwords :: ListLike full Text => full -> Text Source # show :: Show a => a -> Text Source # fromStringLike :: StringLike s' => Text -> s' Source # fromText :: Text0 -> Text Source # fromLazyText :: Text -> Text Source # | |
StringLike String Source # | |
Defined in Data.ListLike.Instances toString :: String -> String Source # lines :: ListLike full String => String -> full Source # words :: ListLike full String => String -> full Source # unlines :: ListLike full String => full -> String Source # unwords :: ListLike full String => full -> String Source # show :: Show a => a -> String Source # fromStringLike :: StringLike s' => String -> s' Source # fromText :: Text -> String Source # fromLazyText :: Text -> String Source # | |
StringLike (Seq Char) Source # | |
Defined in Data.ListLike.Instances toString :: Seq Char -> String Source # lines :: ListLike full (Seq Char) => Seq Char -> full Source # words :: ListLike full (Seq Char) => Seq Char -> full Source # unlines :: ListLike full (Seq Char) => full -> Seq Char Source # unwords :: ListLike full (Seq Char) => full -> Seq Char Source # show :: Show a => a -> Seq Char Source # fromStringLike :: StringLike s' => Seq Char -> s' Source # fromText :: Text -> Seq Char Source # fromLazyText :: Text -> Seq Char Source # | |
StringLike (DList Char) Source # | |
Defined in Data.ListLike.DList toString :: DList Char -> String Source # lines :: ListLike full (DList Char) => DList Char -> full Source # words :: ListLike full (DList Char) => DList Char -> full Source # unlines :: ListLike full (DList Char) => full -> DList Char Source # unwords :: ListLike full (DList Char) => full -> DList Char Source # show :: Show a => a -> DList Char Source # fromStringLike :: StringLike s' => DList Char -> s' Source # fromText :: Text -> DList Char Source # fromLazyText :: Text -> DList Char Source # | |
StringLike (FMList Char) Source # | |
Defined in Data.ListLike.FMList toString :: FMList Char -> String Source # lines :: ListLike full (FMList Char) => FMList Char -> full Source # words :: ListLike full (FMList Char) => FMList Char -> full Source # unlines :: ListLike full (FMList Char) => full -> FMList Char Source # unwords :: ListLike full (FMList Char) => full -> FMList Char Source # show :: Show a => a -> FMList Char Source # fromStringLike :: StringLike s' => FMList Char -> s' Source # fromText :: Text -> FMList Char Source # fromLazyText :: Text -> FMList Char Source # | |
StringLike (UTF8 ByteString) Source # | |
Defined in Data.ListLike.UTF8 toString :: UTF8 ByteString -> String Source # lines :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full Source # words :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full Source # unlines :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString Source # unwords :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString Source # show :: Show a => a -> UTF8 ByteString Source # fromStringLike :: StringLike s' => UTF8 ByteString -> s' Source # fromText :: Text -> UTF8 ByteString Source # fromLazyText :: Text -> UTF8 ByteString Source # | |
StringLike (UTF8 ByteString) Source # | |
Defined in Data.ListLike.UTF8 toString :: UTF8 ByteString -> String Source # lines :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full Source # words :: ListLike full (UTF8 ByteString) => UTF8 ByteString -> full Source # unlines :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString Source # unwords :: ListLike full (UTF8 ByteString) => full -> UTF8 ByteString Source # show :: Show a => a -> UTF8 ByteString Source # fromStringLike :: StringLike s' => UTF8 ByteString -> s' Source # fromText :: Text -> UTF8 ByteString Source # fromLazyText :: Text -> UTF8 ByteString Source # | |
StringLike (Vector Char) Source # | |
Defined in Data.ListLike.Vector.Vector toString :: Vector Char -> String Source # lines :: ListLike full (Vector Char) => Vector Char -> full Source # words :: ListLike full (Vector Char) => Vector Char -> full Source # unlines :: ListLike full (Vector Char) => full -> Vector Char Source # unwords :: ListLike full (Vector Char) => full -> Vector Char Source # show :: Show a => a -> Vector Char Source # fromStringLike :: StringLike s' => Vector Char -> s' Source # fromText :: Text -> Vector Char Source # fromLazyText :: Text -> Vector Char Source # | |
StringLike (Vector Char) Source # | |
Defined in Data.ListLike.Vector.Storable toString :: Vector Char -> String Source # lines :: ListLike full (Vector Char) => Vector Char -> full Source # words :: ListLike full (Vector Char) => Vector Char -> full Source # unlines :: ListLike full (Vector Char) => full -> Vector Char Source # unwords :: ListLike full (Vector Char) => full -> Vector Char Source # show :: Show a => a -> Vector Char Source # fromStringLike :: StringLike s' => Vector Char -> s' Source # fromText :: Text -> Vector Char Source # fromLazyText :: Text -> Vector Char Source # | |
StringLike (Vector Char) Source # | |
Defined in Data.ListLike.Vector.Unboxed toString :: Vector Char -> String Source # lines :: ListLike full (Vector Char) => Vector Char -> full Source # words :: ListLike full (Vector Char) => Vector Char -> full Source # unlines :: ListLike full (Vector Char) => full -> Vector Char Source # unwords :: ListLike full (Vector Char) => full -> Vector Char Source # show :: Show a => a -> Vector Char Source # fromStringLike :: StringLike s' => Vector Char -> s' Source # fromText :: Text -> Vector Char Source # fromLazyText :: Text -> Vector Char Source # | |
(Eq (v Char), Vector v Char) => StringLike (v Char) Source # | |
Defined in Data.ListLike.Vector.Generic toString :: v Char -> String Source # lines :: ListLike full (v Char) => v Char -> full Source # words :: ListLike full (v Char) => v Char -> full Source # unlines :: ListLike full (v Char) => full -> v Char Source # unwords :: ListLike full (v Char) => full -> v Char Source # show :: Show a => a -> v Char Source # fromStringLike :: StringLike s' => v Char -> s' Source # fromText :: Text -> v Char Source # fromLazyText :: Text -> v Char Source # | |
(Integral i, Ix i) => StringLike (Array i Char) Source # | |
Defined in Data.ListLike.Instances toString :: Array i Char -> String Source # lines :: ListLike full (Array i Char) => Array i Char -> full Source # words :: ListLike full (Array i Char) => Array i Char -> full Source # unlines :: ListLike full (Array i Char) => full -> Array i Char Source # unwords :: ListLike full (Array i Char) => full -> Array i Char Source # show :: Show a => a -> Array i Char Source # fromStringLike :: StringLike s' => Array i Char -> s' Source # fromText :: Text -> Array i Char Source # fromLazyText :: Text -> Array i Char Source # |
fromString :: IsString a => String -> a #