purescript-contrib / purescript-argonaut Goto Github PK
View Code? Open in Web Editor NEWThis project forked from argonaut-io/argonaut-hs
PureScript implementation of argonaut
License: MIT License
This project forked from argonaut-io/argonaut-hs
PureScript implementation of argonaut
License: MIT License
It would be nice if getFieldOptional
was exported from Data.Argonaut
.
This issue depends on purescript-contrib/purescript-argonaut-codecs#33 being merged and released.
Json
, foldJson
, and Eq
, Show
, Ord
, etc., instances for Json
, together with printing and parsing (which are native methods!). This will be a very small library with minimal dependencies, which other libraries can use to agree on what Json
is.Thoughts?
The current version on Pursuit is v5
Just wondering if someone is already working on making this compatible with PureScript 0.7?
Too many people lately have been asking questions about it. It's way out of date, so it should be updated.
Great lib! Seems like what i need for my project but find it very hard to use without documentation.
When decoding a large json array of numbers (~15k), I get a RangeError: Maximum call stack size exceeded.
The problem seems to be with the traverse used in the decodeArray instance. The stack trace points to a function f in Data.Traversable which calls itself recursively:
function (__dict_Applicative_12) {
return function (f) {
return function (_472) {
if (_472.length === 0) {
return Prelude.pure(__dict_Applicative_12)([ ]);
};
if (_472.length >= 1) {
var _2018 = _472.slice(1);
return Prelude["<*>"](__dict_Applicative_12["__superclass_Prelude.Apply_0"]())(Prelude["<$>"]((__dict_Applicative_12["__superclass_Prelude.Apply_0"]())["__superclass_Prelude.Functor_0"]())(Prelude[":"])(f(_472[0])))(traverse(traversableArray)(__dict_Applicative_12)(f)(_2018));
};
throw new Error("Failed pattern match");
};
};
});
@jdegoes I assume this one is going to continue to be active. Do you want to keep this in contrib? Shall I count you as the maintainer?
Revelant: purescript/purescript#1156
Here are the errors I get when trying to compile a project using Argonaut on PS 0.9.1:
[1/5 ErrorParsingModule] bower_components\purescript-argonaut-codecs\src\Data\Argonaut\Combinators.purs:18:9
18 infix 7 :=
Unable to parse module:
unexpected :=
expecting "type", qualifier, identifier or proper name
[2/5 ErrorParsingModule] bower_components\purescript-argonaut-codecs\src\Data\Argonaut\Decode.purs:58:23
58 case find ((tag ==) <<< _.sigConstructor) alts of
Unable to parse module:
unexpected )
expecting expression
[3/5 ErrorParsingModule] bower_components\purescript-argonaut-codecs\src\Data\Argonaut\Encode.purs:37:34
37 SArray thunks -> fromArray (gEncodeJson' <<< (unit #) <$> thunks)
Unable to parse module:
unexpected (
expecting no indentation or end of input
[4/5 ErrorParsingModule] bower_components\purescript-argonaut-core\src\Data\Argonaut\Core.purs:51:8
51 import qualified Data.StrMap as M
Unable to parse module:
unexpected "qualified"
expecting qualifier or module name
[5/5 ErrorParsingModule] bower_components\purescript-argonaut-traversals\src\Data\Argonaut\JCursor.purs:15:8
15 import qualified Data.Array as A
Unable to parse module:
unexpected "qualified"
expecting qualifier or module name
With purescript 0.6.6
the decodeJsonMaybe
instance is blowing the call stack. Looks like the generated JS is calling itself recursively.
var decodeJsonMaybe = function (__dict_DecodeJson_2) {
return new DecodeJson(function (j) {
return Control_Alt["<|>"](Data_Either.altEither)
(decodeJson(decodeJsonMaybe(__dict_DecodeJson_2))(j))
(Prelude.pure(Data_Either.applicativeEither)(Data_Maybe.Nothing.value));
});
};
PR on route for a fix.
It would be much easier to use stringify if it took your type instead of just Json. Currently, it requires encodeJson >>> stringify
.
stringify :: EncodeJson a => a -> String
Needs to be implemented natively. Probably ordering, too.
The Json
type includes these values, however they are not allowed in JSON.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.