Data.Monoid.Textual

monoid-subclasses-0.4.3.1: Subclasses of Monoid

Safe Haskell | Trustworthy
Language | Haskell2010

Data.Monoid.Textual

Contents

- Orphan instances

Description

This module defines the `TextualMonoid` class and several of its instances.

Synopsis

- class (IsString t, LeftReductiveMonoid t, LeftGCDMonoid t, FactorialMonoid t) => TextualMonoid t where

# Documentation

class (IsString t, LeftReductiveMonoid t, LeftGCDMonoid t, FactorialMonoid t) => TextualMonoid t where #

The `TextualMonoid` class is an extension of `FactorialMonoid` specialized for monoids that can contain characters. Its methods are generally equivalent to their namesake functions from Data.List and Data.Text, and they satisfy the following laws:

    unfoldr splitCharacterPrefix . fromString == id
    splitCharacterPrefix . primePrefix == fmap (\(c, t)-> (c, mempty)) . splitCharacterPrefix

    map f . fromString == fromString . List.map f
    concatMap (fromString . f) . fromString == fromString . List.concatMap f

    foldl  ft fc a . fromString == List.foldl  fc a
    foldr  ft fc a . fromString == List.foldr  fc a
    foldl' ft fc a . fromString == List.foldl' fc a

    scanl f c . fromString == fromString . List.scanl f c
    scanr f c . fromString == fromString . List.scanr f c
    mapAccumL f a . fromString == fmap fromString . List.mapAccumL f a
    mapAccumL f a . fromString == fmap fromString . List.mapAccumL f a

    takeWhile pt pc . fromString == fromString . takeWhile pc
    dropWhile pt pc . fromString == fromString . dropWhile pc

    mconcat . intersperse (singleton c) . split (== c) == id
    find p . fromString == List.find p
    elem c . fromString == List.elem c

A `TextualMonoid` may contain non-character data insterspersed between its characters. Every class method that returns a modified `TextualMonoid` instance generally preserves this non-character data. Methods like `foldr` can access both the non-character and character data and expect two arguments for the two purposes. For each of these methods there is also a simplified version with underscore in name (like `foldr_`) that ignores the non-character data.

All of the following expressions are identities:

    map id
    concatMap singleton
    foldl  (<>) (\a c-> a <> singleton c) mempty
    foldr  (<>) ((<>) . singleton) mempty
    foldl' (<>) (\a c-> a <> singleton c) mempty
    scanl1 (const id)
    scanr1 const
    uncurry (mapAccumL (,))
    uncurry (mapAccumR (,))
    takeWhile (const True) (const True)
    dropWhile (const False) (const False)
    toString undefined . fromString

Minimal complete definition

splitCharacterPrefix

Methods

fromText :: Text -> t #

Contructs a new data type instance Like `fromString`, but from a `Text` input instead of `String`.

    fromText == fromString . Text.unpack

singleton :: Char -> t #

Creates a prime monoid containing a single character.

    singleton c == fromString [c]

splitCharacterPrefix :: t -> Maybe (Char, t) #

Specialized version of `splitPrimePrefix`. Every prime factor of a `Textual` monoid must consist of a single character or no character at all.

characterPrefix :: t -> Maybe Char #

Extracts a single character that prefixes the monoid, if the monoid begins with a character. Otherwise returns `Nothing`.

    characterPrefix == fmap fst . splitCharacterPrefix

map :: (Char -> Char) -> t -> t #

Equivalent to `map` from Data.List with a `Char -> Char` function. Preserves all non-character data.

    map f == concatMap (singleton . f)

concatMap :: (Char -> t) -> t -> t #

Equivalent to `concatMap` from Data.List with a `Char -> String` function. Preserves all non-character data.

toString :: (t -> String) -> t -> String #

Returns the list of characters the monoid contains, after having the argument function convert all its non-character factors into characters.

any :: (Char -> Bool) -> t -> Bool #

Equivalent to `any` from Data.List. Ignores all non-character data.

all :: (Char -> Bool) -> t -> Bool #

Equivalent to `all` from Data.List. Ignores all non-character data.

foldl :: (a -> t -> a) -> (a -> Char -> a) -> a -> t -> a #

The first argument folds over the non-character prime factors, the second over characters. Otherwise equivalent to `foldl` from Data.List.

foldl' :: (a -> t -> a) -> (a -> Char -> a) -> a -> t -> a #

Strict version of `foldl`.

foldr :: (t -> a -> a) -> (Char -> a -> a) -> a -> t -> a #

The first argument folds over the non-character prime factors, the second over characters. Otherwise equivalent to 'List.foldl\'' from Data.List.

scanl :: (Char -> Char -> Char) -> Char -> t -> t #

Equivalent to `scanl` from Data.List when applied to a `String`, but preserves all non-character data.

scanl1 :: (Char -> Char -> Char) -> t -> t #

Equivalent to `scanl1` from Data.List when applied to a `String`, but preserves all non-character data.

    scanl f c == scanl1 f . (singleton c <>)

scanr :: (Char -> Char -> Char) -> Char -> t -> t #

Equivalent to `scanr` from Data.List when applied to a `String`, but preserves all non-character data.

scanr1 :: (Char -> Char -> Char) -> t -> t #

Equivalent to `scanr1` from Data.List when applied to a `String`, but preserves all non-character data.

    scanr f c == scanr1 f . (<> singleton c)

mapAccumL :: (a -> Char -> (a, Char)) -> a -> t -> (a, t) #

Equivalent to `mapAccumL` from Data.List when applied to a `String`, but preserves all non-character data.

mapAccumR :: (a -> Char -> (a, Char)) -> a -> t -> (a, t) #

Equivalent to `mapAccumR` from Data.List when applied to a `String`, but preserves all non-character data.

takeWhile :: (t -> Bool) -> (Char -> Bool) -> t -> t #

The first predicate tests the non-character data, the second one the characters. Otherwise equivalent to `takeWhile` from Data.List when applied to a `String`.

dropWhile :: (t -> Bool) -> (Char -> Bool) -> t -> t #

The first predicate tests the non-character data, the second one the characters. Otherwise equivalent to `dropWhile` from Data.List when applied to a `String`.

break :: (t -> Bool) -> (Char -> Bool) -> t -> (t, t) #

'break pt pc' is equivalent to |span (not . pt) (not . pc)|.

span :: (t -> Bool) -> (Char -> Bool) -> t -> (t, t) #

'span pt pc t' is equivalent to |(takeWhile pt pc t, dropWhile pt pc t)|.

spanMaybe :: s -> (s -> t -> Maybe s) -> (s -> Char -> Maybe s) -> t -> (t, t, s) #

A stateful variant of `span`, threading the result of the test function as long as it returns `Just`.

spanMaybe' :: s -> (s -> t -> Maybe s) -> (s -> Char -> Maybe s) -> t -> (t, t, s) #

Strict version of `spanMaybe`.

split :: (Char -> Bool) -> t -> [t] #

Splits the monoid into components delimited by character separators satisfying the given predicate. The characters satisfying the predicate are not a part of the result.

    split p == Factorial.split (maybe False p . characterPrefix)

find :: (Char -> Bool) -> t -> Maybe Char #

Like `find` from Data.List when applied to a `String`. Ignores non-character data.

elem :: Char -> t -> Bool #

Like `elem` from Data.List when applied to a `String`. Ignores non-character data.

foldl_ :: (a -> Char -> a) -> a -> t -> a #

    foldl_ = foldl const

foldl_' :: (a -> Char -> a) -> a -> t -> a #

foldr_ :: (Char -> a -> a) -> a -> t -> a #

takeWhile_ :: Bool -> (Char -> Bool) -> t -> t #

    takeWhile_ = takeWhile . const

dropWhile_ :: Bool -> (Char -> Bool) -> t -> t #

    dropWhile_ = dropWhile . const

break_ :: Bool -> (Char -> Bool) -> t -> (t, t) #

    break_ = break . const

span_ :: Bool -> (Char -> Bool) -> t -> (t, t) #

    span_ = span . const

spanMaybe_ :: s -> (s -> Char -> Maybe s) -> t -> (t, t, s) #

    spanMaybe_ s = spanMaybe s (const . Just)

spanMaybe_' :: s -> (s -> Char -> Maybe s) -> t -> (t, t, s) #

Instances

TextualMonoid String # |
Methods fromText :: Text -> String # singleton :: Char -> String # splitCharacterPrefix :: String -> Maybe (Char, String) # characterPrefix :: String -> Maybe Char # map :: (Char -> Char) -> String -> String # concatMap :: (Char -> String) -> String -> String # toString :: (String -> String) -> String -> String # any :: (Char -> Bool) -> String -> Bool # all :: (Char -> Bool) -> String -> Bool # foldl :: (a -> String -> a) -> (a -> Char -> a) -> a -> String -> a # foldl' :: (a -> String -> a) -> (a -> Char -> a) -> a -> String -> a # foldr :: (String -> a -> a) -> (Char -> a -> a) -> a -> String -> a # scanl :: (Char -> Char -> Char) -> Char -> String -> String # scanl1 :: (Char -> Char -> Char) -> String -> String # scanr :: (Char -> Char -> Char) -> Char -> String -> String # scanr1 :: (Char -> Char -> Char) -> String -> String # mapAccumL :: (a -> Char -> (a, Char)) -> a -> String -> (a, String) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> String -> (a, String) # takeWhile :: (String -> Bool) -> (Char -> Bool) -> String -> String # dropWhile :: (String -> Bool) -> (Char -> Bool) -> String -> String # break :: (String -> Bool) -> (Char -> Bool) -> String -> (String, String) # span :: (String -> Bool) -> (Char -> Bool) -> String -> (String, String) # spanMaybe :: s -> (s -> String -> Maybe s) -> (s -> Char -> Maybe s) -> String -> (String, String, s) # spanMaybe' :: s -> (s -> String -> Maybe s) -> (s -> Char -> Maybe s) -> String -> (String, String, s) # split :: (Char -> Bool) -> String -> [String] # find :: (Char -> Bool) -> String -> Maybe Char # elem :: Char -> String -> Bool # foldl_ :: (a -> Char -> a) -> a -> String -> a # foldl_' :: (a -> Char -> a) -> a -> String -> a # foldr_ :: (Char -> a -> a) -> a -> String -> a # takeWhile_ :: Bool -> (Char -> Bool) -> String -> String # dropWhile_ :: Bool -> (Char -> Bool) -> String -> String # break_ :: Bool -> (Char -> Bool) -> String -> (String, String) # span_ :: Bool -> (Char -> Bool) -> String -> (String, String) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> String -> (String, String, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> String -> (String, String, s) #
TextualMonoid Text # |
Methods fromText :: Text -> Text # singleton :: Char -> Text # splitCharacterPrefix :: Text -> Maybe (Char, Text) # characterPrefix :: Text -> Maybe Char # map :: (Char -> Char) -> Text -> Text # concatMap :: (Char -> Text) -> Text -> Text # toString :: (Text -> String) -> Text -> String # any :: (Char -> Bool) -> Text -> Bool # all :: (Char -> Bool) -> Text -> Bool # foldl :: (a -> Text -> a) -> (a -> Char -> a) -> a -> Text -> a # foldl' :: (a -> Text -> a) -> (a -> Char -> a) -> a -> Text -> a # foldr :: (Text -> a -> a) -> (Char -> a -> a) -> a -> Text -> a # scanl :: (Char -> Char -> Char) -> Char -> Text -> Text # scanl1 :: (Char -> Char -> Char) -> Text -> Text # scanr :: (Char -> Char -> Char) -> Char -> Text -> Text # scanr1 :: (Char -> Char -> Char) -> Text -> Text # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text) # takeWhile :: (Text -> Bool) -> (Char -> Bool) -> Text -> Text # dropWhile :: (Text -> Bool) -> (Char -> Bool) -> Text -> Text # break :: (Text -> Bool) -> (Char -> Bool) -> Text -> (Text, Text) # span :: (Text -> Bool) -> (Char -> Bool) -> Text -> (Text, Text) # spanMaybe :: s -> (s -> Text -> Maybe s) -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) # spanMaybe' :: s -> (s -> Text -> Maybe s) -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) # split :: (Char -> Bool) -> Text -> [Text] # find :: (Char -> Bool) -> Text -> Maybe Char # elem :: Char -> Text -> Bool # foldl_ :: (a -> Char -> a) -> a -> Text -> a # foldl_' :: (a -> Char -> a) -> a -> Text -> a # foldr_ :: (Char -> a -> a) -> a -> Text -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Text -> Text # dropWhile_ :: Bool -> (Char -> Bool) -> Text -> Text # break_ :: Bool -> (Char -> Bool) -> Text -> (Text, Text) # span_ :: Bool -> (Char -> Bool) -> Text -> (Text, Text) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) #
TextualMonoid Text # |
Methods fromText :: Text -> Text # singleton :: Char -> Text # splitCharacterPrefix :: Text -> Maybe (Char, Text) # characterPrefix :: Text -> Maybe Char # map :: (Char -> Char) -> Text -> Text # concatMap :: (Char -> Text) -> Text -> Text # toString :: (Text -> String) -> Text -> String # any :: (Char -> Bool) -> Text -> Bool # all :: (Char -> Bool) -> Text -> Bool # foldl :: (a -> Text -> a) -> (a -> Char -> a) -> a -> Text -> a # foldl' :: (a -> Text -> a) -> (a -> Char -> a) -> a -> Text -> a # foldr :: (Text -> a -> a) -> (Char -> a -> a) -> a -> Text -> a # scanl :: (Char -> Char -> Char) -> Char -> Text -> Text # scanl1 :: (Char -> Char -> Char) -> Text -> Text # scanr :: (Char -> Char -> Char) -> Char -> Text -> Text # scanr1 :: (Char -> Char -> Char) -> Text -> Text # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text) # takeWhile :: (Text -> Bool) -> (Char -> Bool) -> Text -> Text # dropWhile :: (Text -> Bool) -> (Char -> Bool) -> Text -> Text # break :: (Text -> Bool) -> (Char -> Bool) -> Text -> (Text, Text) # span :: (Text -> Bool) -> (Char -> Bool) -> Text -> (Text, Text) # spanMaybe :: s -> (s -> Text -> Maybe s) -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) # spanMaybe' :: s -> (s -> Text -> Maybe s) -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) # split :: (Char -> Bool) -> Text -> [Text] # find :: (Char -> Bool) -> Text -> Maybe Char # elem :: Char -> Text -> Bool # foldl_ :: (a -> Char -> a) -> a -> Text -> a # foldl_' :: (a -> Char -> a) -> a -> Text -> a # foldr_ :: (Char -> a -> a) -> a -> Text -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Text -> Text # dropWhile_ :: Bool -> (Char -> Bool) -> Text -> Text # break_ :: Bool -> (Char -> Bool) -> Text -> (Text, Text) # span_ :: Bool -> (Char -> Bool) -> Text -> (Text, Text) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Text -> (Text, Text, s) #
TextualMonoid ByteStringUTF8 # |
Methods fromText :: Text -> ByteStringUTF8 # singleton :: Char -> ByteStringUTF8 # splitCharacterPrefix :: ByteStringUTF8 -> Maybe (Char, ByteStringUTF8) # characterPrefix :: ByteStringUTF8 -> Maybe Char # map :: (Char -> Char) -> ByteStringUTF8 -> ByteStringUTF8 # concatMap :: (Char -> ByteStringUTF8) -> ByteStringUTF8 -> ByteStringUTF8 # toString :: (ByteStringUTF8 -> String) -> ByteStringUTF8 -> String # any :: (Char -> Bool) -> ByteStringUTF8 -> Bool # all :: (Char -> Bool) -> ByteStringUTF8 -> Bool # foldl :: (a -> ByteStringUTF8 -> a) -> (a -> Char -> a) -> a -> ByteStringUTF8 -> a # foldl' :: (a -> ByteStringUTF8 -> a) -> (a -> Char -> a) -> a -> ByteStringUTF8 -> a # foldr :: (ByteStringUTF8 -> a -> a) -> (Char -> a -> a) -> a -> ByteStringUTF8 -> a # scanl :: (Char -> Char -> Char) -> Char -> ByteStringUTF8 -> ByteStringUTF8 # scanl1 :: (Char -> Char -> Char) -> ByteStringUTF8 -> ByteStringUTF8 # scanr :: (Char -> Char -> Char) -> Char -> ByteStringUTF8 -> ByteStringUTF8 # scanr1 :: (Char -> Char -> Char) -> ByteStringUTF8 -> ByteStringUTF8 # mapAccumL :: (a -> Char -> (a, Char)) -> a -> ByteStringUTF8 -> (a, ByteStringUTF8) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> ByteStringUTF8 -> (a, ByteStringUTF8) # takeWhile :: (ByteStringUTF8 -> Bool) -> (Char -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 # dropWhile :: (ByteStringUTF8 -> Bool) -> (Char -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 # break :: (ByteStringUTF8 -> Bool) -> (Char -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) # span :: (ByteStringUTF8 -> Bool) -> (Char -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) # spanMaybe :: s -> (s -> ByteStringUTF8 -> Maybe s) -> (s -> Char -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) # spanMaybe' :: s -> (s -> ByteStringUTF8 -> Maybe s) -> (s -> Char -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) # split :: (Char -> Bool) -> ByteStringUTF8 -> [ByteStringUTF8] # find :: (Char -> Bool) -> ByteStringUTF8 -> Maybe Char # elem :: Char -> ByteStringUTF8 -> Bool # foldl_ :: (a -> Char -> a) -> a -> ByteStringUTF8 -> a # foldl_' :: (a -> Char -> a) -> a -> ByteStringUTF8 -> a # foldr_ :: (Char -> a -> a) -> a -> ByteStringUTF8 -> a # takeWhile_ :: Bool -> (Char -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 # dropWhile_ :: Bool -> (Char -> Bool) -> ByteStringUTF8 -> ByteStringUTF8 # break_ :: Bool -> (Char -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) # span_ :: Bool -> (Char -> Bool) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> ByteStringUTF8 -> (ByteStringUTF8, ByteStringUTF8, s) #
TextualMonoid (Seq Char) # |
Methods fromText :: Text -> Seq Char # singleton :: Char -> Seq Char # splitCharacterPrefix :: Seq Char -> Maybe (Char, Seq Char) # characterPrefix :: Seq Char -> Maybe Char # map :: (Char -> Char) -> Seq Char -> Seq Char # concatMap :: (Char -> Seq Char) -> Seq Char -> Seq Char # toString :: (Seq Char -> String) -> Seq Char -> String # any :: (Char -> Bool) -> Seq Char -> Bool # all :: (Char -> Bool) -> Seq Char -> Bool # foldl :: (a -> Seq Char -> a) -> (a -> Char -> a) -> a -> Seq Char -> a # foldl' :: (a -> Seq Char -> a) -> (a -> Char -> a) -> a -> Seq Char -> a # foldr :: (Seq Char -> a -> a) -> (Char -> a -> a) -> a -> Seq Char -> a # scanl :: (Char -> Char -> Char) -> Char -> Seq Char -> Seq Char # scanl1 :: (Char -> Char -> Char) -> Seq Char -> Seq Char # scanr :: (Char -> Char -> Char) -> Char -> Seq Char -> Seq Char # scanr1 :: (Char -> Char -> Char) -> Seq Char -> Seq Char # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Seq Char -> (a, Seq Char) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Seq Char -> (a, Seq Char) # takeWhile :: (Seq Char -> Bool) -> (Char -> Bool) -> Seq Char -> Seq Char # dropWhile :: (Seq Char -> Bool) -> (Char -> Bool) -> Seq Char -> Seq Char # break :: (Seq Char -> Bool) -> (Char -> Bool) -> Seq Char -> (Seq Char, Seq Char) # span :: (Seq Char -> Bool) -> (Char -> Bool) -> Seq Char -> (Seq Char, Seq Char) # spanMaybe :: s -> (s -> Seq Char -> Maybe s) -> (s -> Char -> Maybe s) -> Seq Char -> (Seq Char, Seq Char, s) # spanMaybe' :: s -> (s -> Seq Char -> Maybe s) -> (s -> Char -> Maybe s) -> Seq Char -> (Seq Char, Seq Char, s) # split :: (Char -> Bool) -> Seq Char -> [Seq Char] # find :: (Char -> Bool) -> Seq Char -> Maybe Char # elem :: Char -> Seq Char -> Bool # foldl_ :: (a -> Char -> a) -> a -> Seq Char -> a # foldl_' :: (a -> Char -> a) -> a -> Seq Char -> a # foldr_ :: (Char -> a -> a) -> a -> Seq Char -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Seq Char -> Seq Char # dropWhile_ :: Bool -> (Char -> Bool) -> Seq Char -> Seq Char # break_ :: Bool -> (Char -> Bool) -> Seq Char -> (Seq Char, Seq Char) # span_ :: Bool -> (Char -> Bool) -> Seq Char -> (Seq Char, Seq Char) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Seq Char -> (Seq Char, Seq Char, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Seq Char -> (Seq Char, Seq Char, s) #
TextualMonoid (Vector Char) # |
Methods fromText :: Text -> Vector Char # singleton :: Char -> Vector Char # splitCharacterPrefix :: Vector Char -> Maybe (Char, Vector Char) # characterPrefix :: Vector Char -> Maybe Char # map :: (Char -> Char) -> Vector Char -> Vector Char # concatMap :: (Char -> Vector Char) -> Vector Char -> Vector Char # toString :: (Vector Char -> String) -> Vector Char -> String # any :: (Char -> Bool) -> Vector Char -> Bool # all :: (Char -> Bool) -> Vector Char -> Bool # foldl :: (a -> Vector Char -> a) -> (a -> Char -> a) -> a -> Vector Char -> a # foldl' :: (a -> Vector Char -> a) -> (a -> Char -> a) -> a -> Vector Char -> a # foldr :: (Vector Char -> a -> a) -> (Char -> a -> a) -> a -> Vector Char -> a # scanl :: (Char -> Char -> Char) -> Char -> Vector Char -> Vector Char # scanl1 :: (Char -> Char -> Char) -> Vector Char -> Vector Char # scanr :: (Char -> Char -> Char) -> Char -> Vector Char -> Vector Char # scanr1 :: (Char -> Char -> Char) -> Vector Char -> Vector Char # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Vector Char -> (a, Vector Char) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Vector Char -> (a, Vector Char) # takeWhile :: (Vector Char -> Bool) -> (Char -> Bool) -> Vector Char -> Vector Char # dropWhile :: (Vector Char -> Bool) -> (Char -> Bool) -> Vector Char -> Vector Char # break :: (Vector Char -> Bool) -> (Char -> Bool) -> Vector Char -> (Vector Char, Vector Char) # span :: (Vector Char -> Bool) -> (Char -> Bool) -> Vector Char -> (Vector Char, Vector Char) # spanMaybe :: s -> (s -> Vector Char -> Maybe s) -> (s -> Char -> Maybe s) -> Vector Char -> (Vector Char, Vector Char, s) # spanMaybe' :: s -> (s -> Vector Char -> Maybe s) -> (s -> Char -> Maybe s) -> Vector Char -> (Vector Char, Vector Char, s) # split :: (Char -> Bool) -> Vector Char -> [Vector Char] # find :: (Char -> Bool) -> Vector Char -> Maybe Char # elem :: Char -> Vector Char -> Bool # foldl_ :: (a -> Char -> a) -> a -> Vector Char -> a # foldl_' :: (a -> Char -> a) -> a -> Vector Char -> a # foldr_ :: (Char -> a -> a) -> a -> Vector Char -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Vector Char -> Vector Char # dropWhile_ :: Bool -> (Char -> Bool) -> Vector Char -> Vector Char # break_ :: Bool -> (Char -> Bool) -> Vector Char -> (Vector Char, Vector Char) # span_ :: Bool -> (Char -> Bool) -> Vector Char -> (Vector Char, Vector Char) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Vector Char -> (Vector Char, Vector Char, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Vector Char -> (Vector Char, Vector Char, s) #
(Eq a, TextualMonoid a, StableFactorialMonoid a) => TextualMonoid (Concat a) # |
Methods fromText :: Text -> Concat a # singleton :: Char -> Concat a # splitCharacterPrefix :: Concat a -> Maybe (Char, Concat a) # characterPrefix :: Concat a -> Maybe Char # map :: (Char -> Char) -> Concat a -> Concat a # concatMap :: (Char -> Concat a) -> Concat a -> Concat a # toString :: (Concat a -> String) -> Concat a -> String # any :: (Char -> Bool) -> Concat a -> Bool # all :: (Char -> Bool) -> Concat a -> Bool # foldl :: (a -> Concat a -> a) -> (a -> Char -> a) -> a -> Concat a -> a # foldl' :: (a -> Concat a -> a) -> (a -> Char -> a) -> a -> Concat a -> a # foldr :: (Concat a -> a -> a) -> (Char -> a -> a) -> a -> Concat a -> a # scanl :: (Char -> Char -> Char) -> Char -> Concat a -> Concat a # scanl1 :: (Char -> Char -> Char) -> Concat a -> Concat a # scanr :: (Char -> Char -> Char) -> Char -> Concat a -> Concat a # scanr1 :: (Char -> Char -> Char) -> Concat a -> Concat a # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Concat a -> (a, Concat a) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Concat a -> (a, Concat a) # takeWhile :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> Concat a # dropWhile :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> Concat a # break :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # span :: (Concat a -> Bool) -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # spanMaybe :: s -> (s -> Concat a -> Maybe s) -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # spanMaybe' :: s -> (s -> Concat a -> Maybe s) -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # split :: (Char -> Bool) -> Concat a -> [Concat a] # find :: (Char -> Bool) -> Concat a -> Maybe Char # elem :: Char -> Concat a -> Bool # foldl_ :: (a -> Char -> a) -> a -> Concat a -> a # foldl_' :: (a -> Char -> a) -> a -> Concat a -> a # foldr_ :: (Char -> a -> a) -> a -> Concat a -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Concat a -> Concat a # dropWhile_ :: Bool -> (Char -> Bool) -> Concat a -> Concat a # break_ :: Bool -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # span_ :: Bool -> (Char -> Bool) -> Concat a -> (Concat a, Concat a) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Concat a -> (Concat a, Concat a, s) #
(Eq a, TextualMonoid a, StableFactorialMonoid a) => TextualMonoid (Measured a) # |
Methods fromText :: Text -> Measured a # singleton :: Char -> Measured a # splitCharacterPrefix :: Measured a -> Maybe (Char, Measured a) # characterPrefix :: Measured a -> Maybe Char # map :: (Char -> Char) -> Measured a -> Measured a # concatMap :: (Char -> Measured a) -> Measured a -> Measured a # toString :: (Measured a -> String) -> Measured a -> String # any :: (Char -> Bool) -> Measured a -> Bool # all :: (Char -> Bool) -> Measured a -> Bool # foldl :: (a -> Measured a -> a) -> (a -> Char -> a) -> a -> Measured a -> a # foldl' :: (a -> Measured a -> a) -> (a -> Char -> a) -> a -> Measured a -> a # foldr :: (Measured a -> a -> a) -> (Char -> a -> a) -> a -> Measured a -> a # scanl :: (Char -> Char -> Char) -> Char -> Measured a -> Measured a # scanl1 :: (Char -> Char -> Char) -> Measured a -> Measured a # scanr :: (Char -> Char -> Char) -> Char -> Measured a -> Measured a # scanr1 :: (Char -> Char -> Char) -> Measured a -> Measured a # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Measured a -> (a, Measured a) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Measured a -> (a, Measured a) # takeWhile :: (Measured a -> Bool) -> (Char -> Bool) -> Measured a -> Measured a # dropWhile :: (Measured a -> Bool) -> (Char -> Bool) -> Measured a -> Measured a # break :: (Measured a -> Bool) -> (Char -> Bool) -> Measured a -> (Measured a, Measured a) # span :: (Measured a -> Bool) -> (Char -> Bool) -> Measured a -> (Measured a, Measured a) # spanMaybe :: s -> (s -> Measured a -> Maybe s) -> (s -> Char -> Maybe s) -> Measured a -> (Measured a, Measured a, s) # spanMaybe' :: s -> (s -> Measured a -> Maybe s) -> (s -> Char -> Maybe s) -> Measured a -> (Measured a, Measured a, s) # split :: (Char -> Bool) -> Measured a -> [Measured a] # find :: (Char -> Bool) -> Measured a -> Maybe Char # elem :: Char -> Measured a -> Bool # foldl_ :: (a -> Char -> a) -> a -> Measured a -> a # foldl_' :: (a -> Char -> a) -> a -> Measured a -> a # foldr_ :: (Char -> a -> a) -> a -> Measured a -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Measured a -> Measured a # dropWhile_ :: Bool -> (Char -> Bool) -> Measured a -> Measured a # break_ :: Bool -> (Char -> Bool) -> Measured a -> (Measured a, Measured a) # span_ :: Bool -> (Char -> Bool) -> Measured a -> (Measured a, Measured a) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Measured a -> (Measured a, Measured a, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Measured a -> (Measured a, Measured a, s) #
(StableFactorialMonoid m, TextualMonoid m) => TextualMonoid (LinePositioned m) # |
Methods fromText :: Text -> LinePositioned m # singleton :: Char -> LinePositioned m # splitCharacterPrefix :: LinePositioned m -> Maybe (Char, LinePositioned m) # characterPrefix :: LinePositioned m -> Maybe Char # map :: (Char -> Char) -> LinePositioned m -> LinePositioned m # concatMap :: (Char -> LinePositioned m) -> LinePositioned m -> LinePositioned m # toString :: (LinePositioned m -> String) -> LinePositioned m -> String # any :: (Char -> Bool) -> LinePositioned m -> Bool # all :: (Char -> Bool) -> LinePositioned m -> Bool # foldl :: (a -> LinePositioned m -> a) -> (a -> Char -> a) -> a -> LinePositioned m -> a # foldl' :: (a -> LinePositioned m -> a) -> (a -> Char -> a) -> a -> LinePositioned m -> a # foldr :: (LinePositioned m -> a -> a) -> (Char -> a -> a) -> a -> LinePositioned m -> a # scanl :: (Char -> Char -> Char) -> Char -> LinePositioned m -> LinePositioned m # scanl1 :: (Char -> Char -> Char) -> LinePositioned m -> LinePositioned m # scanr :: (Char -> Char -> Char) -> Char -> LinePositioned m -> LinePositioned m # scanr1 :: (Char -> Char -> Char) -> LinePositioned m -> LinePositioned m # mapAccumL :: (a -> Char -> (a, Char)) -> a -> LinePositioned m -> (a, LinePositioned m) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> LinePositioned m -> (a, LinePositioned m) # takeWhile :: (LinePositioned m -> Bool) -> (Char -> Bool) -> LinePositioned m -> LinePositioned m # dropWhile :: (LinePositioned m -> Bool) -> (Char -> Bool) -> LinePositioned m -> LinePositioned m # break :: (LinePositioned m -> Bool) -> (Char -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) # span :: (LinePositioned m -> Bool) -> (Char -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) # spanMaybe :: s -> (s -> LinePositioned m -> Maybe s) -> (s -> Char -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) # spanMaybe' :: s -> (s -> LinePositioned m -> Maybe s) -> (s -> Char -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) # split :: (Char -> Bool) -> LinePositioned m -> [LinePositioned m] # find :: (Char -> Bool) -> LinePositioned m -> Maybe Char # elem :: Char -> LinePositioned m -> Bool # foldl_ :: (a -> Char -> a) -> a -> LinePositioned m -> a # foldl_' :: (a -> Char -> a) -> a -> LinePositioned m -> a # foldr_ :: (Char -> a -> a) -> a -> LinePositioned m -> a # takeWhile_ :: Bool -> (Char -> Bool) -> LinePositioned m -> LinePositioned m # dropWhile_ :: Bool -> (Char -> Bool) -> LinePositioned m -> LinePositioned m # break_ :: Bool -> (Char -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) # span_ :: Bool -> (Char -> Bool) -> LinePositioned m -> (LinePositioned m, LinePositioned m) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> LinePositioned m -> (LinePositioned m, LinePositioned m, s) #
(StableFactorialMonoid m, TextualMonoid m) => TextualMonoid (OffsetPositioned m) # |
Methods fromText :: Text -> OffsetPositioned m # singleton :: Char -> OffsetPositioned m # splitCharacterPrefix :: OffsetPositioned m -> Maybe (Char, OffsetPositioned m) # characterPrefix :: OffsetPositioned m -> Maybe Char # map :: (Char -> Char) -> OffsetPositioned m -> OffsetPositioned m # concatMap :: (Char -> OffsetPositioned m) -> OffsetPositioned m -> OffsetPositioned m # toString :: (OffsetPositioned m -> String) -> OffsetPositioned m -> String # any :: (Char -> Bool) -> OffsetPositioned m -> Bool # all :: (Char -> Bool) -> OffsetPositioned m -> Bool # foldl :: (a -> OffsetPositioned m -> a) -> (a -> Char -> a) -> a -> OffsetPositioned m -> a # foldl' :: (a -> OffsetPositioned m -> a) -> (a -> Char -> a) -> a -> OffsetPositioned m -> a # foldr :: (OffsetPositioned m -> a -> a) -> (Char -> a -> a) -> a -> OffsetPositioned m -> a # scanl :: (Char -> Char -> Char) -> Char -> OffsetPositioned m -> OffsetPositioned m # scanl1 :: (Char -> Char -> Char) -> OffsetPositioned m -> OffsetPositioned m # scanr :: (Char -> Char -> Char) -> Char -> OffsetPositioned m -> OffsetPositioned m # scanr1 :: (Char -> Char -> Char) -> OffsetPositioned m -> OffsetPositioned m # mapAccumL :: (a -> Char -> (a, Char)) -> a -> OffsetPositioned m -> (a, OffsetPositioned m) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> OffsetPositioned m -> (a, OffsetPositioned m) # takeWhile :: (OffsetPositioned m -> Bool) -> (Char -> Bool) -> OffsetPositioned m -> OffsetPositioned m # dropWhile :: (OffsetPositioned m -> Bool) -> (Char -> Bool) -> OffsetPositioned m -> OffsetPositioned m # break :: (OffsetPositioned m -> Bool) -> (Char -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) # span :: (OffsetPositioned m -> Bool) -> (Char -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) # spanMaybe :: s -> (s -> OffsetPositioned m -> Maybe s) -> (s -> Char -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) # spanMaybe' :: s -> (s -> OffsetPositioned m -> Maybe s) -> (s -> Char -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) # split :: (Char -> Bool) -> OffsetPositioned m -> [OffsetPositioned m] # find :: (Char -> Bool) -> OffsetPositioned m -> Maybe Char # elem :: Char -> OffsetPositioned m -> Bool # foldl_ :: (a -> Char -> a) -> a -> OffsetPositioned m -> a # foldl_' :: (a -> Char -> a) -> a -> OffsetPositioned m -> a # foldr_ :: (Char -> a -> a) -> a -> OffsetPositioned m -> a # takeWhile_ :: Bool -> (Char -> Bool) -> OffsetPositioned m -> OffsetPositioned m # dropWhile_ :: Bool -> (Char -> Bool) -> OffsetPositioned m -> OffsetPositioned m # break_ :: Bool -> (Char -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) # span_ :: Bool -> (Char -> Bool) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> OffsetPositioned m -> (OffsetPositioned m, OffsetPositioned m, s) #
(LeftGCDMonoid a, FactorialMonoid a, TextualMonoid b) => TextualMonoid (Stateful a b) # |
Methods fromText :: Text -> Stateful a b # singleton :: Char -> Stateful a b # splitCharacterPrefix :: Stateful a b -> Maybe (Char, Stateful a b) # characterPrefix :: Stateful a b -> Maybe Char # map :: (Char -> Char) -> Stateful a b -> Stateful a b # concatMap :: (Char -> Stateful a b) -> Stateful a b -> Stateful a b # toString :: (Stateful a b -> String) -> Stateful a b -> String # any :: (Char -> Bool) -> Stateful a b -> Bool # all :: (Char -> Bool) -> Stateful a b -> Bool # foldl :: (a -> Stateful a b -> a) -> (a -> Char -> a) -> a -> Stateful a b -> a # foldl' :: (a -> Stateful a b -> a) -> (a -> Char -> a) -> a -> Stateful a b -> a # foldr :: (Stateful a b -> a -> a) -> (Char -> a -> a) -> a -> Stateful a b -> a # scanl :: (Char -> Char -> Char) -> Char -> Stateful a b -> Stateful a b # scanl1 :: (Char -> Char -> Char) -> Stateful a b -> Stateful a b # scanr :: (Char -> Char -> Char) -> Char -> Stateful a b -> Stateful a b # scanr1 :: (Char -> Char -> Char) -> Stateful a b -> Stateful a b # mapAccumL :: (a -> Char -> (a, Char)) -> a -> Stateful a b -> (a, Stateful a b) # mapAccumR :: (a -> Char -> (a, Char)) -> a -> Stateful a b -> (a, Stateful a b) # takeWhile :: (Stateful a b -> Bool) -> (Char -> Bool) -> Stateful a b -> Stateful a b # dropWhile :: (Stateful a b -> Bool) -> (Char -> Bool) -> Stateful a b -> Stateful a b # break :: (Stateful a b -> Bool) -> (Char -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) # span :: (Stateful a b -> Bool) -> (Char -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) # spanMaybe :: s -> (s -> Stateful a b -> Maybe s) -> (s -> Char -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) # spanMaybe' :: s -> (s -> Stateful a b -> Maybe s) -> (s -> Char -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) # split :: (Char -> Bool) -> Stateful a b -> [Stateful a b] # find :: (Char -> Bool) -> Stateful a b -> Maybe Char # elem :: Char -> Stateful a b -> Bool # foldl_ :: (a -> Char -> a) -> a -> Stateful a b -> a # foldl_' :: (a -> Char -> a) -> a -> Stateful a b -> a # foldr_ :: (Char -> a -> a) -> a -> Stateful a b -> a # takeWhile_ :: Bool -> (Char -> Bool) -> Stateful a b -> Stateful a b # dropWhile_ :: Bool -> (Char -> Bool) -> Stateful a b -> Stateful a b # break_ :: Bool -> (Char -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) # span_ :: Bool -> (Char -> Bool) -> Stateful a b -> (Stateful a b, Stateful a b) # spanMaybe_ :: s -> (s -> Char -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) # spanMaybe_' :: s -> (s -> Char -> Maybe s) -> Stateful a b -> (Stateful a b, Stateful a b, s) #

# Orphan instances

IsString (Vector Char) # |
Methods fromString :: String -> Vector Char #