Registry / gren-lang

gren-lang

JSON →
library0.6.5jsnpmunverified

Compiler for the Gren programming language, a pure functional language designed for ease of learning and powerful use. Current stable version is 0.6.5, with an active release cadence. The compiler is split into a Gren frontend and a Haskell backend, with eventual goal of full self-hosting. Differentiators: zero-install package management, task ports, 'gren run' command, and a focus on simplicity.

npm install gren-lang
INSTALL
IMPORT
SIG · GREN-LANG
G
gren-lang
javascriptv0.6.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import Compiler from 'gren-lang'
const Compiler = require('gren-lang')
Package is ESM-only; no CommonJS support.
compile
import { compile } from 'gren-lang/compiler'
Named export for compiling Gren source.
run
import { run } from 'gren-lang'
import { run } from 'gren-lang/run'
The 'run' function is exported from the main package entry.

Compile and execute a Gren file, handling errors and outputting JavaScript.

import { compile, run } from 'gren-lang'; import { readFileSync, writeFileSync } from 'fs'; const source = readFileSync('hello.gren', 'utf8'); const result = compile(source, { optimize: false }); if (result.type === 'error') { console.error(result.errors); process.exit(1); } writeFileSync('output.js', result.code); console.log('Compilation succeeded.'); // To run: run('hello.gren', { args: [] });
gren --version
Debug
Known issues
breakingVersion 0.5.0 replaced 'gren install' with 'gren package install'. Old syntax will fail.
fix
Use 'gren package install' instead of 'gren install'.
affects: <0.5.0
gotchaThe compiler is split into two parts: a Gren frontend and a Haskell backend. Building from source requires both Node.js and Haskell dependencies.
fix
Use the official pre-built binary or follow build instructions with devbox.
affects: >=0.4.0
deprecatedFormatter command was removed in version 0.5.0. Using 'gren format' will error.
fix
Remove formatter usage; format manually or use an external tool.
affects: >=0.5.0
gotchaThe 'gren run' command requires the backend binary. If not found, it may fail silently.
fix
Set GREN_BIN environment variable to the backend executable path if needed.
affects: >=0.6.0
gotchaPackage manager rewritten in Gren in 0.6.0, enabling zero-install packages. However, old package caches may conflict.
fix
Delete old package cache at ~/.gren before upgrading.
affects: >=0.6.0
Errors
Common errors & fixes
error: Could not find module 'ModuleName'
Module not in source files or dependencies.
fix
Ensure the module is exported and imported correctly. Check package.json or gren.json for dependencies.
Type mismatch: expected X but got Y
Function argument type mismatch.
fix
Correct the type of the argument or modify the function signature to match.
error: 'gren install' is not a command. See 'gren --help'.
Using old 'gren install' command.
fix
Use 'gren package install' instead.
fatal: Could not read from stdin. (os error 5)
Running 'gren run' without input redirection on some platforms.
fix
Provide input via file or pipe, or run interactively with terminal.
Upgrade
Version history
0.6.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
gren-lang — npm install gren-lang · libregistry