reasonml / reasonml/reason

[proposal] using `< >` instead of `()` for type parameters

Open
#1,661 71 comments 23 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Parser RFC
Dominant language
OCaml
Stars
10.3k
Forks
438
PR merge metrics
No merged PRs in 30d

Description

Recently after reading some issues using the syntax v3, I found it's painful to see so may parens.

for example, here is a very simple type, it would be even worse for complex types

(int, Js.nullable(int)) => int

it would be much nicer to write it as

(int, Js.nullable <int>) => int

the same applies to type definitions:

type list <'a> = 
  | Nil
  | Cons of ('a * list <'a>)

The root cause is () used in too many places, I have to count the parens for complex types.
I guess it is okay to use <> in types, in expressions there may be conflicts with comparisons, in type level, should be good?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue proposes using angle brackets instead of parentheses for type parameters in Reason syntax, with examples for nullable types and recursive type definitions. No files, tests, or entry points are named; first review the 71-comment discussion to determine whether the proposal has a settled design, then identify the parser and syntax tests before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.