Data.Generics.Str

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

Safe Haskell | None
Language | Haskell2010

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 :: Applicative 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 #

Constructors

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

#### Instances

Instances details

Foldable Str # |
Instance details Defined in Data.Generics.Str Methods fold :: Monoid m => Str m -> m # foldMap :: Monoid m => (a -> m) -> Str a -> m # foldMap' :: Monoid m => (a -> m) -> Str a -> m # foldr :: (a -> b -> b) -> b -> Str a -> b # foldr' :: (a -> b -> b) -> b -> Str a -> b # foldl :: (b -> a -> b) -> b -> Str a -> b # foldl' :: (b -> a -> b) -> b -> Str a -> b # foldr1 :: (a -> a -> a) -> Str a -> a # foldl1 :: (a -> a -> a) -> Str a -> a # toList :: Str a -> [a] # null :: Str a -> Bool # length :: Str a -> Int # elem :: Eq a => a -> Str a -> Bool # maximum :: Ord a => Str a -> a # minimum :: Ord a => Str a -> a # sum :: Num a => Str a -> a # product :: Num a => Str a -> a #
Traversable Str # |
Instance details Defined in Data.Generics.Str Methods traverse :: Applicative f => (a -> f b) -> Str a -> f (Str b) # sequenceA :: Applicative f => Str (f a) -> f (Str a) # mapM :: Monad m => (a -> m b) -> Str a -> m (Str b) # sequence :: Monad m => Str (m a) -> m (Str a) #
Functor Str # |
Instance details Defined in Data.Generics.Str Methods fmap :: (a -> b) -> Str a -> Str b # (<$) :: a -> Str b -> Str a #
Show a => Show (Str a) # |
Instance details Defined in Data.Generics.Str Methods showsPrec :: Int -> Str a -> ShowS # show :: Str a -> String # showList :: [Str a] -> ShowS #
Eq a => Eq (Str a) # |
Instance details Defined in Data.Generics.Str Methods (==) :: Str a -> Str a -> Bool # (/=) :: Str a -> Str a -> Bool #

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

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

strType :: Str a -> a #

Take the type of the method, will crash if called

strList :: Str a -> [a] #

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

listStr :: [a] -> Str a #

Convert a list to a `Str`

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

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