Registry / serialization / morphir-elm

morphir-elm

JSON →
library2.100.0jsnpmunverified

morphir-elm is an NPM package providing a CLI and Elm integration for the Morphir ecosystem (v2.100.0, active development, releases every few weeks). It parses Elm source code into Morphir IR (intermediate representation), enabling transpilation to Scala, TypeScript, and other languages, as well as visualization. Key differentiators: it bridges Elm's type system with FINOS's technology-agnostic Morphir format, supports both NPM and Elm package distribution, and includes a TypeScript SDK for structural equality and Maybe types. Alternatives include custom transpilers, but morphir-elm provides a standardised, multi-language pipeline.

npm install morphir-elm
INSTALL
IMPORT
SIG · MORPHIR-ELM
M
morphir-elm
serializationjavascriptv2.100.0
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.

morphir-elm CLI
npx morphir-elm make -f
npm install -g morphir-elm && morphir-elm make (without -f flag)
The -f flag is recommended as of v2.100.0 to use the old CLI; new CLI may be unstable.
Morphir.IR from Elm package
import Morphir.IR exposing (IR)
import Morphir.IR (IR)
In Elm, use the `exposing` keyword; importing as a named tuple is not valid Elm syntax.
TypeScript SDK
import { equal } from 'morphir-elm/ts-sdk/Basics'
import { equal } from 'morphir-elm'
The TypeScript SDK is provided as a sub-path export under 'morphir-elm/ts-sdk'; top-level import may not exist.

Creates a minimal Elm project, generates Morphir IR JSON via the CLI.

// Create morphir.json { "name": "My.Package", "sourceDirectory": "src", "exposedModules": ["Foo"] } // In terminal: mkdir -p src/My/Package echo "module My.Package.Foo exposing (..)" > src/My/Package/Foo.elm echo "foo = 42" >> src/My/Package/Foo.elm npx morphir-elm make -f -p . -o morphir-ir.json // morphir-ir.json now contains the IR
morphir --version
Debug
Known issues
breakingAs of v2.96.0, CLI subcommand 'make' requires -f flag for old CLI; new CLI may break without it
fix
Use -f flag: morphir-elm make -f
affects: >=2.96.0
deprecatedGulp build system removed in v2.100.0
fix
Use Mise and Bun for building; Gulp scripts no longer available.
affects: >=2.100.0
gotchaThe -f flag is recommended only; new CLI may become default in future breaking change
fix
Monitor releases; update scripts to handle both old and new CLI.
affects: >=2.96.0
gotchaTypeScript SDK exports are under sub-path 'morphir-elm/ts-sdk'; not at top-level
fix
Import from 'morphir-elm/ts-sdk/Basics' etc.
affects: >=2.95.0
deprecatedJest testing removed, replaced with Bun test runner in v2.100.0
fix
Use bun test instead of jest.
affects: >=2.100.0
breakingElm source parsing may fail without morphir.json file; missing config
fix
Ensure morphir.json exists in project directory with required fields.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'morphir-elm'
Using top-level import instead of sub-path
fix
Use import from 'morphir-elm/ts-sdk/...' or install the Elm package.
morphir-elm: command not found
Package not installed globally or not using npx
fix
Use npx morphir-elm or install globally: npm install -g morphir-elm
Error: Unrecognized command: make (use -f flag)
New CLI requires -f flag for old behavior since v2.96.0
fix
Add -f flag: morphir-elm make -f
Error: Module 'My.Package.Foo' not found in sourceDirectory
Missing or mismatched sourceDirectory in morphir.json
fix
Check morphir.json sourceDirectory and ensure Elm files are placed correctly.
Upgrade
Version history
2.100.0latest on npm
Audit
Dependencies
elmoptionalRuntime dependency for Elm compilation (Elm binary required in PATH)
Agent activity
2 hits · last 30 days
node
2
Resources