Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

RFC: Variant maps

$
0
0

(Rescript tool is now part of v12, so installing v12 beta gives you access to npx rescript-tools)

You could get (limited) typed tree information as JSON via

# requires a build first
npx rescript-tools doc src/Foo.res

gives

{
  "name": "Foo",
  "docstrings": [],
  "source": {
    "filepath": "src/Foo.res",
    "line": 1,
    "col": 1
  },
  "items": [
  {
    "id": "Foo.myVariant",
    "kind": "type",
    "name": "myVariant",
    "signature": "type myVariant = Key1 | Key2",
    "docstrings": [],
    "source": {
      "filepath": "src/Foo.res",
      "line": 1,
      "col": 1
    },
    "detail": 
    {
      "kind": "variant",
      "items": [
      {
        "name": "Key1",
        "docstrings": [],
        "signature": "Key1"
      }, 
      {
        "name": "Key2",
        "docstrings": [],
        "signature": "Key2"
      }]
    }
  }]
}

Viewing all articles
Browse latest Browse all 2592

Trending Articles