typify-parser
v1.1.0
Published
Type signature parser for typify
Downloads
249,066
Maintainers
Readme
typify type parser
Type signature parser for typify
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']