Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xodio/hm-parser
A parser for Hidnley Milner notations
https://github.com/xodio/hm-parser
fp functional-programming hindley-milner parser
Last synced: 7 days ago
JSON representation
A parser for Hidnley Milner notations
- Host: GitHub
- URL: https://github.com/xodio/hm-parser
- Owner: xodio
- Created: 2017-02-12T21:22:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T15:19:56.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T18:22:07.325Z (about 1 month ago)
- Topics: fp, functional-programming, hindley-milner, parser
- Language: JavaScript
- Homepage:
- Size: 60.5 KB
- Stars: 23
- Watchers: 5
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Hindley Milner Parser
=====================This is a parser for Haskell-alike Hindley Milner signatures with some sugar
added to support JS-specific things like methods.It is a drop-in replacement for
[hindley-milner-parser-js](https://github.com/kedashoe/hindley-milner-parser-js)
package which is based on [mona](https://github.com/zkat/mona). Mona has few
problems: it is very slow if used with Mocha test runner and it imports
`babel-polyfill` by hard-code what makes it impossible to use within projects
that use another version of `babel-polyfill`.Usage
-----Install with:
$ yarn add hm-parser
# or
$ npm install hm-parserThen:
```javascript
HMP = require('hm-parser');
HMP.parse('hello :: a -> Maybe a');
// returns:
// {
// name: 'hello',
// constraints: [],
// type:
// {type: 'function', text: '', children: [
// {type: 'typevar', text: 'a', children: []},
// {type: 'typeConstructor', text: 'Maybe', children: [
// {type: 'typevar', text: 'a', children: []}]}]}
```See [tests](test/test.js) for more examples.
License
-------MIT