Type signature parser for typify
JavaScript Haskell Makefile Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
hs
lib
test
.eslintrc
.gitignore
.jscsrc
.jshintrc
.npmignore
.travis.yml
LICENSE
Makefile
README.md
package.json
travis-install.sh
travis-script.sh

README.md

typify type parser

Type signature parser for typify

Build Status NPM version Dependency Status devDependency Status Code Climate

Turns (foo, bar 42) -> quux into

{
  "type": "function",
  "arg": {
    "type": "product",
    "args": [
      {
        "type": "ident",
        "value": "foo"
      },
      {
        "type": "application",
        "callee": {
          "type": "ident",
          "value": "bar"
        },
        "args": [
          {
            "type": "number",
            "value": 42
          }
        ]
      }
    ]
  },
  "result": {
    "type": "ident",
    "value": "quux"
  }
}

Synopsis

var parser = require("typify-parser");

// Example from above
var t = parser("(foo, bar 42) -> quux");

// Free vars
p.freeVars(t);                             // ['bar', 'foo', 'quux']
p.freeVars(p("rec list -> () | a & list")) // ['a']