graph-rewriting-0.8.0: Monadic graph rewriting of hypergraphs with ports and multiedges
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.View

Description

The multi-parameter type-class View provides an abstraction View v n of a type n that exposes a value of type v. It allows both to inspect and update the value, while hiding the internal structure of the value type (n).

Synopsis

Documentation

class View v n where Source #

Minimal complete definition: inspect and one of {update, adjust}

Minimal complete definition

inspect

Methods

inspect :: n -> v Source #

update :: v -> n -> n Source #

adjust :: (v -> v) -> n -> n Source #

Instances

Instances details
View n n Source # 
Instance details

Defined in Data.View

Methods

inspect :: n -> n Source #

update :: n -> n -> n Source #

adjust :: (n -> n) -> n -> n Source #

(View v1 n, View v2 n) => View (v1, v2) n Source # 
Instance details

Defined in Data.View

Methods

inspect :: n -> (v1, v2) Source #

update :: (v1, v2) -> n -> n Source #

adjust :: ((v1, v2) -> (v1, v2)) -> n -> n Source #

(View v1 n, View v2 n, View v3 n) => View (v1, v2, v3) n Source # 
Instance details

Defined in Data.View

Methods

inspect :: n -> (v1, v2, v3) Source #

update :: (v1, v2, v3) -> n -> n Source #

adjust :: ((v1, v2, v3) -> (v1, v2, v3)) -> n -> n Source #

(View v1 n, View v2 n, View v3 n, View v4 n) => View (v1, v2, v3, v4) n Source # 
Instance details

Defined in Data.View

Methods

inspect :: n -> (v1, v2, v3, v4) Source #

update :: (v1, v2, v3, v4) -> n -> n Source #

adjust :: ((v1, v2, v3, v4) -> (v1, v2, v3, v4)) -> n -> n Source #

examine :: View v n => (v -> field) -> n -> field Source #

convenience function that can be used to access record fields of the exposed type

adjustM :: (Monad m, View v n) => (v -> m v) -> n -> m n Source #