code cleanup. Docs.

This commit is contained in:
Dominick Gendill 2017-05-22 09:25:09 -06:00
parent 413ba101d3
commit 6c6c51320b
3 changed files with 16 additions and 22 deletions

View File

@ -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

View File

@ -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": [ ],

View File

@ -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());
}
};