Data.Accessor.Container

data-accessor-0.2.2.7: Utilities for accessing and manipulating fields of records

Safe Haskell | Safe
Language | Haskell98

Data.Accessor.Container

Description

This module allows to access elements of arrays, sets and finite maps like elements of records. This is especially useful for working with nested structures consisting of arrays, sets, maps and records.

Maybe we should move it to a separate package, then we would not need to import `array` and `containers` package.

Synopsis

- array :: Ix i => i -> T (Array i e) e
- set :: Ord a => a -> T (Set a) Bool
- mapDefault :: Ord key => elem -> key -> T (Map key elem) elem
- mapMaybe :: Ord key => key -> T (Map key elem) (Maybe elem)
- intMapDefault :: elem -> Int -> T (IntMap elem) elem
- intMapMaybe :: Int -> T (IntMap elem) (Maybe elem)

# Documentation

array :: Ix i => i -> T (Array i e) e

set :: Ord a => a -> T (Set a) Bool

Treat a Set like a boolean array.

mapDefault :: Ord key => elem -> key -> T (Map key elem) elem

Treats a finite map like an infinite map, where all undefined elements are replaced by a default value.

mapMaybe :: Ord key => key -> T (Map key elem) (Maybe elem)

Treats a finite map like an infinite map, where all undefined elements are `Nothing` and defined elements are `Just`.

intMapDefault :: elem -> Int -> T (IntMap elem) elem

intMapMaybe :: Int -> T (IntMap elem) (Maybe elem)