package functoria

  1. Overview
  2. Docs

Graph engine

type subconf = < name : string ; module_name : string ; keys : Functoria.key list ; packages : Functoria.package list Functoria.value ; connect : Functoria.Info.t -> string -> string list -> string ; build : Functoria.Info.t -> (unit, Rresult.R.msg) Stdlib.result ; configure : Functoria.Info.t -> (unit, Rresult.R.msg) Stdlib.result ; clean : Functoria.Info.t -> (unit, Rresult.R.msg) Stdlib.result >

A subset of configurable with neither polymorphism nor recursion.

type t
type vertex
module If : sig ... end
type label =
  1. | If of If.path Functoria.value
  2. | Impl of subconf
  3. | App

The description of a vertex

module Tbl : Stdlib.Hashtbl.S with type key = vertex
val create : _ Functoria.impl -> t

create impl creates a graph based impl.

val normalize : t -> t

normalize g normalize the graph g by removing the App vertices.

val simplify : t -> t

simplify g simplifies the graph so that it's easier to read for humans.

val eval : ?partial:bool -> context:Functoria.context -> t -> t

eval ~keys g will removes all the If vertices by resolving the keys using keys. It will then call normalize

If partial is true, then it will only evaluate If vertices which condition is resolved.

val is_fully_reduced : t -> bool

is_fully_reduced g is true if g contains only Impl vertices.

val fold : (vertex -> 'a -> 'a) -> t -> 'a -> 'a

fold f g z applies f on each vertex of g in topological order.

val find_all : t -> (label -> bool) -> vertex list

find_all g p returns all the vertices in g such as p v is true.

val find_root : t -> vertex

find_root g returns the only vertex of g that has no predecessors.

val explode : t -> vertex -> [ `App of vertex * vertex list | `If of If.path Functoria.value * (If.path * vertex) list | `Impl of subconf * [> `Args of vertex list ] * [> `Deps of vertex list ] ]

explode g v deconstructs the vertex v in the graph g into it's possible components. It also checks that the local invariants are respected.

val collect : (module Functoria_misc.Monoid with type t = 'ty) -> (label -> 'ty) -> t -> 'ty

collect (module M) f g collects the content of f v for each vertex v in g.

val hash : vertex -> int
val pp : t Fmt.t

Textual representation of the graph.

val pp_dot : t Fmt.t

Dot representation of the graph.

OCaml

Innovation. Community. Security.