Data.Function.Selector

hxt-9.3.1.16: A collection of tools for processing XML with Haskell.

Safe Haskell | Safe
Language | Haskell98

Data.Function.Selector

Synopsis

- data Selector s a = S {
  - getS :: s -> a
  - setS :: a -> s -> s
  }
- chgS :: Selector s a -> (a -> a) -> s -> s
- chgM :: Monad m => Selector s a -> (a -> m a) -> s -> m s
- mkSelector :: (s -> a) -> (a -> s -> s) -> Selector s a
- idS :: Selector s s
- (.&&&.) :: Selector s a -> Selector s b -> Selector s (a, b)
- class Comp1 s a | s -> a where
- class Comp2 s a | s -> a where
- class Comp3 s a | s -> a where

# Documentation

data Selector s a #

A Selector is a pair of an access function and a modifying function for reading and updating parts of a composite type

Constructors

S |
Fields getS :: s -> a setS :: a -> s -> s

Instances

Category * Selector # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #

chgS :: Selector s a -> (a -> a) -> s -> s #

chgM :: Monad m => Selector s a -> (a -> m a) -> s -> m s #

mkSelector :: (s -> a) -> (a -> s -> s) -> Selector s a #

Alias for constructor S

idS :: Selector s s #

(.&&&.) :: Selector s a -> Selector s b -> Selector s (a, b) infixr 3 #

class Comp1 s a | s -> a where #

Selectors for pairs and 3-tuples: comp1, comp2, comp3, this can be extended to n-tuples

Minimal complete definition

comp1

Methods

comp1 :: Selector s a #

Instances

Comp1 (a, b) a # |
Methods comp1 :: Selector (a, b) a #
Comp1 (a, b, c) a # |
Methods comp1 :: Selector (a, b, c) a #

class Comp2 s a | s -> a where #

Minimal complete definition

comp2

Methods

comp2 :: Selector s a #

Instances

Comp2 (a, b) b # |
Methods comp2 :: Selector (a, b) b #
Comp2 (a, b, c) b # |
Methods comp2 :: Selector (a, b, c) b #

class Comp3 s a | s -> a where #

Minimal complete definition

comp3

Methods

comp3 :: Selector s a #

Instances

Comp3 (a, b, c) c # |
Methods comp3 :: Selector (a, b, c) c #