On this page:
package-input
make-package-input
abstract-package-input?
current-inputs
input-ref
find-input
release-input
resolve-input
keep-input
$input
$input:  not-found
untrusted-source
find-artifact-for-input
8.12

12 Package Inputs🔗ℹ

 (require denxi/input) package: denxi

struct

(struct package-input (name plinth))

  name : string?
  plinth : (or/c any/c artifact?)
A package input is an instance of package-input. Each instance represents data that a package may lazily fetch.

The plinth acts as a placeholder for a value used to retrieve an artifact. If the plinth does not hold an instance of artifact, then we use that value in the digsite metaphor to find an artifact.

procedure

(make-package-input name [plinth])  package-input?

  name : string?
  plinth : (or/c any/c artifact?) = #f
A contracted constructor for package-input.

Returns #t if the argument is an abstract package input, meaning that package-input-plinth is #f.

A parameter bound to inputs to use with input-ref.

procedure

(input-ref name)  (subprogram/c package-input?)

  name : string?
Returns the first element of (current-inputs) with an package-input-name equal? to name.

procedure

(find-input inputs name)  (subprogram/c package-input?)

  inputs : (listof package-input?)
  name : string?
Returns a subprogram P that either returns the first input in inputs with the given name, or fails with $input:not-found on the program log.

procedure

(release-input input)  (subprogram/c void?)

  input : package-input?
Returns a subprogram P that deletes the symbolic link derived from input.

procedure

(resolve-input input)  (subprogram/c path-string?)

  input : package-input?
Returns a subprogram P that, when applied, acquires and verifies the bytes for input. P returns a relative path to a symbolic link in (current-directory).

P may fail for many possible reasons, which will appear in the program log.

procedure

(keep-input name)  (subprogram/c path-string?)

  name : string?
Equivalent to (mdo i := (input-ref name) (resolve-input i)).

Use for inputs that you do not intend to release.

struct

(struct $input $message (name))

  name : string?
A message regarding an input with a given name.

Represents a failure to find an input using find-input.

struct

(struct untrusted-source (input)
    #:extra-constructor-name make-untrusted-source)
  input : package-input?
A source that, when tapped, yields bytes found using the input. If no bytes are found or do not pass security checks, the source is exhausted. $transfer messages use the input’s name.

This is the only source that includes all possible safety checks and customizations defined by the launcher, making it suitable for use with arbitrary data.

Returns a subprogram that attempts to create an artifact from in.