package mirage

  1. Overview
  2. Docs

Module Functoria.DeviceSource

Signature for functoria devices. A device is a module implementation which contains a runtime state which can be set either at configuration time (by the application builder) or at runtime, using command-line arguments.

Sourcetype ('a, 'b) t

The type for devices whose runtime state is of type 'a and having extra data-dependencies of type 'b.

Sourceval module_type : ('a, 'b) t -> 'a Type.t

module_type t is t's module type.

Sourceval module_name : ('a, 'b) t -> string

module_name t is t's module name.

Sourceval packages : ('a, 'b) t -> Package.t list Key.value

packages t is the list of OPAM packages that are needed by t.

Sourceval install : ('a, 'b) t -> Info.t -> Install.t Key.value

install t i is the list of files installed by t, using the build information i.

Sourceval extra_deps : ('a, 'b) t -> 'b list

extra_deps t is the list of dependencies that be initialized before running the code generated by connect t.

Sourceval id : ('a, 'b) t -> int

id t is t's unique identifier. Freshly generated for each call to v.

Sourceval pp : 'b Fmt.t -> ('a, 'b) t Fmt.t

pp pp_dep is the pretty-printer for devices, using pp_dep to pretty-print the extra data-dependencies.

Sourceval equal : ('a, 'b) t -> ('c, 'd) t -> bool

equal is the equality function for devices.

Sourceval witness : ('a, _) t -> ('b, _) t -> ('a, 'b) Functoria__.Typeid.witness

witness a b provides an equality witness.

Sourceval hash : ('a, 'b) t -> int

hash t is t's hash.

Resources

Sourceval files : ('a, 'b) t -> Info.t -> Fpath.Set.t

files t info s is the list of files generated configure-time.

Sourceval keys : ('a, 'b) t -> Key.t list

keys t is the list of keys which can be used to configure t.

Sourceval runtime_args : ('a, 'b) t -> Runtime_arg.t list

runtime_args t is the list of command-line arguments which can be used to configure t at runtime.

Code Generation

Sourcetype 'a code = private {
  1. pos : (string * int * int * int) option;
  2. code : string;
}

The type for fragments of code of type 'a.

Sourceval code : pos:(string * int * int * int) -> ('a, Format.formatter, unit, 'b code) format4 -> 'a

Generate localised code.

Sourceval connect : ('a, 'b) t -> Info.t -> string -> string list -> 'a code

connect t info impl_name args is the code to execute in order to create a new state (usually calling <module_name t>.connect) with the arguments args, in the context of the project information info. The freshly created state will be made available in var_name t

Sourceval start : ?pos:(string * int * int * int) -> string -> string list -> 'a code

start ?pos impl_name args is the code <impl_name>.start <args>.

Sourceval nice_name : (_, _) t -> string

nice_name d provides a identifier unique to d which is a valid OCaml identifier.

Sourceval dune : ('a, 'b) t -> Info.t -> Dune.stanza list

Actions

dune t info are the dune stanza which needs to be generated to build the application.

Configuration

Sourceval configure : ('a, 'b) t -> Info.t -> unit Action.t

configure t info is configure hook for t the device and the files it generates. During the configure phase, you cannot rely on packages t being installed.

To run code during the build phase, generate a dune fragment instead.

Constructors

Sourceval v : ?packages:Package.t list -> ?packages_v:Package.t list Key.value -> ?install:(Info.t -> Install.t) -> ?install_v:(Info.t -> Install.t Key.value) -> ?keys:Key.t list -> ?runtime_args:Runtime_arg.t list -> ?extra_deps:'b list -> ?connect:(Info.t -> string -> string list -> 'a code) -> ?dune:(Info.t -> Dune.stanza list) -> ?configure:(Info.t -> unit Action.t) -> ?files:(Info.t -> Fpath.t list) -> string -> 'a Type.t -> ('a, 'b) t
Sourceval extend : ?packages:Package.t list -> ?packages_v:Package.t list Key.value -> ?dune:(Info.t -> Dune.stanza list) -> ?pre_configure:(Info.t -> unit Action.t) -> ?post_configure:(Info.t -> unit Action.t) -> ?files:(Info.t -> Fpath.t list) -> ('a, 'b) t -> ('a, 'b) t

Device graphs

Sourcemodule Graph : sig ... end
OCaml

Innovation. Community. Security.