Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ JSON for [Bend 2](https://github.com/bendlang/bend).
## Install

With [Bend](https://github.com/bendlang/bend) alone there is nothing to
install: import ezjson by its hub name and `bend` fetches it from
[the hub](https://hub.bend-lang.com) into `~/.bend/lib` on the first run.
`0x81c67699424929b5c44cd8577e18117f` is ezjson v1.1.0.
install: import ezjson by its hub name and version, and `bend` fetches it
from [the hub](https://hub.bend-lang.com) into `~/.bend/lib` on the first
run; no install step. ezjson is built and checked on Bend 2.0.34.

```
import 0x81c67699424929b5c44cd8577e18117f/main.bend as Ezjson
import emerging-ezjson@1.1.0.0/main.bend as Ezjson
```

`emerging-ezjson@1.1.0.0` is ezjson v1.1.0 and resolves to
`0x81c67699424929b5c44cd8577e18117f`; to pin by content, import
`0x81c67699424929b5c44cd8577e18117f/main.bend` instead.

Or with [ez](https://github.com/Emerging-Patterns/ez), which records the
package in `ez.toml` (`ez init` makes one):

Expand All @@ -34,8 +38,8 @@ builds null when the text is not a JSON number. The `Json` type is
`match` on a result its own def, since Bend matches only a parameter.

```
import 0x81c67699424929b5c44cd8577e18117f/main.bend as Ezjson
import 0x81c67699424929b5c44cd8577e18117f/src/value.bend as Value
import emerging-ezjson@1.1.0.0/main.bend as Ezjson
import emerging-ezjson@1.1.0.0/src/value.bend as Value

def shown(got: Maybe<&2, Value.Json>) -> String:
match got:
Expand Down Expand Up @@ -79,8 +83,8 @@ Walk a large object or array one event at a time. `skip` drops a subtree
you do not need. `text` copies an owned string when you need one.

```
import 0x81c67699424929b5c44cd8577e18117f/main.bend as Ezjson
import 0x81c67699424929b5c44cd8577e18117f/src/pull.bend as Pull
import emerging-ezjson@1.1.0.0/main.bend as Ezjson
import emerging-ezjson@1.1.0.0/src/pull.bend as Pull

def owned.go(step: (Pull.Ev & Pull.Cur)) -> (String & Pull.Cur):
(ev, rest) = step
Expand Down
6 changes: 3 additions & 3 deletions ez.lock.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ hub = "https://hub.bend-lang.com"
[tools]
[tools.bolt]
git = "https://github.com/Emerging-Patterns/bolt"
rev = "d5a67600a96ba423f2212bd661a30c1fba38eb55"
tag = "v1.9.0"
rev = "91efe4bbaad91953652794ad55be7b49c10a2eff"
tag = "v1.11.0"
root = "."
narHash = "sha256-HmJ8J1xDshBdSWXIiEp48GZ9qHsm+bmpHw06ZWwcDVE="
narHash = "sha256-0xjoxoByI8PKBrbFy4eYGbKQ3ZVscknZLKkWQroYAUI="
entry = "main.bend"
6 changes: 3 additions & 3 deletions ez.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ entry = "main.bend"

[tools.bolt]
git = "https://github.com/Emerging-Patterns/bolt"
rev = "d5a67600a96ba423f2212bd661a30c1fba38eb55"
tag = "v1.9.0"
rev = "91efe4bbaad91953652794ad55be7b49c10a2eff"
tag = "v1.11.0"
root = "."
narHash = "sha256-HmJ8J1xDshBdSWXIiEp48GZ9qHsm+bmpHw06ZWwcDVE="
narHash = "sha256-0xjoxoByI8PKBrbFy4eYGbKQ3ZVscknZLKkWQroYAUI="
entry = "main.bend"
47 changes: 7 additions & 40 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 4 additions & 19 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
url = "github:bendlang/bend/777ee0b55c485afdd7e68bd917b3d23a88d77371";
inputs.nixpkgs.follows = "nixpkgs";
};
# ez and its bolt stay on the bend ez's own flake.lock records until ez
# releases on 2.0.34, so ez's inputs.bend is pinned, not followed. The
# package's own builds and its proofs (checks.proofs) run on 2.0.34.
# ez 1.3.0 runs on 2.0.34, so ez (and the bolt it builds) follows this bend
inputs.ez = {
url = "github:Emerging-Patterns/ez";
inputs.nixpkgs.follows = "nixpkgs";
inputs.bend.url = "github:bendlang/bend/af569d4826913b2ce3557e9829ccad31fcf86f94";
inputs.bend.follows = "bend";
};

outputs = { self, nixpkgs, ... }@inputs:
Expand Down Expand Up @@ -46,21 +44,8 @@
apps.${system} = bench.apps;

checks.${system} = {
# every PROOF.bend on this flake's bend: its first line must be
# ALL PROOFS CHECK. ez.mkProofs comes back when ez runs on 2.0.34.
proofs = pkgs.runCommand "ezjson-proofs" {
nativeBuildInputs = [ bend ];
BEND_LIB = ez.bendLib ./ez.lock.toml;
} ''
export HOME=$TMPDIR
cp -r ${self} src && chmod -R u+w src && cd src
for p in $(find . -name PROOF.bend -not -path './.ez/*' | sort); do
first=$(cd "$(dirname "$p")" && bend "$(basename "$p")" | head -n 1)
echo "$p: $first"
[ "$first" = "ALL PROOFS CHECK" ] || exit 1
done
touch $out
'';
# every PROOF.bend must print ALL PROOFS CHECK (ez prove)
proofs = ez.mkProofs { ez = ezBin; src = self; };
lint = ez.mkLint { src = self; };
} // bench.checks // scale.checks;

Expand Down
Loading