uniplate-1.6.12: Help writing simple, concise and fast generic operations.

Safe Haskell | None
Language | Haskell98

Data.Generics.Str

Contents

- The Data Type

Description

This module provides the `Str` data type, which is used by the underlying `uniplate` and `biplate` methods. It should not be used directly under normal circumstances.

Synopsis

- data Str a
  - = Zero
  - | One a
  - | Two (Str a) (Str a)
- strMap :: (a -> b) -> Str a -> Str b
- strMapM :: Monad m => (a -> m b) -> Str a -> m (Str b)
- strType :: Str a -> a
- strList :: Str a -> [a]
- listStr :: [a] -> Str a
- strStructure :: Str a -> ([a], [a] -> Str a)

# The Data Type

data Str a Source #

Constructors

Zero |
One a |
Two (Str a) (Str a) |

Instances

Functor Str Source # |
Instance details Defined in Data.Generics.Str Methods fmap :: (a -> b) -> Str a -> Str b Source # (<$) :: a -> Str b -> Str a Source #
Foldable Str Source # |

Instance details

Defined in Data.Generics.Str

Methods

fold :: Monoid m => Str m -> m Source #

foldMap :: Monoid m => (a -> m) -> Str a -> m Source #

foldr :: (a -> b -> b) -> b -> Str a -> b Source #

foldr' :: (a -> b -> b) -> b -> Str a -> b Source #

foldl :: (b -> a -> b) -> b -> Str a -> b Source #

foldl' :: (b -> a -> b) -> b -> Str a -> b Source #

foldr1 :: (a -> a -> a) -> Str a -> a Source #

foldl1 :: (a -> a -> a) -> Str a -> a Source #

toList :: Str a -> [a] Source #

null :: Str a -> Bool Source #

length :: Str a -> Int Source #

elem :: Eq a => a -> Str a -> Bool Source #

maximum :: Ord a => Str a -> a Source #

minimum :: Ord a => Str a -> a Source #

sum :: Num a => Str a -> a Source #

product :: Num a => Str a -> a Source #

Traversable Str Source # |
Instance details Defined in Data.Generics.Str Methods traverse :: Applicative f => (a -> f b) -> Str a -> f (Str b) Source # sequenceA :: Applicative f => Str (f a) -> f (Str a) Source # mapM :: Monad m => (a -> m b) -> Str a -> m (Str b) Source # sequence :: Monad m => Str (m a) -> m (Str a) Source #
Eq a => Eq (Str a) Source # |
Instance details Defined in Data.Generics.Str Methods (==) :: Str a -> Str a -> Bool Source # (/=) :: Str a -> Str a -> Bool Source #
Show a => Show (Str a) Source # |
Instance details Defined in Data.Generics.Str Methods showsPrec :: Int -> Str a -> ShowS Source # show :: Str a -> String Source # showList :: [Str a] -> ShowS Source #

strMap :: (a -> b) -> Str a -> Str b Source #

strMapM :: Monad m => (a -> m b) -> Str a -> m (Str b) Source #

strType :: Str a -> a Source #

Take the type of the method, will crash if called

strList :: Str a -> [a] Source #

Convert a `Str` to a list, assumes the value was created with `listStr`

listStr :: [a] -> Str a Source #

Convert a list to a `Str`

strStructure :: Str a -> ([a], [a] -> Str a) Source #

Transform a `Str` to a list, and back again, in a structure preserving way. The output and input lists must be equal in length.