package opam-format

  1. Overview
  2. Docs

Helper functions on the base types (from OpamTypes)

This module contains basic utility functions and stringifiers for the basic OPAM types present in OpamTypes.ml

val string_of_std_path : OpamTypes.std_path -> string
val std_path_of_string : string -> OpamTypes.std_path
val all_std_paths : OpamTypes.std_path list
val action_contents : [< 'a OpamTypes.action ] -> 'a list

Extract a package from a package action.

val map_atomic_action : ('a -> 'b) -> 'a OpamTypes.atomic_action -> 'b OpamTypes.atomic_action
val map_highlevel_action : ('a -> 'b) -> 'a OpamTypes.highlevel_action -> 'b OpamTypes.highlevel_action
val map_concrete_action : ('a -> 'b) -> 'a OpamTypes.concrete_action -> 'b OpamTypes.concrete_action
val map_action : ('a -> 'b) -> 'a OpamTypes.action -> 'b OpamTypes.action
val full_action_contents : 'a OpamTypes.action -> 'a list

Extract a packages from a package action. This returns all concerned packages, including the old version for an up/down-grade.

val string_of_cause : ('pkg -> string) -> 'pkg OpamTypes.cause -> string

Pretty-prints the cause of an action

val string_of_shell : OpamTypes.shell -> string

Pretty-print

val pos_null : OpamParserTypes.FullPos.pos

The empty file position

val nullify_pos : 'a -> 'a OpamParserTypes.FullPos.with_pos
val pos_best : OpamParserTypes.FullPos.pos -> OpamParserTypes.FullPos.pos -> OpamParserTypes.FullPos.pos

pos_best pos1 pos2 returns the most detailed position between pos1 and pos2 (defaulting to pos1)

val pos_file : OpamTypes.filename -> OpamParserTypes.FullPos.pos

Position in the given file, with unspecified line and column

val string_of_pos : OpamParserTypes.FullPos.pos -> string

Prints a file position

val string_of_user_action : OpamTypes.user_action -> string
val env_array : OpamTypes.env -> string array

Makes sure to keep only the last binding for a given variable; doesn't preserve order

exception Parse_variable of string * string
val filter_ident_of_string : string -> OpamTypes.name option list * OpamTypes.variable * (string * string) option

Parses the data suitable for a filter.FIdent from a string. May raise Failure msg on bad package names. A self-reference _ parses to None

val filter_ident_of_string_interp : ?accept:bool -> string -> OpamTypes.name option list * OpamTypes.variable * (string * string) option

Like Filter_ident_of_string but parses also '%?pkg+:var:% syntax for variables with package name that contains a '+'. if accept is false, Parse_variable (pkg,var) is raised when several '+' are encountered in package name, i.e. 'pkg++:var'.

val string_of_filter_ident : (OpamTypes.name option list * OpamTypes.variable * (string * string) option) -> string
val pkg_flag_of_string : string -> OpamTypes.package_flag
val string_of_pkg_flag : OpamTypes.package_flag -> string
val all_package_flags : OpamTypes.package_flag list
val map_success : ('a -> 'b) -> ('a, 'fail) OpamTypes.result -> ('b, 'fail) OpamTypes.result

Map on a solver result

val iter_success : ('a -> unit) -> ('a, 'b) OpamTypes.result -> unit
val env_update : ?comment:string -> rewrite:'a OpamTypes.separator_path_format option -> string -> 'b OpamTypes.env_update_op_kind -> string -> ('a, 'b) OpamTypes.env_update

Environment update helpers

val env_update_resolved : ?comment:string -> ?rewrite:OpamTypes.spf_resolved OpamTypes.separator_path_format option -> string -> 'a OpamTypes.env_update_op_kind -> string -> (OpamTypes.spf_resolved, 'a) OpamTypes.env_update
val env_update_unresolved : ?comment:string -> ?rewrite:OpamTypes.spf_unresolved OpamTypes.separator_path_format option -> string -> 'a OpamTypes.env_update_op_kind -> string -> (OpamTypes.spf_unresolved, 'a) OpamTypes.env_update
val op_of_raw : OpamParserTypes.FullPos.env_update_op_kind -> OpamTypes.euok_writeable OpamTypes.env_update_op_kind
val raw_of_op : OpamTypes.euok_writeable OpamTypes.env_update_op_kind -> OpamParserTypes.FullPos.env_update_op_kind
val string_of_path_format : OpamTypes.path_format -> string
val char_of_separator : OpamTypes.separator -> char
OCaml

Innovation. Community. Security.