typify-parser
Version:
Type signature parser for typify
56 lines (48 loc) • 1.44 kB
Markdown
# typify type parser
> Type signature parser for typify
[](http://travis-ci.org/phadej/typify-parser)
[](http://badge.fury.io/js/typify-parser)
[](https://david-dm.org/phadej/typify-parser)
[](https://david-dm.org/phadej/typify-parser#info=devDependencies)
[](https://codeclimate.com/github/phadej/typify-parser)
Turns `(foo, bar 42) -> quux` into
```js
{
"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
```js
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']
```