Coder Social home page Coder Social logo

purescript-argonaut's People

Contributors

chexxor avatar cryogenian avatar davezuch avatar ethul avatar garyb avatar jdegoes avatar joneshf avatar jordanmartinez avatar justinwoo avatar kl0tl avatar kritzcreek avatar ntwilson avatar passy avatar seanparsons avatar sol avatar spicydonuts avatar srghma avatar th-awake avatar thomashoneyman avatar vaibhavsagar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

purescript-argonaut's Issues

break apart argonaut

  • purescript-argonaut-core — Definition of 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.
  • purescript-argonaut-combinators — All the combinators and operators that make using Argonaut easy. These, in turn, are largely defined in terms of the fold methods, but some may be special-cased for performance reasons.
  • purescript-argonaut-serialization — EncodeJson / DecodeJson and instances for the world.
  • purescript-argonaut-zipper — For things like JCursor, JZipper, etc. Maybe there's a better name for this one or maybe it belongs somewhere else.�

Thoughts?

0.7 update

Just wondering if someone is already working on making this compatible with PureScript 0.7?

Update README

Too many people lately have been asking questions about it. It's way out of date, so it should be updated.

Documentation

Great lib! Seems like what i need for my project but find it very hard to use without documentation.

Stack overflow when decoding large arrays

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");
        };
    };
});

errors with 0.9.1

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                                                                                

RangeError: Maximum call stack exceeded for decodeJsonMaybe

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.

stringify :: EncodeJson a => a -> String

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.