gsh/evaluator/source
The source module provides boilerplate code generation helpers for the evaluator.
When the evaluator constructs a temporary gsh_eval_X.gleam file, it uses
this module to inject hidden standard imports under safely aliased namespaces
(e.g., gsh_internal_string). This prevents variable collisions if a user
explicitly imports the same standard libraries in their REPL session.
Values
pub fn header(with_string: Bool, with_formatter: Bool) -> String
Generates the standard module header and base imports for dynamically generated evaluation files.
Import Injections:
- Always imports
gsh/input/terminalso the injectedgsh_entryfunction can print results while honoring raw-mode formatting. - Formatter (
with_formatter): Conditionally importsgsh/evaluator/formatterundergsh_internal_formatterto process runtime inspect outputs. - String (
with_string): Conditionally importsgleam/stringundergsh_internal_stringto safely stringify expressions without namespace collisions.