Data.ListLike.String

ListLike-3.1.5: Generic support for list-like structures

Portability | portable
Stability | provisional
Maintainer | John Lato <jwlato@gmail.com>
Safe Haskell | Safe-Infered

Data.ListLike.String

Description

String-like functions

Written by John Goerzen, jgoerzen@complete.org

Synopsis

- class StringLike s where
  - toString :: s -> String
  - fromString :: String -> s
  - lines :: ListLike full s => s -> full
  - words :: ListLike full s => s -> full
  - unlines :: ListLike full s => full -> s
  - unwords :: ListLike full s => full -> s

# Documentation

class StringLike s where

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

Methods

toString :: s -> String

Converts the structure to a `String`

fromString :: String -> s

Converts a `String` to a list

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

Instances

StringLike String |
StringLike ByteString |
StringLike ByteString |
StringLike CharStringLazy |
StringLike CharString |
StringLike (Seq Char) |
(Integral i, Ix i) => StringLike (Array i Char) |