Data.Generics.Str

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

Safe Haskell | None

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)
- 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

Functor Str |
Foldable Str |
Traversable Str |
Eq a => Eq (Str a) |
Show a => Show (Str a) |

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.