Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
68a1e47
add node stuff to gitignore
shmish111 May 10, 2019
736a8dd
rebase upstream master and add spago
shmish111 Aug 14, 2020
090a0c9
add List decode/encode
shmish111 Aug 14, 2020
f34d0c3
encode/decode tuple using array as this is what is normally done
shmish111 Aug 14, 2020
9fcc6ee
encode/decode Map using array of tuples, not sure there is another way
shmish111 Aug 14, 2020
fd7f49f
encode/decode Set using array
shmish111 Aug 14, 2020
d356fd2
upgrade purs
shmish111 Aug 17, 2020
db3685a
use spago in travis
shmish111 Aug 17, 2020
e9064e2
Adding a roundtrip test for Map.
krisajenkins Sep 3, 2020
26bc66f
More flexible Map decoding.
krisajenkins Sep 3, 2020
401b78b
Merge pull request #1 from krisajenkins/fix-map
shmish111 Sep 3, 2020
16989ec
Adding encoders/decoders for Either.
krisajenkins Sep 3, 2020
c3c6431
Merge pull request #2 from krisajenkins/add-either
shmish111 Sep 3, 2020
1e0b95f
Adding Data.BigInt support.
krisajenkins Sep 3, 2020
3d70577
Merge pull request #3 from shmish111/add-big-ints
shmish111 Sep 3, 2020
ecd14ae
Adding a shell.nix file, for a repeatable env.
krisajenkins Sep 3, 2020
b01fe37
Merge pull request #4 from shmish111/nix-shell
shmish111 Sep 3, 2020
b77bf99
Adding extra map-decoding tests.
krisajenkins Sep 4, 2020
4963d86
Improving the resiliency of BigInt decoding.
krisajenkins Sep 4, 2020
bd0a108
Improved encoding/decoding for big integers.
krisajenkins Sep 8, 2020
1f6a328
Moving to a more formal test suite.
krisajenkins Sep 11, 2020
a2c5a0d
BigInteger support.
krisajenkins Sep 10, 2020
695e30b
Refactoring the test suite.
krisajenkins Sep 17, 2020
f5b1c43
Fixing a bug with aeson-style encoding on nested sum types.
krisajenkins Sep 17, 2020
57692ed
Simplifying a fromMaybe clause.
krisajenkins Sep 17, 2020
c7cb623
add node stuff to gitignore
shmish111 May 10, 2019
9054539
rebase upstream master and add spago
shmish111 Aug 14, 2020
57539e7
add List decode/encode
shmish111 Aug 14, 2020
209e040
encode/decode tuple using array as this is what is normally done
shmish111 Aug 14, 2020
33f2a7f
encode/decode Map using array of tuples, not sure there is another way
shmish111 Aug 14, 2020
60a7a0f
encode/decode Set using array
shmish111 Aug 14, 2020
0b95402
upgrade purs
shmish111 Aug 17, 2020
58a9b33
use spago in travis
shmish111 Aug 17, 2020
0377029
Adding a roundtrip test for Map.
krisajenkins Sep 3, 2020
961aa70
More flexible Map decoding.
krisajenkins Sep 3, 2020
652a993
Adding encoders/decoders for Either.
krisajenkins Sep 3, 2020
538d5e8
Adding Data.BigInt support.
krisajenkins Sep 3, 2020
b0584ad
Adding a shell.nix file, for a repeatable env.
krisajenkins Sep 3, 2020
bcd6e20
Adding extra map-decoding tests.
krisajenkins Sep 4, 2020
f840a43
Improving the resiliency of BigInt decoding.
krisajenkins Sep 4, 2020
2d2e351
Improved encoding/decoding for big integers.
krisajenkins Sep 8, 2020
cd8ed03
Moving to a more formal test suite.
krisajenkins Sep 11, 2020
040060d
BigInteger support.
krisajenkins Sep 10, 2020
2a62593
Refactoring the test suite.
krisajenkins Sep 17, 2020
22aac68
Fixing a bug with aeson-style encoding on nested sum types.
krisajenkins Sep 17, 2020
cc4519d
Simplifying a fromMaybe clause.
krisajenkins Sep 17, 2020
bd412a1
Merge pull request #7 from shmish111/rebase-upstream
shmish111 Oct 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ bower_components/
output/
.psc-package
.psc-ide-port
node_modules/
yarn.lock
.spago
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ dist: trusty
sudo: required
node_js: stable
install:
- npm install -g bower
- npm install -g purescript-spago
- npm install
script:
- bower install --production
- npm run -s build
- bower install
- npm run -s test
- spago build
- spago test
15 changes: 6 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
"url": "git://github.com/paf31/purescript-foreign-generic.git"
},
"dependencies": {
"purescript-effect": "^2.0.0",
"purescript-prelude": "^4.1.1",
"purescript-foreign": "^5.0.0",
"purescript-foreign-object": "^2.0.0",
"purescript-generics-rep": "^6.0.0",
"purescript-ordered-collections": "^1.0.0",
"purescript-proxy": "^3.0.0",
"purescript-exceptions": "^4.0.0",
"purescript-record": "^2.0.0",
"purescript-identity": "^4.1.0"
"purescript-generics-rep": "^6.1.1",
"purescript-foreign-object": "^2.0.3",
"purescript-record": "^2.0.1",
"purescript-quickcheck": "^6.1.0"
},
"devDependencies": {
"purescript-assert": "^4.0.0",
"purescript-assert": "^4.1.0",
"purescript-psci-support": "^4.0.0"
}
}
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build -- --censor-lib --strict",
"purs:ide": "purs ide server --log-level=debug 'bower_components/purescript-*/src/**/*.purs' 'src/**/*.purs' 'test/**/*.purs'",
"test": "pulp test"
},
"devDependencies": {
"pulp": "^12.0.0",
"purescript": "^0.12.0",
"purescript-psa": "^0.5.0",
"rimraf": "^2.5.0"
"bower": "^1.8.8",
"pulp": "^13.0.0",
"purescript": "^0.13.3",
"purescript-psa": "^0.7.3",
"rimraf": "^3.0.0"
},
"dependencies": {
"bignumber": "^1.1.0",
"json-bigint": "^1.0.0"
}
}
128 changes: 128 additions & 0 deletions packages.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{-
Welcome to your new Dhall package-set!

Below are instructions for how to edit this file for most use
cases, so that you don't need to know Dhall to use it.

## Warning: Don't Move This Top-Level Comment!

Due to how `dhall format` currently works, this comment's
instructions cannot appear near corresponding sections below
because `dhall format` will delete the comment. However,
it will not delete a top-level comment like this one.

## Use Cases

Most will want to do one or both of these options:
1. Override/Patch a package's dependency
2. Add a package not already in the default package set

This file will continue to work whether you use one or both options.
Instructions for each option are explained below.

### Overriding/Patching a package

Purpose:
- Change a package's dependency to a newer/older release than the
default package set's release
- Use your own modified version of some dependency that may
include new API, changed API, removed API by
using your custom git repo of the library rather than
the package set's repo

Syntax:
Replace the overrides' "{=}" (an empty record) with the following idea
The "//" or "⫽" means "merge these two records and
when they have the same value, use the one on the right:"
-------------------------------
let override =
{ packageName =
upstream.packageName // { updateEntity1 = "new value", updateEntity2 = "new value" }
, packageName =
upstream.packageName // { version = "v4.0.0" }
, packageName =
upstream.packageName // { repo = "https://www.example.com/path/to/new/repo.git" }
}
-------------------------------

Example:
-------------------------------
let overrides =
{ halogen =
upstream.halogen // { version = "master" }
, halogen-vdom =
upstream.halogen-vdom // { version = "v4.0.0" }
}
-------------------------------

### Additions

Purpose:
- Add packages that aren't already included in the default package set

Syntax:
Replace the additions' "{=}" (an empty record) with the following idea:
-------------------------------
let additions =
{ package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"tag ('v4.0.0') or branch ('master')"
}
, package-name =
{ dependencies =
[ "dependency1"
, "dependency2"
]
, repo =
"https://example.com/path/to/git/repo.git"
, version =
"tag ('v4.0.0') or branch ('master')"
}
, etc.
}
-------------------------------

Example:
-------------------------------
let additions =
{ benchotron =
{ dependencies =
[ "arrays"
, "exists"
, "profunctor"
, "strings"
, "quickcheck"
, "lcg"
, "transformers"
, "foldable-traversable"
, "exceptions"
, "node-fs"
, "node-buffer"
, "node-readline"
, "datetime"
, "now"
]
, repo =
"https://github.com/hdgarrood/purescript-benchotron.git"
, version =
"v7.0.0"
}
}
-------------------------------
-}


let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200724/packages.dhall sha256:bb941d30820a49345a0e88937094d2b9983d939c9fd3a46969b85ce44953d7d9

let overrides = {=}

let additions = {=}

in upstream // overrides // additions
30 changes: 30 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{ pkgs ? import (
builtins.fetchTarball {
name = "nixos-20.03";
url = "https://github.com/NixOS/nixpkgs/archive/5272327b81ed355bbed5659b8d303cf2979b6953.tar.gz";
sha256 = "0182ys095dfx02vl2a20j1hz92dx3mfgz2a6fhn31bqlp1wa8hlq";
}
)
{}
}:
let
easyPS = import (
builtins.fetchTarball {
name = "easy-purescript";
url = "https://github.com/justinwoo/easy-purescript-nix/archive/1ec689df0adf8e8ada7fcfcb513876307ea34226.tar.gz";
sha256 = "12hk2zbjkrq2i5fs6xb3x254lnhm9fzkcxph0a7ngxyzfykvf4hi";
}
) {};
in
pkgs.mkShell {
buildInputs = [
pkgs.git
pkgs.yarn
pkgs.nodePackages.bower
pkgs.nodePackages.pulp
pkgs.nodejs
easyPS.spago
easyPS.purs
easyPS.purty
];
}
25 changes: 25 additions & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{-
Welcome to a Spago project!
You can edit this file as you like.
-}
{ name = "foreign-generic"
, dependencies =
[ "assert"
, "console"
, "effect"
, "exceptions"
, "foreign"
, "foreign-object"
, "generics-rep"
, "identity"
, "rationals"
, "quickcheck"
, "test-unit"
, "ordered-collections"
, "proxy"
, "psci-support"
, "record"
]
, packages = ./packages.dhall
, sources = [ "src/**/*.purs", "test/**/*.purs" ]
}
97 changes: 97 additions & 0 deletions src/Data/BigInteger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*global exports, require*/
'use strict';

var BigNumber = require('bignumber.js');

exports.eq_ = function (a) {
return function (b) {
return a.isEqualTo(b);
};
};

exports.show_ = function (n) {
return n.toString(10);
};

exports.toNumber = function (n) {
return n.toNumber();
};

exports.fromInt = function (int) {
return BigNumber(int);
};

exports.fromString_ = function (nothing) {
return function (just) {
return function (str) {
var n = BigNumber(str);
if (n && n.isInteger()) {
return just(n);
} else {
return nothing;
}
};
};
};

exports.add_ = function (x) {
return function (y) {
return x.plus(y);
};
};

exports.mul_ = function (x) {
return function (y) {
return x.multipliedBy(y);
};
};

exports.sub_ = function (x) {
return function (y) {
return x.minus(y);
};
};

exports.div_ = function (x) {
return function (y) {
return x.dividedToIntegerBy(y);
};
};

exports.mod_ = function (x) {
return function (y) {
return x.modulo(y);
};
};

exports.degree_ = function (x) {
return x.absoluteValue().toNumber();
};

exports.comparedTo_ = function (x) {
return function (y) {
return x.comparedTo(y);
};
};

exports.readBigInteger_ = function (nothing) {
return function (just) {
return function (value) {
var tag = Object.prototype.toString.call(value).slice(8,-1);
if (value !== undefined && (BigNumber.isBigNumber(value) || tag === "Number" || tag === "String")) {
var n = BigNumber(value);
if (n && n.isInteger()) {
return just(n);
} else {
return nothing;
}
} else {
return nothing;
}
};
};
};

exports.format = function (value) {
return value.toFormat();
};
Loading