generated from tpl/purs
code cleanup. Docs.
This commit is contained in:
parent
413ba101d3
commit
6c6c51320b
14
README.md
14
README.md
@ -2,22 +2,22 @@
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
This repo depends on js-yaml. It is not compatible with YAML 1.1.
|
First install [js-yaml](https://github.com/connec/yaml-js). Note, purescript-yaml is not compatible with YAML 1.1.
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install js-yaml@^3.4.6
|
npm install js-yaml@^3.4.6
|
||||||
```
|
```
|
||||||
If you're using bower, add this repo as a project dependency, e.g.
|
|
||||||
|
Then add purescript-yaml-next as a project dependency.
|
||||||
|
|
||||||
```
|
```
|
||||||
bower install --save git://github.com/dgendill/purescript-yaml#v0.1.0
|
bower install --save purescript-yaml-next
|
||||||
```
|
```
|
||||||
|
|
||||||
Or you can manually add the github repo as a project dependency, e.g.
|
Alternatively, you can add the repo itself as a project dependency, e.g.
|
||||||
|
|
||||||
```
|
```
|
||||||
"dependencies": {
|
bower install --save git://github.com/archaeron/purescript-yaml#tagOrBranch
|
||||||
"purescript-yaml" : git://github.com/dgendill/purescript-yaml#tagOrBranch
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## YAML to Data Type Usage
|
## YAML to Data Type Usage
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "purescript-yaml",
|
"name": "purescript-yaml-next",
|
||||||
"license": "Apache 2.0",
|
"license": "SEE LICENSE FILE",
|
||||||
"repository": "",
|
"repository": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
"contributors": [ ],
|
"contributors": [ ],
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// module Data.YAML.Foreign.Decode
|
|
||||||
|
|
||||||
var yaml = require('js-yaml');
|
var yaml = require('js-yaml');
|
||||||
|
|
||||||
exports.parseYAMLImpl = function(left, right, str)
|
exports.parseYAMLImpl = function(left, right, str) {
|
||||||
{
|
try {
|
||||||
try
|
return right(yaml.safeLoad(str));
|
||||||
{
|
} catch (e) {
|
||||||
return right(yaml.safeLoad(str));
|
return left(e.toString());
|
||||||
}
|
}
|
||||||
catch (e)
|
};
|
||||||
{
|
|
||||||
return left(e.toString());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
Loading…
Reference in New Issue
Block a user