graph-rewriting-0.7.4: Monadic graph rewriting of hypergraphs with ports and multiedges

Safe HaskellNone



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



class View v n whereSource

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


inspect :: n -> vSource

update :: v -> n -> nSource

adjust :: (v -> v) -> n -> nSource


View n n 
(View v1 n, View v2 n) => View (v1, v2) n 
(View v1 n, View v2 n, View v3 n) => View (v1, v2, v3) n 
(View v1 n, View v2 n, View v3 n, View v4 n) => View (v1, v2, v3, v4) n 

examine :: View v n => (v -> field) -> n -> fieldSource

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 nSource