0.1.5 • Published 6 years ago

hm-parser v0.1.5

Weekly downloads
33
License
MIT
Repository
github
Last release
6 years ago

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 package which is based on 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-parser

Then:

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 for more examples.

License

MIT

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago