Library
Module
Module type
Parameter
Class
Class type
The Functoria DSL allows users to describe how to create portable and flexible applications. It allows to pass application parameters easily using command-line arguments either at configure-time or at runtime.
Users of the Functoria DSL composes their application by defining a list of module implementations, specify the command-line key
that are required and combine all of them together using applicative operators.
The DSL expression is then compiled into an application builder, which will, once evaluated, produced the final portable and flexible application.
type 'a typ = 'a Type.t
The type for values representing module types.
val typ : 'a -> 'a typ
type t
is a value representing the module type t
.
Construct a functor type from a type and an existing functor type. This corresponds to prepending a parameter to the list of functor parameters. For example:
kv_ro @-> ip @-> kv_ro
This describes a functor type that accepts two arguments -- a kv_ro
and an ip
device -- and returns a kv_ro
.
type 'a impl = 'a Impl.t
The type for values representing module implementations.
type abstract_impl = Impl.abstract
Same as impl
but with hidden type.
val dep : 'a impl -> abstract_impl
dep t
is the (build-time) dependency towards t
.
val abstract : 'a impl -> abstract_impl
type 'a key = 'a Key.key
The type for command-line parameters.
type abstract_key = Key.t
The type for abstract keys.
type context = Key.context
The type for keys' parsing context. See Key.context
.
if_impl v impl1 impl2
is impl1
if v
is resolved to true and impl2
otherwise.
match_impl v cases ~default
chooses the implementation amongst cases
by matching the v
's value. default
is chosen if no value matches.
For specifying opam package dependencies, the type package
is used. It consists of the opam package name, the ocamlfind names, and optional lower and upper bounds. The version constraints are merged with other modules.
type package = Package.t
The type for opam packages.
type scope = Package.scope
Installation scope of a package.
val package :
?scope:scope ->
?build:bool ->
?sublibs:string list ->
?libs:string list ->
?min:string ->
?max:string ->
?pin:string ->
string ->
package
Same as Functoria.Package.v
Values of type impl
are tied to concrete module implementation with the device
and foreign
construct. Module implementations of type job
can then be registered into an application builder. The builder is in charge if parsing the command-line arguments and of generating code for the final application. See Functoria.Lib
for details.
type info = Info.t
The type for build information.
val foreign :
?packages:package list ->
?packages_v:package list value ->
?keys:abstract_key list ->
?deps:abstract_impl list ->
string ->
'a typ ->
'a impl
Alias for main
, where ?extra_deps
has been renamed to ?deps
.
val main :
?packages:package list ->
?packages_v:package list value ->
?keys:abstract_key list ->
?extra_deps:abstract_impl list ->
string ->
'a typ ->
'a impl
foreign name typ
is the functor name
, having the module type typ
. The connect code will call <name>.start
.
packages
or packages_v
is set, then the given packages are installed before compiling the current application.keys
is set, use the given keys to parse at configure and runtime the command-line arguments before calling <name>.connect
.extra_deps
is set, the given list of abstract implementations is added as data-dependencies: they will be initialized before calling <name>.connect
.type 'a device = ('a, abstract_impl) Device.t
val impl :
?packages:package list ->
?packages_v:package list Key.value ->
?install:(Info.t -> Install.t) ->
?install_v:(Info.t -> Install.t Key.value) ->
?keys:Key.t list ->
?extra_deps:abstract_impl list ->
?connect:(info -> string -> string list -> string) ->
?dune:(info -> Dune.stanza list) ->
?configure:(info -> unit Action.t) ->
?files:(info -> Fpath.t list) ->
string ->
'a typ ->
'a impl
impl ...
is of_device @@ Device.v ...