registry-0.3.3.0: data structure for assembling components
Safe HaskellSafe-Inferred
LanguageGHC2021

Data.Registry.Internal.Dot

Contents

Description

Nested datatype to track the resolution algorithm

From this data type we can draw a graph of the full instantiation of a value

Synopsis

Documentation

makeEdges :: Operations -> [(Value, Value)] Source #

Make a list of graph edges from the list of function applications

DOT GRAPH

newtype Dot Source #

A DOT graph

Constructors

Dot 

Fields

Instances

Instances details
Show Dot Source # 
Instance details

Defined in Data.Registry.Internal.Dot

Methods

showsPrec :: Int -> Dot -> ShowS #

show :: Dot -> String #

showList :: [Dot] -> ShowS #

Eq Dot Source # 
Instance details

Defined in Data.Registry.Internal.Dot

Methods

(==) :: Dot -> Dot -> Bool #

(/=) :: Dot -> Dot -> Bool #

type DotState = State ValuesByType Source #

Use a State type to get the current index of a value when there are values of the same type and different hash values

type ValuesByType = Map SomeTypeRep ValueHashes Source #

List of value hashes by value type

type Hash = Int Source #

Type alias for a Hash

type ValueId = Int Source #

Type alias for a ValueId

type ValueHashes = [Hash] Source #

Type alias for a list of hashes

type Edge = (Value, Value) Source #

Type alias for a list of an edge in the graph

type Edges = [Edge] Source #

Type alias for a list of edges

type ValueCounter = Maybe Int Source #

Type alias for associating a number to a value

toDot :: Operations -> Dot Source #

Make a DOT graph out of all the function applications

countValueTypes :: Value -> DotState () Source #

Update a map classifying values by type

toDotEdge :: ValuesByType -> (Value, Value) -> Text Source #

A DOT edge representing the dependency between 2 values

toDotVertex :: ValuesByType -> Value -> Text Source #

Represent a value as a vertex in a dot graph we use some state to keep track of values of the same type The values are numbered starting from 1 when there are several of them for the same type

hashOf :: Value -> Int Source #

Return the hash of a value based on its dependencies

nodeDescription :: ValueDescription -> ValueCounter -> Text Source #

Description of a Value in the DOT graph

showValueCounter :: ValueCounter -> Text Source #

Don't show the counter if there

adjust :: Text -> Text Source #

We need to process the node descriptions - we add quotes arountd the text - we remove quotes (") inside the text - we escape newlines

removeQuotes :: Text -> Text Source #

Remove quotes from a textual description to avoid breaking the DOT format

escapeNewlines :: Text -> Text Source #

Replace n with \n so that newlines are kept in node descriptions