Safe Haskell | None |
---|---|
Language | GHC2021 |
Text.Dot
Description
GraphWiz is a small monadic DSL used to write DOT files.
To run the monad, use one of the graph functions, like graph
and
digraph
. Those also have a transformer version if you want to use Dot
on top
of other monads.
Within the monad, you can use any of the construction
functions to create one of the four graph entities. Their
attributes can be set via lenses such as ?=
, see attributes.
The output is a Builder
, that you can convert to a strict
Text
or print directly.
Synopsis
- data Entity
- data EntityType
- getType :: Entity -> EntityType
- itsID :: MonadDot m => m Entity
- type Attributes = HashMap Text Text
- attributes :: Entity -> Lens' DotGraph Attributes
- defaults :: EntityType -> Lens' DotGraph Attributes
- attribute :: Text -> Lens' Attributes (Maybe Text)
- its :: Lens' Attributes (Maybe Text) -> Lens' DotGraph (Maybe Text)
- ifAbsent :: a -> Maybe a -> Maybe a
- node :: MonadDot m => Text -> m Entity
- edge :: MonadDot m => Entity -> Entity -> m Entity
- (-->) :: MonadDot m => Entity -> Entity -> m Entity
- subgraphWith :: MonadDot m => (Entity -> m a) -> m (Entity, a)
- subgraph :: MonadDot m => m a -> m (Entity, a)
- subgraphWith_ :: MonadDot m => (Entity -> m a) -> m a
- subgraph_ :: MonadDot m => m a -> m a
- clusterWith :: MonadDot m => (Entity -> m a) -> m (Entity, a)
- cluster :: MonadDot m => m a -> m (Entity, a)
- clusterWith_ :: MonadDot m => (Entity -> m a) -> m a
- cluster_ :: MonadDot m => m a -> m a
- data DotT (m :: Type -> Type) a
- type Dot = DotT Identity
- type MonadDot (m :: Type -> Type) = (MonadState DotGraph m, MonadReader Path m)
- data DotGraph
- data Path
- currentPath :: MonadDot m => m (NonEmpty Entity)
- rootGraph :: MonadDot m => m Entity
- graphWithT :: Monad m => (Entity -> DotT m a) -> m Builder
- graphT :: Monad m => DotT m a -> m Builder
- graphWith :: (Entity -> Dot a) -> Builder
- graph :: Dot a -> Builder
- digraphWithT :: Monad m => (Entity -> DotT m a) -> m Builder
- digraphT :: Monad m => DotT m a -> m Builder
- digraphWith :: (Entity -> Dot a) -> Builder
- digraph :: Dot a -> Builder
- strictGraphWithT :: Monad m => (Entity -> DotT m a) -> m Builder
- strictGraphT :: Monad m => DotT m a -> m Builder
- strictGraphWith :: (Entity -> Dot a) -> Builder
- strictGraph :: Dot a -> Builder
- strictDigraphWithT :: Monad m => (Entity -> DotT m a) -> m Builder
- strictDigraphT :: Monad m => DotT m a -> m Builder
- strictDigraphWith :: (Entity -> Dot a) -> Builder
- strictDigraph :: Dot a -> Builder
- (.=) :: MonadState s m => ASetter s s a b -> b -> m ()
- (?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m ()
- (%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()
- (<>=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m ()
- (<>:=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m ()
- background :: Lens' Attributes (Maybe Text)
- damping :: Lens' Attributes (Maybe Text)
- isCcluster :: Lens' Attributes (Maybe Text)
- k :: Lens' Attributes (Maybe Text)
- svgClass :: Lens' Attributes (Maybe Text)
- svgID :: Lens' Attributes (Maybe Text)
- tbbalance :: Lens' Attributes (Maybe Text)
- url :: Lens' Attributes (Maybe Text)
- scale :: Lens' Attributes (Maybe Text)
- label :: Lens' Attributes (Maybe Text)
- pos :: Lens' Attributes (Maybe Text)
- group :: Lens' Attributes (Maybe Text)
- rotate :: Lens' Attributes (Maybe Text)
- resolution :: Lens' Attributes (Maybe Text)
- size :: Lens' Attributes (Maybe Text)
- pack :: Lens' Attributes (Maybe Text)
- levels :: Lens' Attributes (Maybe Text)
- vertices :: Lens' Attributes (Maybe Text)
- root :: Lens' Attributes (Maybe Text)
- mode :: Lens' Attributes (Maybe Text)
- sep :: Lens' Attributes (Maybe Text)
- style :: Lens' Attributes (Maybe Text)
- normalize :: Lens' Attributes (Maybe Text)
- center :: Lens' Attributes (Maybe Text)
- z :: Lens' Attributes (Maybe Text)
- len :: Lens' Attributes (Maybe Text)
- start :: Lens' Attributes (Maybe Text)
- lp :: Lens' Attributes (Maybe Text)
- width :: Lens' Attributes (Maybe Text)
- bb :: Lens' Attributes (Maybe Text)
- ltail :: Lens' Attributes (Maybe Text)
- lhead :: Lens' Attributes (Maybe Text)
- area :: Lens' Attributes (Maybe Text)
- arrowhead :: Lens' Attributes (Maybe Text)
- arrowsize :: Lens' Attributes (Maybe Text)
- arrowtail :: Lens' Attributes (Maybe Text)
- beautify :: Lens' Attributes (Maybe Text)
- bgcolor :: Lens' Attributes (Maybe Text)
- black :: Lens' Attributes (Maybe Text)
- charset :: Lens' Attributes (Maybe Text)
- clusterrank :: Lens' Attributes (Maybe Text)
- color :: Lens' Attributes (Maybe Text)
- colorscheme :: Lens' Attributes (Maybe Text)
- comment :: Lens' Attributes (Maybe Text)
- compound :: Lens' Attributes (Maybe Text)
- concentrate :: Lens' Attributes (Maybe Text)
- constraint :: Lens' Attributes (Maybe Text)
- decorate :: Lens' Attributes (Maybe Text)
- defaultdist :: Lens' Attributes (Maybe Text)
- dim :: Lens' Attributes (Maybe Text)
- dimen :: Lens' Attributes (Maybe Text)
- dir :: Lens' Attributes (Maybe Text)
- diredgeconstraints :: Lens' Attributes (Maybe Text)
- distortion :: Lens' Attributes (Maybe Text)
- dpi :: Lens' Attributes (Maybe Text)
- edgeURL :: Lens' Attributes (Maybe Text)
- edgehref :: Lens' Attributes (Maybe Text)
- edgetarget :: Lens' Attributes (Maybe Text)
- edgetooltip :: Lens' Attributes (Maybe Text)
- epsilon :: Lens' Attributes (Maybe Text)
- esep :: Lens' Attributes (Maybe Text)
- fillcolor :: Lens' Attributes (Maybe Text)
- fixedsize :: Lens' Attributes (Maybe Text)
- fontcolor :: Lens' Attributes (Maybe Text)
- fontname :: Lens' Attributes (Maybe Text)
- fontnames :: Lens' Attributes (Maybe Text)
- fontpath :: Lens' Attributes (Maybe Text)
- fontsize :: Lens' Attributes (Maybe Text)
- forcelabels :: Lens' Attributes (Maybe Text)
- gradientangle :: Lens' Attributes (Maybe Text)
- headURL :: Lens' Attributes (Maybe Text)
- head_lp :: Lens' Attributes (Maybe Text)
- headclip :: Lens' Attributes (Maybe Text)
- headhref :: Lens' Attributes (Maybe Text)
- headlabel :: Lens' Attributes (Maybe Text)
- headport :: Lens' Attributes (Maybe Text)
- headtarget :: Lens' Attributes (Maybe Text)
- headtooltip :: Lens' Attributes (Maybe Text)
- height :: Lens' Attributes (Maybe Text)
- href :: Lens' Attributes (Maybe Text)
- image :: Lens' Attributes (Maybe Text)
- imagepath :: Lens' Attributes (Maybe Text)
- imagepos :: Lens' Attributes (Maybe Text)
- imagescale :: Lens' Attributes (Maybe Text)
- inputscale :: Lens' Attributes (Maybe Text)
- labelURL :: Lens' Attributes (Maybe Text)
- label_scheme :: Lens' Attributes (Maybe Text)
- labelangle :: Lens' Attributes (Maybe Text)
- labeldistance :: Lens' Attributes (Maybe Text)
- labelfloat :: Lens' Attributes (Maybe Text)
- labelfontcolor :: Lens' Attributes (Maybe Text)
- labelfontname :: Lens' Attributes (Maybe Text)
- labelfontsize :: Lens' Attributes (Maybe Text)
- labelhref :: Lens' Attributes (Maybe Text)
- labeljust :: Lens' Attributes (Maybe Text)
- labelloc :: Lens' Attributes (Maybe Text)
- labeltarget :: Lens' Attributes (Maybe Text)
- labeltooltip :: Lens' Attributes (Maybe Text)
- landscape :: Lens' Attributes (Maybe Text)
- layer :: Lens' Attributes (Maybe Text)
- layerlistsep :: Lens' Attributes (Maybe Text)
- layers :: Lens' Attributes (Maybe Text)
- layerselect :: Lens' Attributes (Maybe Text)
- layersep :: Lens' Attributes (Maybe Text)
- layout :: Lens' Attributes (Maybe Text)
- levelsgap :: Lens' Attributes (Maybe Text)
- lheight :: Lens' Attributes (Maybe Text)
- linelength :: Lens' Attributes (Maybe Text)
- lwidth :: Lens' Attributes (Maybe Text)
- margin :: Lens' Attributes (Maybe Text)
- maxiter :: Lens' Attributes (Maybe Text)
- mclimit :: Lens' Attributes (Maybe Text)
- mindist :: Lens' Attributes (Maybe Text)
- minlen :: Lens' Attributes (Maybe Text)
- model :: Lens' Attributes (Maybe Text)
- newrank :: Lens' Attributes (Maybe Text)
- nodesep :: Lens' Attributes (Maybe Text)
- nojustify :: Lens' Attributes (Maybe Text)
- notranslate :: Lens' Attributes (Maybe Text)
- nslimit :: Lens' Attributes (Maybe Text)
- nslimit1 :: Lens' Attributes (Maybe Text)
- oneblock :: Lens' Attributes (Maybe Text)
- ordering :: Lens' Attributes (Maybe Text)
- orientation :: Lens' Attributes (Maybe Text)
- outputorder :: Lens' Attributes (Maybe Text)
- overlap :: Lens' Attributes (Maybe Text)
- overlap_scaling :: Lens' Attributes (Maybe Text)
- overlap_shrink :: Lens' Attributes (Maybe Text)
- packmode :: Lens' Attributes (Maybe Text)
- pad :: Lens' Attributes (Maybe Text)
- page :: Lens' Attributes (Maybe Text)
- pagedir :: Lens' Attributes (Maybe Text)
- pencolor :: Lens' Attributes (Maybe Text)
- penwidth :: Lens' Attributes (Maybe Text)
- peripheries :: Lens' Attributes (Maybe Text)
- pin :: Lens' Attributes (Maybe Text)
- quadtree :: Lens' Attributes (Maybe Text)
- quantum :: Lens' Attributes (Maybe Text)
- rank :: Lens' Attributes (Maybe Text)
- rankdir :: Lens' Attributes (Maybe Text)
- ranksep :: Lens' Attributes (Maybe Text)
- ratio :: Lens' Attributes (Maybe Text)
- rects :: Lens' Attributes (Maybe Text)
- regular :: Lens' Attributes (Maybe Text)
- remincross :: Lens' Attributes (Maybe Text)
- repulsiveforce :: Lens' Attributes (Maybe Text)
- rotation :: Lens' Attributes (Maybe Text)
- samehead :: Lens' Attributes (Maybe Text)
- sametail :: Lens' Attributes (Maybe Text)
- samplepoints :: Lens' Attributes (Maybe Text)
- searchsize :: Lens' Attributes (Maybe Text)
- shape :: Lens' Attributes (Maybe Text)
- shapefile :: Lens' Attributes (Maybe Text)
- showboxes :: Lens' Attributes (Maybe Text)
- sides :: Lens' Attributes (Maybe Text)
- skew :: Lens' Attributes (Maybe Text)
- smoothing :: Lens' Attributes (Maybe Text)
- sortv :: Lens' Attributes (Maybe Text)
- splines :: Lens' Attributes (Maybe Text)
- stylesheet :: Lens' Attributes (Maybe Text)
- tailURL :: Lens' Attributes (Maybe Text)
- tail_lp :: Lens' Attributes (Maybe Text)
- tailclip :: Lens' Attributes (Maybe Text)
- tailhref :: Lens' Attributes (Maybe Text)
- taillabel :: Lens' Attributes (Maybe Text)
- tailport :: Lens' Attributes (Maybe Text)
- tailtarget :: Lens' Attributes (Maybe Text)
- tailtooltip :: Lens' Attributes (Maybe Text)
- target :: Lens' Attributes (Maybe Text)
- tooltip :: Lens' Attributes (Maybe Text)
- truecolor :: Lens' Attributes (Maybe Text)
- viewport :: Lens' Attributes (Maybe Text)
- voro_margin :: Lens' Attributes (Maybe Text)
- weight :: Lens' Attributes (Maybe Text)
- xdotversion :: Lens' Attributes (Maybe Text)
- xlabel :: Lens' Attributes (Maybe Text)
- xlp :: Lens' Attributes (Maybe Text)
Entities
Opaque identifier for graph entities.
This type uniquely identifies an entity within the graph. To create one, see
node
, edge
, subgraph
, or cluster
.
data EntityType Source #
Represents the type of a graph entity.
DOT distinguishes between graphs, nodes, edges, and subgraphs / clusters. This type differs slightly: it does not have a value for graphs, as it is never required, and we differentiate subgraphs and clusters.
This type is used internally to distinguish entities, mostly for the purpose
of default attributes (see defaults
).
Instances
Attributes
attributes :: Entity -> Lens' DotGraph Attributes Source #
Retrieves the Attributes
of the given Entity
.
Given an entity attribute, return a lens to the corresponding attributes map
in a given DotGraph
, which is an internal opaque type. This is
meant to be used inside the DotT
monad, relying on the fact that
it is a State monad under the hood.
Using OverloadedLists
makes working with the full attributes map a bit
easier.
graph do x <- node "x" -- replaces the entire mapping (erases the label!) attributes x .= [("fontcolor", "red")] -- combines the existing mapping with the new one, favoring old values attributes x <>= [("fontcolor", "blue"), ("fontsize", "12")] -- combines the existing mapping with the new one, favoring new values attributes x <>:= [("fontcolor", "blue"), ("fontsize", "12")]
This function is best used with the provided field accessors, such as
fontcolor
, to be more explicit about the way to deal with previous values.
defaults :: EntityType -> Lens' DotGraph Attributes Source #
Retrieves the default Attributes
of the given EntityType
.
Given an entity type, return a lens to the corresponding default attributes
map in a given DotGraph
, which is an internal opaque type. This is
meant to be used inside the DotT
monad, relying on the fact that
it is a State monad under the hood.
After modifying the defaults for a given entity type, any new such entity will have its attributes set to the new default values.
graph do node "x" use (its fillcolor) -- Nothing defaults Cluster . style ?= "dashed" defaults Node <>= [("style", "filled"), ("fillcolor", "forestgreen")] node "y" use (its fillcolor) -- Just "forestgreen"
This function is best used with the provided field accessors, such as
fontcolor
, to be more explicit about the way to deal with previous values.
attribute :: Text -> Lens' Attributes (Maybe Text) Source #
Simple alias for at
.
This makes the code a tiny bit more natural when accessing fields by name:
graph do node "x" -- replace the old value, if any its (attribute "fontcolor") ?= "red" its (attribute "fontcolor") .= Just "red" -- erase the attribute its (attribute "fontcolor") .= Nothing -- set the value if it wasn't previously set its (attribute "fontcolor") %= ifAbsent "blue"
It is however preferable to use one of the provided attribute lenses to avoid raw strings.
its :: Lens' Attributes (Maybe Text) -> Lens' DotGraph (Maybe Text) Source #
Retrieves an attribute from the latest created Entity
.
Given a lens for a specific attribute, such as style
or label
, this
combinator creates a lens that points to that attribute for the latest
created Entity
. Like attributes
, it is meant to be used within the
DotT
monad.
graph do its title ?= "my graph" bar <- node "bar" its fontsize ?= "34" edge bar bar its style ?= "dotted" cluster do its label ?= "cluster"
Construction
node :: MonadDot m => Text -> m Entity Source #
Creates a node in the graph, at the current Path
, with the given label.
The newly created node will be assigned all of the default Node
attributes
(see defaults
). This returns a new Entity
that uniquely identifies this
node in the graph, with the attribute "label" set to the given argument.
This function updates the its
entity to this node.
edge :: MonadDot m => Entity -> Entity -> m Entity Source #
Creates an edge in the graph, at the current Path
.
The newly created edge will be assigned all of the default Edge
attributes
(see defaults
). This returns a new Entity
that uniquely identifies this
edge in the graph.
If an entity is a cluster, we set the graph's "compound" property to true, and we attempt to locate any node within it. If there isn't any, we fail silently by outputing a valid but unexpected edge.
This function updates the its
entity to this edge.
subgraphWith :: MonadDot m => (Entity -> m a) -> m (Entity, a) Source #
Creates a subgraph in the given context.
The newly created subgraph will be assigned all of the default Subgraph
attributes (see defaults
). The argument to this function is a callback that
takes the newly minted Entity
and creates the corresponding subgraph.
This function updates the its
entity to this node *twice*: before executing
the callback, and before returning.
graph do (subgraphID, nodeID) <- subgraphWith \subgraphID -> do its fontcolor ?= "green" -- points to the subgraph x <- node "x" its fontcolor ?= "red" -- points to node "x" pure x use (its fontcolor) -- points to the subgraph, returns green
This returns a pair containing the subgraph's Entity
and the result of the
subexpression.
subgraph :: MonadDot m => m a -> m (Entity, a) Source #
Like subgraphWith
, but the subexpression doesn't take the Entity
as
argument.
subgraphWith_ :: MonadDot m => (Entity -> m a) -> m a Source #
Like subgraphWith
, but does not return the subgraph's Entity
.
subgraph_ :: MonadDot m => m a -> m a Source #
Like subgraphWith
, but the subexpression doesn't take the Entity
as
argument, and it does not return the subgraph's Entity
.
clusterWith :: MonadDot m => (Entity -> m a) -> m (Entity, a) Source #
Like subgraphWith
, but creates a cluster instead.
The created entity will use the default Cluster
attributes.
cluster :: MonadDot m => m a -> m (Entity, a) Source #
Like clusterWith
, but the subexpression doesn't take the Entity
as
argument.
clusterWith_ :: MonadDot m => (Entity -> m a) -> m a Source #
Like clusterWith
, but does not return the cluster's Entity
.
cluster_ :: MonadDot m => m a -> m a Source #
Like clusterWith
, but the subexpression doesn't take the Entity
as
argument, and it does not return the cluster's Entity
.
Monad
data DotT (m :: Type -> Type) a Source #
Dot creation monad.
Instances
MonadTrans DotT Source # | |
Defined in Text.Dot.Monad | |
MonadError e m => MonadError e (DotT m) Source # | |
Defined in Text.Dot.Monad | |
Monad m => MonadReader Path (DotT m) Source # | |
Monad m => MonadState DotGraph (DotT m) Source # | |
MonadWriter w m => MonadWriter w (DotT m) Source # | |
MonadIO m => MonadIO (DotT m) Source # | |
Defined in Text.Dot.Monad | |
Monad m => Applicative (DotT m) Source # | |
Functor m => Functor (DotT m) Source # | |
Monad m => Monad (DotT m) Source # | |
type MonadDot (m :: Type -> Type) = (MonadState DotGraph m, MonadReader Path m) Source #
The constraint that all functions require.
We choose to express this as a constraint rather than a typeclass for simplicity.
Internal opaque graph state.
A path through the graph.
This opaque type represents the path from the root to the current scope. The
current path can be obtained via path
.
currentPath :: MonadDot m => m (NonEmpty Entity) Source #
Retrieve the current path.
The path is the stack of entities, representing the graph / subgraphs / clusters between the root of the graph and the current location.
graph do p1 <- currentPath -- returns [$graphID] subgraph do cluster do p2 <- currentPath -- returns [$clusterID, $subgraphID, $graphID] doStuff
Rendering the graph
graphWithT :: Monad m => (Entity -> DotT m a) -> m Builder Source #
Renders a given graph.
Given a DotT
expression that builds a graph, this function evaluates it
and builds an undirected non-strict graph. It returns the result in the
underlying monad, as a Builder
. The callback takes the graph's identifier
as argument.
The result of the graph building expression itself is ignored.
graphT :: Monad m => DotT m a -> m Builder Source #
Renders a given graph.
Like graphWithT
, but the expression doesn't take the identifier as agument.
graphWith :: (Entity -> Dot a) -> Builder Source #
Renders a given graph.
Like graphWithT
, but in the Dot
monad.
digraphWithT :: Monad m => (Entity -> DotT m a) -> m Builder Source #
Renders a given graph.
Given a DotT
expression that builds a graph, this function evaluates it
and builds a directed non-strict graph. It returns the result in the
underlying monad, as a Builder
. The callback takes the graph's identifier
as argument.
The result of the graph building expression itself is ignored.
digraphT :: Monad m => DotT m a -> m Builder Source #
Renders a given graph.
Like digraphWithT
, but the expression doesn't take the entity as agument.
digraphWith :: (Entity -> Dot a) -> Builder Source #
Renders a given graph.
Like digraphWithT
, but in the Dot
monad.
strictGraphWithT :: Monad m => (Entity -> DotT m a) -> m Builder Source #
Renders a given graph.
Given a DotT
expression that builds a graph, this function evaluates it
and builds an undirected strict graph. It returns the result in the
underlying monad, as a Builder
. The callback takes the graph's identifier
as argument.
The result of the graph building expression itself is ignored.
strictGraphT :: Monad m => DotT m a -> m Builder Source #
Renders a given graph.
Like strictGraphWithT
, but the expression doesn't take the entity as agument.
strictGraphWith :: (Entity -> Dot a) -> Builder Source #
Renders a given graph.
Like strictGraphWithT
, but in the Dot
monad.
strictGraph :: Dot a -> Builder Source #
Renders a given graph.
Like strictGraphT
, but in the Dot
monad.
strictDigraphWithT :: Monad m => (Entity -> DotT m a) -> m Builder Source #
Renders a given graph.
Given a DotT
expression that builds a graph, this function evaluates it
and builds a directed strict graph. It returns the result in the underlying
monad, as a Builder
. The callback takes the graph's identifier as argument.
The result of the graph building expression itself is ignored.
strictDigraphT :: Monad m => DotT m a -> m Builder Source #
Renders a given graph.
Like strictDigraphWithT
, but the expression doesn't take the entity as agument.
strictDigraphWith :: (Entity -> Dot a) -> Builder Source #
Renders a given graph.
Like strictDigraphWithT
, but in the Dot
monad.
strictDigraph :: Dot a -> Builder Source #
Renders a given graph.
Like strictDigraphT
, but in the Dot
monad.
Re-exports from Control.Lens.Setter
(.=) :: MonadState s m => ASetter s s a b -> b -> m () infix 4 #
Replace the target of a Lens
or all of the targets of a Setter
or Traversal
in our monadic state with a new value, irrespective of the
old.
This is an infix version of assign
.
>>>
execState (do _1 .= c; _2 .= d) (a,b)
(c,d)
>>>
execState (both .= c) (a,b)
(c,c)
(.=
) ::MonadState
s m =>Iso'
s a -> a -> m () (.=
) ::MonadState
s m =>Lens'
s a -> a -> m () (.=
) ::MonadState
s m =>Traversal'
s a -> a -> m () (.=
) ::MonadState
s m =>Setter'
s a -> a -> m ()
It puts the state in the monad or it gets the hose again.
(?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m () infix 4 #
Replace the target of a Lens
or all of the targets of a Setter
or Traversal
in our monadic
state with Just
a new value, irrespective of the old.
>>>
execState (do at 1 ?= a; at 2 ?= b) Map.empty
fromList [(1,a),(2,b)]
>>>
execState (do _1 ?= b; _2 ?= c) (Just a, Nothing)
(Just b,Just c)
(?=
) ::MonadState
s m =>Iso'
s (Maybe
a) -> a -> m () (?=
) ::MonadState
s m =>Lens'
s (Maybe
a) -> a -> m () (?=
) ::MonadState
s m =>Traversal'
s (Maybe
a) -> a -> m () (?=
) ::MonadState
s m =>Setter'
s (Maybe
a) -> a -> m ()
(%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m () infix 4 #
Map over the target of a Lens
or all of the targets of a Setter
or Traversal
in our monadic state.
>>>
execState (do _1 %= f;_2 %= g) (a,b)
(f a,g b)
>>>
execState (do both %= f) (a,b)
(f a,f b)
(%=
) ::MonadState
s m =>Iso'
s a -> (a -> a) -> m () (%=
) ::MonadState
s m =>Lens'
s a -> (a -> a) -> m () (%=
) ::MonadState
s m =>Traversal'
s a -> (a -> a) -> m () (%=
) ::MonadState
s m =>Setter'
s a -> (a -> a) -> m ()
(%=
) ::MonadState
s m =>ASetter
s s a b -> (a -> b) -> m ()
(<>=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m () infix 4 #
Modify the target(s) of a Lens'
, Iso
, Setter
or Traversal
by using (
.<>
)
>>>
execState (do _1 <>= Sum c; _2 <>= Product d) (Sum a,Product b)
(Sum {getSum = a + c},Product {getProduct = b * d})
>>>
execState (both <>= "!!!") ("hello","world")
("hello!!!","world!!!")
(<>=
) :: (MonadState
s m,Semigroup
a) =>Setter'
s a -> a -> m () (<>=
) :: (MonadState
s m,Semigroup
a) =>Iso'
s a -> a -> m () (<>=
) :: (MonadState
s m,Semigroup
a) =>Lens'
s a -> a -> m () (<>=
) :: (MonadState
s m,Semigroup
a) =>Traversal'
s a -> a -> m ()
(<>:=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m () infix 4 #
All known attributes
Renamed attributes
All attributes listed in Graphviz's
documentation have an accompanying
lens, so that any standard attribute can be accessed without using strings
(like with attribute
). Not all of them are valid haskell names, however:
the following are the ones that have been remamed, the others ones can be
found below.
background :: Lens' Attributes (Maybe Text) Source #
Maps to the _background
attribute.
isCcluster :: Lens' Attributes (Maybe Text) Source #
Maps to the cluster
attribute.
All others
resolution :: Lens' Attributes (Maybe Text) Source #
clusterrank :: Lens' Attributes (Maybe Text) Source #
colorscheme :: Lens' Attributes (Maybe Text) Source #
concentrate :: Lens' Attributes (Maybe Text) Source #
constraint :: Lens' Attributes (Maybe Text) Source #
defaultdist :: Lens' Attributes (Maybe Text) Source #
distortion :: Lens' Attributes (Maybe Text) Source #
edgetarget :: Lens' Attributes (Maybe Text) Source #
edgetooltip :: Lens' Attributes (Maybe Text) Source #
forcelabels :: Lens' Attributes (Maybe Text) Source #
gradientangle :: Lens' Attributes (Maybe Text) Source #
headtarget :: Lens' Attributes (Maybe Text) Source #
headtooltip :: Lens' Attributes (Maybe Text) Source #
imagescale :: Lens' Attributes (Maybe Text) Source #
inputscale :: Lens' Attributes (Maybe Text) Source #
label_scheme :: Lens' Attributes (Maybe Text) Source #
labelangle :: Lens' Attributes (Maybe Text) Source #
labeldistance :: Lens' Attributes (Maybe Text) Source #
labelfloat :: Lens' Attributes (Maybe Text) Source #
labelfontname :: Lens' Attributes (Maybe Text) Source #
labelfontsize :: Lens' Attributes (Maybe Text) Source #
labeltarget :: Lens' Attributes (Maybe Text) Source #
labeltooltip :: Lens' Attributes (Maybe Text) Source #
layerlistsep :: Lens' Attributes (Maybe Text) Source #
layerselect :: Lens' Attributes (Maybe Text) Source #
linelength :: Lens' Attributes (Maybe Text) Source #
notranslate :: Lens' Attributes (Maybe Text) Source #
orientation :: Lens' Attributes (Maybe Text) Source #
outputorder :: Lens' Attributes (Maybe Text) Source #
peripheries :: Lens' Attributes (Maybe Text) Source #
remincross :: Lens' Attributes (Maybe Text) Source #
samplepoints :: Lens' Attributes (Maybe Text) Source #
searchsize :: Lens' Attributes (Maybe Text) Source #
stylesheet :: Lens' Attributes (Maybe Text) Source #
tailtarget :: Lens' Attributes (Maybe Text) Source #
tailtooltip :: Lens' Attributes (Maybe Text) Source #
voro_margin :: Lens' Attributes (Maybe Text) Source #
xdotversion :: Lens' Attributes (Maybe Text) Source #