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
fromString :: IsString a => String -> a #