{"id":25657,"library":"gren-lang","title":"Gren Compiler","description":"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.","status":"active","version":"0.6.5","language":"javascript","source_language":"en","source_url":"https://github.com/gren-lang/compiler","tags":["javascript","gren","lang","language","compiler","functional","programming"],"install":[{"cmd":"npm install gren-lang","lang":"bash","label":"npm"},{"cmd":"yarn add gren-lang","lang":"bash","label":"yarn"},{"cmd":"pnpm add gren-lang","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is ESM-only; no CommonJS support.","wrong":"const Compiler = require('gren-lang')","symbol":"default","correct":"import Compiler from 'gren-lang'"},{"note":"Named export for compiling Gren source.","symbol":"compile","correct":"import { compile } from 'gren-lang/compiler'"},{"note":"The 'run' function is exported from the main package entry.","wrong":"import { run } from 'gren-lang/run'","symbol":"run","correct":"import { run } from 'gren-lang'"}],"quickstart":{"code":"import { compile, run } from 'gren-lang';\nimport { readFileSync, writeFileSync } from 'fs';\n\nconst source = readFileSync('hello.gren', 'utf8');\nconst result = compile(source, { optimize: false });\nif (result.type === 'error') {\n  console.error(result.errors);\n  process.exit(1);\n}\nwriteFileSync('output.js', result.code);\nconsole.log('Compilation succeeded.');\n\n// To run:\nrun('hello.gren', { args: [] });\n","lang":"typescript","description":"Compile and execute a Gren file, handling errors and outputting JavaScript."},"warnings":[{"fix":"Use 'gren package install' instead of 'gren install'.","message":"Version 0.5.0 replaced 'gren install' with 'gren package install'. Old syntax will fail.","severity":"breaking","affected_versions":"<0.5.0"},{"fix":"Use the official pre-built binary or follow build instructions with devbox.","message":"The compiler is split into two parts: a Gren frontend and a Haskell backend. Building from source requires both Node.js and Haskell dependencies.","severity":"gotcha","affected_versions":">=0.4.0"},{"fix":"Remove formatter usage; format manually or use an external tool.","message":"Formatter command was removed in version 0.5.0. Using 'gren format' will error.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Set GREN_BIN environment variable to the backend executable path if needed.","message":"The 'gren run' command requires the backend binary. If not found, it may fail silently.","severity":"gotcha","affected_versions":">=0.6.0"},{"fix":"Delete old package cache at ~/.gren before upgrading.","message":"Package manager rewritten in Gren in 0.6.0, enabling zero-install packages. However, old package caches may conflict.","severity":"gotcha","affected_versions":">=0.6.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure the module is exported and imported correctly. Check package.json or gren.json for dependencies.","cause":"Module not in source files or dependencies.","error":"error: Could not find module 'ModuleName'"},{"fix":"Correct the type of the argument or modify the function signature to match.","cause":"Function argument type mismatch.","error":"Type mismatch: expected X but got Y"},{"fix":"Use 'gren package install' instead.","cause":"Using old 'gren install' command.","error":"error: 'gren install' is not a command. See 'gren --help'."},{"fix":"Provide input via file or pipe, or run interactively with terminal.","cause":"Running 'gren run' without input redirection on some platforms.","error":"fatal: Could not read from stdin. (os error 5)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}