# reasonml/reason

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/reasonml-reason).**

10,313 stars · 435 forks · OCaml · MIT

## Links

- GitHub: https://github.com/reasonml/reason
- Homepage: http://reasonml.github.io
- awesome-repositories: https://awesome-repositories.com/repository/reasonml-reason.md

## Topics

`javascript` `ocaml` `programming-language` `reason` `reasonml`

## Description

Reason is a strongly typed functional language and multi-target compiler designed to produce either JavaScript for web environments or native machine code for operating systems. It serves as an OCaml-compatible language that shares an abstract syntax tree with OCaml, providing a practical syntax for the OCaml ecosystem.

The project functions as a type-safe frontend language, incorporating JSX support to build user interfaces through structural elements that translate into type-safe function calls. It enables deep integration with the JavaScript ecosystem, allowing the use of existing libraries and packages within a statically typed environment.

The language provides a comprehensive functional programming toolkit, including immutable data, pattern matching with exhaustiveness checking, and a nominal type system. It covers broad capability areas such as asynchronous programming, module system extensibility via functors, and the definition of sum types and generic types to ensure compile-time safety.

The toolset includes a command line interface for source code formatting and a read-evaluate-print loop for interactive code execution.

## Tags

### Part of an Awesome List

- [Functional Programming](https://awesome-repositories.com/f/awesome-lists/devtools/functional-programming.md) — Implements a full functional programming paradigm featuring immutability, pattern matching, and higher-order functions.
- [Code Formatting](https://awesome-repositories.com/f/awesome-lists/devtools/code-formatting.md) — Includes a command line tool for automated source code formatting to ensure consistent style. ([source](https://reasonml.github.io/docs/en/editor-plugins))

### Programming Languages & Runtimes

- [Source-to-JavaScript Transpilers](https://awesome-repositories.com/f/programming-languages-runtimes/javascript-transpilers/source-to-javascript-transpilers.md) — Acts as a source-to-JavaScript transpiler, transforming strongly typed functional code into optimized JavaScript. ([source](https://reasonml.github.io/docs/en/what-and-why))
- [Multi-Target Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-compilers/multi-target-compilers.md) — Ships a multi-target compilation pipeline that produces either JavaScript for the web or native machine code for operating systems.
- [Static Type Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/static-type-definitions.md) — Provides a strong static type system to prevent runtime errors and ensure code correctness. ([source](https://reasonml.github.io/docs/en/syntax-cheatsheet))
- [Type-Safe Frontend Languages](https://awesome-repositories.com/f/programming-languages-runtimes/type-safe-frontend-languages.md) — Serves as a type-safe frontend language with JSX support to build user interfaces with compile-time guarantees.
- [Algebraic Data Types](https://awesome-repositories.com/f/programming-languages-runtimes/algebraic-data-types.md) — Provides native language support for sum types and variants to model complex data structures with compile-time safety.
- [Built-in Data Collections](https://awesome-repositories.com/f/programming-languages-runtimes/built-in-data-collections.md) — Ships standard built-in collections including lists, arrays, sets, and maps. ([source](https://reasonml.github.io/api/index))
- [Conditional Logic](https://awesome-repositories.com/f/programming-languages-runtimes/conditional-logic.md) — Implements fundamental conditional logic and boolean expressions to control program execution flow. ([source](https://reasonml.github.io/docs/en/primitives))
- [Function Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/function-definitions.md) — Provides the fundamental ability to define reusable logic blocks as functions. ([source](https://reasonml.github.io/docs/en/function))
- [Recursive Type Definitions](https://awesome-repositories.com/f/programming-languages-runtimes/function-definitions/recursive-type-definitions.md) — Enables the definition of recursive types to build self-referencing structures like trees and linked lists. ([source](https://reasonml.github.io/docs/en/recursion))
- [Functional Programming Logic](https://awesome-repositories.com/f/programming-languages-runtimes/functional-programming-logic.md) — Enables a full functional workflow using immutable data, partial application, and recursive logic. ([source](https://reasonml.github.io/docs/en/overview))
- [Functor-Based Module Composition](https://awesome-repositories.com/f/programming-languages-runtimes/functor-based-module-composition.md) — Implements a powerful module system allowing the dynamic generation of modules via functors. ([source](https://reasonml.github.io/docs/en/module))
- [Generic Types](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types.md) — Implements generic types to create flexible, type-safe structures that work across different data types. ([source](https://reasonml.github.io/docs/en/type))
- [Heterogeneous Collections](https://awesome-repositories.com/f/programming-languages-runtimes/heterogeneous-collections.md) — Provides tuples and records to group multiple values of different types together. ([source](https://reasonml.github.io/docs/en/basic-structures))
- [Immutable Variables](https://awesome-repositories.com/f/programming-languages-runtimes/immutable-variables.md) — Uses immutable bindings by default to ensure data consistency and predictability. ([source](https://reasonml.github.io/docs/en/let-binding))
- [In-Memory Data Structures](https://awesome-repositories.com/f/programming-languages-runtimes/in-memory-data-structures.md) — Provides built-in support for defining and using in-memory data structures like records and variants. ([source](https://reasonml.github.io/docs/en/record))
- [Language Ecosystems and Tooling](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling.md) — Integrates deeply with the OCaml ecosystem's tools, package managers, and build systems. ([source](https://reasonml.github.io/docs/en/what-and-why))
- [Module Interface Exports](https://awesome-repositories.com/f/programming-languages-runtimes/language-ecosystems-tooling/module-management/module-systems/synchronous-module-loaders/module-interface-exports.md) — Enables the definition of strict module interfaces to encapsulate internal implementations and expose specific functionality. ([source](https://reasonml.github.io/docs/en/module))
- [Exhaustiveness Checks](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/union-types/discriminated-unions/exhaustiveness-checks.md) — Provides compile-time validation to ensure every possible variant of a sum type is handled in match statements.
- [Type-Safe Data Structures](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/union-types/type-safe-variants/type-safe-data-structures.md) — Supports the creation of type-safe records, variants, and generic types for robust data modeling. ([source](https://reasonml.github.io/docs/en/overview))
- [Sum Types](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/sum-types.md) — Provides sum types to model data as one of several distinct variations with associated data. ([source](https://reasonml.github.io/docs/en/variant))
- [Compile-Time Type Inference](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/variable-type-declarations/compile-time-type-inference.md) — Features compile-time type inference to automatically determine variable types from initializers. ([source](https://reasonml.github.io/docs/en/type))
- [Type Safety](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-safety.md) — Enforces strict type safety during compilation to prevent runtime errors and ensure data integrity. ([source](https://reasonml.github.io/docs/en/type))
- [Nominal Type Systems](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-safety/end-to-end/type-safety/nominal-type-systems.md) — Ensures type safety by requiring explicit name matches for records rather than relying on structural similarity.
- [Native Machine Code Compilation](https://awesome-repositories.com/f/programming-languages-runtimes/native-machine-code-compilation.md) — Produces bare-metal machine executables that run directly on a host operating system. ([source](https://reasonml.github.io/docs/en/what-and-why))
- [OCaml-Based Syntaxes](https://awesome-repositories.com/f/programming-languages-runtimes/ocaml-based-syntaxes.md) — Shares an abstract syntax tree with OCaml to maintain compatibility and interoperability with its ecosystem.
- [OCaml Ecosystem Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/ocaml-ecosystem-compilers.md) — Leverages the OCaml abstract syntax tree and tooling to provide a practical functional language.
- [Pattern Destructuring](https://awesome-repositories.com/f/programming-languages-runtimes/pattern-destructuring.md) — Provides concise syntax to unpack values from records and variants directly into variables. ([source](https://reasonml.github.io/docs/en/destructuring))
- [Pattern Matching](https://awesome-repositories.com/f/programming-languages-runtimes/pattern-matching.md) — Implements comprehensive pattern matching for evaluating data shapes and ensuring logic exhaustiveness. ([source](https://reasonml.github.io/docs/en/overview))
- [Runtime Exception Handling](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-exception-handling.md) — Provides a native mechanism for defining, throwing, and catching exceptions to recover program flow. ([source](https://reasonml.github.io/docs/en/exception))
- [Source Code Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-compilers.md) — Translates strongly typed functional source code into optimized JavaScript for web and server environments. ([source](https://reasonml.github.io/docs/en/compiling-to-js-with-melange))
- [Strongly-Typed Languages](https://awesome-repositories.com/f/programming-languages-runtimes/strongly-typed-languages.md) — Uses a rigorous type system to catch logic errors at compile time through a strongly-typed nominal system.
- [Structural Pattern Matching](https://awesome-repositories.com/f/programming-languages-runtimes/structural-pattern-matching.md) — Ships powerful structural pattern matching to execute conditional logic based on data shapes. ([source](https://reasonml.github.io/docs/en/pattern-matching))
- [Abstract Syntax Tree Translations](https://awesome-repositories.com/f/programming-languages-runtimes/abstract-syntax-tree-translations.md) — Translates source code into multiple target languages by leveraging a shared abstract syntax tree.
- [Block Parameter Unpacking](https://awesome-repositories.com/f/programming-languages-runtimes/block-parameter-unpacking.md) — Supports destructuring complex data structures directly into variables during parameter definitions. ([source](https://reasonml.github.io/docs/en/pattern-matching))
- [Lazy Evaluation](https://awesome-repositories.com/f/programming-languages-runtimes/deferred-execution/lazy-evaluation.md) — Implements lazy evaluation techniques to defer complex computations until their results are required. ([source](https://reasonml.github.io/api/index))
- [Foreign Function Signatures](https://awesome-repositories.com/f/programming-languages-runtimes/foreign-function-signatures.md) — Defines type signatures for functions written in other languages to execute code outside the primary runtime. ([source](https://reasonml.github.io/docs/en/external))
- [Default Arguments](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/default-arguments.md) — Provides default arguments to allow callers to omit optional parameters. ([source](https://reasonml.github.io/docs/en/function))
- [Partial Application](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing/partial-application.md) — Implements partial application to create specialized functions by pre-filling a subset of arguments. ([source](https://reasonml.github.io/docs/en/function))
- [Function Chaining](https://awesome-repositories.com/f/programming-languages-runtimes/function-chaining.md) — Ships a pipe operator to chain function calls for cleaner and more readable functional logic. ([source](https://reasonml.github.io/docs/en/pipe-first))
- [Function Currying](https://awesome-repositories.com/f/programming-languages-runtimes/function-currying.md) — Implements compiler-level optimizations for curried functions to reduce memory overhead during partial application.
- [Match Guards](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/control-flow/pattern-matching/match-guard-filtering/ast-condition-filters/match-guards.md) — Allows adding boolean requirements to match cases to refine conditional logic execution. ([source](https://reasonml.github.io/docs/en/pattern-matching))
- [Type Aliases](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/type-aliases.md) — Allows assigning meaningful names to complex type definitions for improved readability. ([source](https://reasonml.github.io/docs/en/type))
- [Type Encapsulation](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/type-system-tools/type-definitions/type-aliases/opaque/type-encapsulation.md) — Supports type encapsulation to hide internal implementation details from external API users. ([source](https://reasonml.github.io/docs/en/type))
- [Foreign Function Interfaces](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/foreign-function-interfaces.md) — Provides binding layers to enable seamless communication between the language and external native libraries or JavaScript.
- [External Library Integrations](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/native-c-interoperability/external-library-integrations.md) — Allows integration of external libraries and packages from the broader ecosystem to extend functionality. ([source](https://reasonml.github.io/docs/en/libraries))
- [Module Functors](https://awesome-repositories.com/f/programming-languages-runtimes/module-functors.md) — Enables dynamic creation of modules by passing existing modules as arguments via functors.
- [Module Organization](https://awesome-repositories.com/f/programming-languages-runtimes/module-organization.md) — Organizes code into named modules and namespaces to manage scope and facilitate code splitting. ([source](https://reasonml.github.io/docs/en/module))
- [Mutable Data State Management](https://awesome-repositories.com/f/programming-languages-runtimes/mutable-data-state-management.md) — Provides primitives for managing mutable state via wrap-around references. ([source](https://reasonml.github.io/docs/en/mutable-bindings))
- [Mutually Recursive Module Systems](https://awesome-repositories.com/f/programming-languages-runtimes/mutually-recursive-module-systems.md) — Allows the definition of mutually recursive modules to resolve interdependent circular dependencies. ([source](https://reasonml.github.io/docs/en/recursion))
- [Record Field Access](https://awesome-repositories.com/f/programming-languages-runtimes/record-field-access.md) — Allows intuitive retrieval of values from data records using standard dot notation. ([source](https://reasonml.github.io/docs/en/record))
- [Pattern-Based Exception Handling](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-exception-handling/pattern-based-exception-handling.md) — Enables matching raised exceptions against patterns to implement precise error recovery logic. ([source](https://reasonml.github.io/docs/en/pattern-matching))
- [Runtime Memory Management](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-memory-management.md) — Includes capabilities for managing atomic references and monitoring memory management statistics. ([source](https://reasonml.github.io/api/index))
- [Named Argument Invocations](https://awesome-repositories.com/f/programming-languages-runtimes/type-methods/named-argument-invocations.md) — Supports named argument invocations to improve call-site clarity and allow flexible argument ordering. ([source](https://reasonml.github.io/docs/en/function))
- [Object Types](https://awesome-repositories.com/f/programming-languages-runtimes/user-defined-types/object-types.md) — Allows the grouping of named values and methods into structured object types. ([source](https://reasonml.github.io/docs/en/object))
- [Variable Scope Controls](https://awesome-repositories.com/f/programming-languages-runtimes/variable-scope-controls.md) — Manages variable visibility and lifetime using block-level scoping. ([source](https://reasonml.github.io/docs/en/let-binding))
- [Variable Shadowing](https://awesome-repositories.com/f/programming-languages-runtimes/variable-shadowing.md) — Implements variable shadowing to allow redefining names in nested scopes for a functional approach to state. ([source](https://reasonml.github.io/docs/en/let-binding))

### Data & Databases

- [General Recursive Functions](https://awesome-repositories.com/f/data-databases/data-transformation-functions/recursive-processors/recursive-logic-implementations/general-recursive-functions.md) — Supports the creation of recursive functions to handle repeating logic and complex data structures. ([source](https://reasonml.github.io/docs/en/recursion))
- [Immutable Field Setters](https://awesome-repositories.com/f/data-databases/database-record-management/record-updates/immutable-field-setters.md) — Supports immutable record updates by creating new copies of data with modified fields. ([source](https://reasonml.github.io/docs/en/record))
- [Sequence Implementations](https://awesome-repositories.com/f/data-databases/ordered-collection-management/ordered-collection-manipulations/sequence-implementations.md) — Implements immutable singly-linked lists and mutable fixed-size arrays for ordered data storage. ([source](https://reasonml.github.io/docs/en/basic-structures))

### Development Tools & Productivity

- [Text String Manipulation Utilities](https://awesome-repositories.com/f/development-tools-productivity/developer-utilities-libraries/programming-logic-libraries/text-string-manipulation-utilities.md) — Includes comprehensive primitives for creating, joining, and processing text strings. ([source](https://reasonml.github.io/docs/en/primitives))
- [Language Server Protocol Integrations](https://awesome-repositories.com/f/development-tools-productivity/language-server-protocol-integrations.md) — Provides IDE support including type-driven autocomplete, syntax highlighting, and jump-to-definition. ([source](https://reasonml.github.io/docs/en/editor-plugins))
- [Type Hover Information](https://awesome-repositories.com/f/development-tools-productivity/type-hover-information.md) — Provides real-time type information and error highlighting within the development editor. ([source](https://reasonml.github.io/docs/en/editor-plugins))

### Mobile Development

- [Cross-Platform Application Development](https://awesome-repositories.com/f/mobile-development/cross-platform-application-development.md) — Allows a single codebase to be compiled for both web browsers and native operating systems.

### Software Engineering & Architecture

- [Immutable Data Patterns](https://awesome-repositories.com/f/software-engineering-architecture/immutable-data-patterns.md) — Prioritizes data integrity through architectural patterns that create updated copies of records instead of mutating memory.
- [Integer Arithmetic](https://awesome-repositories.com/f/software-engineering-architecture/integer-arithmetic.md) — Provides fundamental integer arithmetic operations using platform-specific bit widths. ([source](https://reasonml.github.io/docs/en/primitives))
- [Module Factory Patterns](https://awesome-repositories.com/f/software-engineering-architecture/module-factory-patterns.md) — Provides module factory patterns via functors to create parameterized and isolated module instances. ([source](https://reasonml.github.io/docs/en/overview))
- [Optional Value Types](https://awesome-repositories.com/f/software-engineering-architecture/optional-value-types.md) — Uses Option types to explicitly represent the presence or absence of values, eliminating null-pointer exceptions. ([source](https://reasonml.github.io/docs/en/syntax-cheatsheet))
- [Nominal Type Distinctions](https://awesome-repositories.com/f/software-engineering-architecture/typescript-type-definitions/schema-driven-type-inference/branded-types/nominal-type-distinctions.md) — Implements a nominal type system that distinguishes records by their name rather than their structure. ([source](https://reasonml.github.io/docs/en/record))
- [Asynchronous Operation Execution](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-operation-execution.md) — Coordinates deferred computations and asynchronous tasks using promises to maintain non-blocking execution. ([source](https://reasonml.github.io/docs/en/promise))
- [Source-to-Source Translation](https://awesome-repositories.com/f/software-engineering-architecture/syntax-tree-analysis/source-to-source-translation.md) — Translates source code between different languages by leveraging a shared abstract syntax tree. ([source](https://reasonml.github.io/docs/en/refmt))

### User Interface & Experience

- [JSX Syntax Support](https://awesome-repositories.com/f/user-interface-experience/component-utilities/ui-frameworks/rendering-models/jsx-syntax-extensions/jsx-syntax-support.md) — Implements JSX syntax support for building user interfaces via structural elements and children. ([source](https://reasonml.github.io/docs/en/syntax-cheatsheet))
- [UI Component Definitions](https://awesome-repositories.com/f/user-interface-experience/ui-component-definitions.md) — Supports defining UI components using a JSX-like syntax that translates into type-safe function calls. ([source](https://reasonml.github.io/docs/en/jsx))

### Web Development

- [JavaScript Library Integrations](https://awesome-repositories.com/f/web-development/javascript-library-integrations.md) — Integrates with the JavaScript ecosystem by allowing the import and use of standard JS packages within a typed environment. ([source](https://reasonml.github.io/docs/en/interop))
- [Type-Safe Web Frameworks](https://awesome-repositories.com/f/web-development/type-safe-web-frameworks.md) — Provides a strongly typed environment for frontend development to prevent runtime errors in JavaScript targets.
- [Type-Safe UI Frameworks](https://awesome-repositories.com/f/web-development/type-safe-ui-frameworks.md) — Uses a JSX-like syntax to build type-safe user interface components.

### Operating Systems & Systems Programming

- [Mutable References](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/memory-safety-and-semantics/mutable-references.md) — Provides mutable references to allow values to be changed after their initial binding. ([source](https://reasonml.github.io/docs/en/let-binding))
