REFMT(1)
π REFMT(1) β refmt: Reason's Parser & Pretty-printer β¨
Bestie, welcome to the REFMT(1) page from the Refmt Manual β we're talking about refmt, Reason's Parser & Pretty-printer. π«Ά
πΈ NAME πΈ
refmt - Reason's Parser & Pretty-printer. That's the whole vibe. π
β SYNOPSIS β
refmt [OPTION]β¦ [FILENAMES]β¦
π¦ DESCRIPTION π¦
refmt lets you format Reason files, parse them, and convert them between OCaml syntax and Reason syntax. It's giving multitasking icon. β¨
π ARGUMENTS π
FILENAMESβ input files; if empty, assume stdin. No files? It just reads stdin, bestie. π«Ά
β¨ OPTIONS β¨
-e,--assume-explicit-arityβ if a constructor's argument is a tuple, always interpret it as multiple arguments.-h PATH,--heuristics-file=PATHβ load path as a heuristics file to specify which constructors carry a tuple rather than multiple arguments. Mostly used in removing[@implicit_arity]introduced from OCaml conversion. For example,example.txt:containsConstructor1 Constructor2. iykyk π§-i BOOL,--interface=BOOL(absent=false) β parse AST as an interface.--in-placeβ reformat a file in-place. Yes, it edits the file itself. π-p FORM,--print=FORM(absent=re) β print AST in FORM, which is one of:(ml | re (default) | binary (for compiler input) | binary_reason (for interchange between Reason versions) | ast (print human readable AST directly) | none).--parse=FORMβ parse AST in FORM, which is one of:(ml | re | binary (for compiler input) | binary_reason (for interchange between Reason versions)).-r,--recoverableβ enable recoverable parser.-w COLS,--print-width=COLS(absent=80orREFMT_PRINT_WIDTHenv) β wrapping width for printing the AST.
π COMMON OPTIONS π
--help[=FMT](default=auto) β Show this help in format FMT. The value FMT must be one ofauto,pager,grofforplain. Withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. Very demure, very mindful help behavior. β¨--versionβ Show version information.
π₯ EXIT STATUS π₯
refmt exits with:
0β on success. π123β on indiscriminate errors reported on standard error.124β on command line parsing errors.125β on unexpected internal errors (bugs). Bugs? Not the vibe. π
π ENVIRONMENT π
These environment variables affect the execution of refmt:
REFMT_PRINT_WIDTHβ wrapping width for printing the AST.
π EXAMPLES π
- Initialise a new project named
foo:
dune init project foo
- Format a Reason implementation file:
refmt file.re
- Format a Reason interface file:
refmt file.rei
- Format interface code from the command line:
echo 'let x: int' | refmt --interface=true
- Convert an OCaml file to Reason:
refmt file.ml
- Convert a Reason file to OCaml:
refmt file.re --print ml
- Convert OCaml from the command line to Reason:
echo 'let x = 1' | refmt --parse ml
That's the whole REFMT(1) moment, bestie. Source/version: Refmt Reason 3.18.0, date marker: @, page id: REFMT(1). Byeee π«Άβ¨
π¦ where this page comes from
- nixos 26.05: ocaml5.4.1-reason 3.18.0
- nixpkgs unstable: ocaml5.5.1-reason 3.18.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms