# LLM Prompt for Documentation ## Documentation ### SSG #### files! **Type Annotation** ```roc Path => Result (List Files) [FilesError Str] ``` #### parse_markdown! **Type Annotation** ```roc Path => Result Str [ParseError Str] ``` #### write_file! **Type Annotation** ```roc { output_dir : Path, relpath : RelPath, content : Str } => Result {} [WriteError Str] ``` ### Types #### Path **Type Annotation** #### path_to_str **Type Annotation** ```roc Path -> Str ``` #### RelPath **Type Annotation** #### rel_path_to_str **Type Annotation** ```roc RelPath -> Str ``` #### to_rel_path **Type Annotation** ```roc Str -> RelPath ``` #### Args **Type Annotation** #### Files **Type Annotation** ### Cmd #### Cmd **Type Annotation** **Description** Represents a command to be executed in a child process. #### Output **Type Annotation** **Description** Represents the output of a command. #### new **Type Annotation** ```roc Str -> Cmd ``` **Description** Create a new command to execute the given program in a child process. #### arg **Type Annotation** ```roc Cmd, Str -> Cmd ``` **Description** Add a single argument to the command. ! Shell features like variable subsitition (e.g. `$FOO`), glob patterns (e.g. `*.txt`), ... are not available. ``` # Represent the command "ls -l" Cmd.new("ls") |> Cmd.arg("-l") ``` #### args **Type Annotation** ```roc Cmd, List Str -> Cmd ``` **Description** Add multiple arguments to the command. ! Shell features like variable subsitition (e.g. `$FOO`), glob patterns (e.g. `*.txt`), ... are not available. ``` # Represent the command "ls -l -a" Cmd.new("ls") |> Cmd.args(["-l", "-a"]) ``` #### env **Type Annotation** ```roc Cmd, Str, Str -> Cmd ``` **Description** Add a single environment variable to the command. ``` # Run "env" and add the environment variable "FOO" with value "BAR" Cmd.new("env") |> Cmd.env("FOO", "BAR") ``` #### envs **Type Annotation** ```roc Cmd, List ( Str, Str ) -> Cmd ``` **Description** Add multiple environment variables to the command. ``` # Run "env" and add the variables "FOO" and "BAZ" Cmd.new("env") |> Cmd.envs([("FOO", "BAR"), ("BAZ", "DUCK")]) ``` #### clear_envs **Type Annotation** ```roc Cmd -> Cmd ``` **Description** Clear all environment variables, and prevent inheriting from parent, only the environment variables provided to command are available to the child. ``` # Represents "env" with only "FOO" environment variable set Cmd.new("env") |> Cmd.clear_envs |> Cmd.env("FOO", "BAR") ``` #### output! **Type Annotation** ```roc Cmd => Output ``` **Description** Execute command and capture stdout and stderr > Stdin is not inherited from the parent and any attempt by the child process > to read from the stdin stream will result in the stream immediately closing. #### status! **Type Annotation** ```roc Cmd => Result I32 [CmdStatusErr InternalIOErr.IOErr] ``` **Description** Execute command and inherit stdin, stdout and stderr from parent #### exec! **Type Annotation** ```roc Str, List Str => Result {} [CmdStatusErr InternalIOErr.IOErr] ``` **Description** Execute command and inherit stdin, stdout and stderr from parent ``` # Call echo to print "hello world" Cmd.exec!("echo", ["hello world"]) ``` ### Stdout #### Err **Type Annotation** **Description** **NotFound** - An entity was not found, often a file. **PermissionDenied** - The operation lacked the necessary privileges to complete. **BrokenPipe** - The operation failed because a pipe was closed. **AlreadyExists** - An entity already exists, often a file. **Interrupted** - This operation was interrupted. Interrupted operations can typically be retried. **Unsupported** - This operation is unsupported on this platform. This means that the operation can never succeed. **OutOfMemory** - An operation could not be completed, because it failed to allocate enough memory. **Other** - A custom error that does not fall under any other I/O error kind. #### line! **Type Annotation** ```roc Str => Result {} [StdoutErr Err] ``` **Description** Write the given string to [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)), followed by a newline. > To write to `stdout` without the newline, see [Stdout.write!]. #### write! **Type Annotation** ```roc Str => Result {} [StdoutErr Err] ``` **Description** Write the given string to [standard output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout)). Note that many terminals will not actually display strings that are written to them until they receive a newline, so this may appear to do nothing until you write a newline! > To write to `stdout` with a newline at the end, see [Stdout.line!]. ### Stderr #### Err **Type Annotation** **Description** **NotFound** - An entity was not found, often a file. **PermissionDenied** - The operation lacked the necessary privileges to complete. **BrokenPipe** - The operation failed because a pipe was closed. **AlreadyExists** - An entity already exists, often a file. **Interrupted** - This operation was interrupted. Interrupted operations can typically be retried. **Unsupported** - This operation is unsupported on this platform. This means that the operation can never succeed. **OutOfMemory** - An operation could not be completed, because it failed to allocate enough memory. **Other** - A custom error that does not fall under any other I/O error kind. #### line! **Type Annotation** ```roc Str => Result {} [StderrErr Err] ``` **Description** Write the given string to [standard error](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)), followed by a newline. > To write to `stderr` without the newline, see [Stderr.write!]. #### write! **Type Annotation** ```roc Str => Result {} [StderrErr Err] ``` **Description** Write the given string to [standard error](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr)). Most terminals will not actually display strings that are written to them until they receive a newline, so this may appear to do nothing until you write a newline! > To write to `stderr` with a newline at the end, see [Stderr.line!]. ### Env #### var! **Type Annotation** ```roc Str => Result Str [VarNotFound] ``` **Description** Reads the given environment variable. If the value is invalid Unicode, the invalid parts will be replaced with the [Unicode replacement character](https://unicode.org/glossary/#replacement_character) ('�'). #### decode! **Type Annotation** ```roc Str => Result val [ VarNotFound, DecodeErr DecodeError ] where val implements Decoding ``` **Description** Reads the given environment variable and attempts to decode it. The type being decoded into will be determined by type inference. For example, if this ends up being used like a `Task U16 _` then the environment variable will be decoded as a string representation of a `U16`. Trying to decode into any other type will fail with a `DecodeErr`. Supported types include; - Strings, - Numbers, as long as they contain only numeric digits, up to one `.`, and an optional `-` at the front for negative numbers, and - Comma-separated lists (of either strings or numbers), as long as there are no spaces after the commas. For example, consider we want to decode the environment variable `NUM_THINGS`; ``` # Reads "NUM_THINGS" and decodes into a U16 getU16Var : Str -> Task U16 [VarNotFound, DecodeErr DecodeError] [Read [Env]] getU16Var = \var -> Env.decode! var ``` If `NUM_THINGS=123` then `getU16Var` succeeds with the value of `123u16`. However if `NUM_THINGS=123456789`, then `getU16Var` will fail with [DecodeErr](https://www.roc-lang.org/builtins/Decode#DecodeError) because `123456789` is too large to fit in a [U16](https://www.roc-lang.org/builtins/Num#U16). #### dict! **Type Annotation** ```roc {} => Dict Str Str ``` **Description** Reads all the process's environment variables into a [Dict]. If any key or value contains invalid Unicode, the [Unicode replacement character](https://unicode.org/glossary/#replacement_character) will be used in place of any parts of keys or values that are invalid Unicode. #### platform! **Type Annotation** ```roc {} => { arch : ARCH, os : OS } ``` **Description** Returns the current Achitecture and Operating System. `ARCH : [X86, X64, ARM, AARCH64, OTHER Str]` `OS : [LINUX, MACOS, WINDOWS, OTHER Str]` Note these values are constants from when the platform is built. ### Locale #### get! **Type Annotation** ```roc {} => Result Str [NotAvailable] ``` **Description** Returns the most preferred locale for the system or application, or `NotAvailable` if the locale could not be obtained. The returned [Str] is a BCP 47 language tag, like `en-US` or `fr-CA`. #### all! **Type Annotation** ```roc {} => List Str ``` **Description** Returns the preferred locales for the system or application. The returned [Str] are BCP 47 language tags, like `en-US` or `fr-CA`. ### Utc #### Utc **Type Annotation** **Description** Stores a timestamp as nanoseconds since UNIX EPOCH #### now! **Type Annotation** ```roc {} => Utc ``` **Description** Duration since UNIX EPOCH #### to_millis_since_epoch **Type Annotation** ```roc Utc -> I128 ``` **Description** Convert Utc timestamp to milliseconds #### from_millis_since_epoch **Type Annotation** ```roc I128 -> Utc ``` **Description** Convert milliseconds to Utc timestamp #### to_nanos_since_epoch **Type Annotation** ```roc Utc -> I128 ``` **Description** Convert Utc timestamp to nanoseconds #### from_nanos_since_epoch **Type Annotation** ```roc I128 -> Utc ``` **Description** Convert nanoseconds to Utc timestamp #### delta_as_millis **Type Annotation** ```roc Utc, Utc -> U128 ``` **Description** Calculate milliseconds between two Utc timestamps #### delta_as_nanos **Type Annotation** ```roc Utc, Utc -> U128 ``` **Description** Calculate nanoseconds between two Utc timestamps #### to_iso_8601 **Type Annotation** ```roc Utc -> Str ``` **Description** Convert Utc timestamp to ISO 8601 string Example: 2023-11-14T23:39:39Z