Skip to content

Problem with psc-bundle #14

Closed
Closed
@menelaos

Description

@menelaos

As mentioned in purescript/purescript#2290, there is a problem with psc-bundle which sometimes removes "dead code" that is actually required.

Steps to reproduce:

  • git clone https://github.com/purescript-contrib/purescript-argonaut-core
  • cd purescript-argonaut-core
  • bower install
  • psc "src/**/*.purs" "bower_components/purescript-*/src/**/*.purs" "test/**/*.purs"
  • psc-bundle "output/**/*.js" --module Test.Main --main Test.Main | node

This will result in a ReferenceError:

        var akeys = objKeys(a);
                    ^

ReferenceError: objKeys is not defined

This issue should probably be fixed in psc-bundle but for the time being the error can be averted by changing the following code in Data/Argonaut/Core.js

function _compare(EQ, GT, LT, a, b) {
  // Body that uses `objKeys`
}
exports._compare = _compare;

to

exports._compare = function _compare (EQ, GT, LT, a, b) {
  // Body that uses `objKeys`
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions