-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds FFI definitions for core/json along with a JSON parser and printer. Printer doesn't support pretty printing yet.
- Loading branch information
Showing
12 changed files
with
680 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package: | ||
name: json | ||
dependencies: | ||
- prelude | ||
- arrays | ||
- functions | ||
- integers | ||
- maybe | ||
- either | ||
- tuples | ||
- foldable-traversable | ||
- gen | ||
- strings | ||
- unfoldable | ||
test: | ||
main: Test.JSON.Main | ||
dependencies: | ||
- assert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
(library (JSON foreign) | ||
(export _null | ||
fromBoolean | ||
fromInt | ||
fromString | ||
fromJArray | ||
fromJObject | ||
printIndented) | ||
(import (chezscheme) | ||
(only (JSON.Internal foreign) json-stringify)) | ||
|
||
(define (coerce x) x) | ||
|
||
(define _null 'null) | ||
|
||
(define fromBoolean coerce) | ||
|
||
(define fromInt inexact) | ||
|
||
(define fromString coerce) | ||
|
||
(define fromJArray coerce) | ||
|
||
(define fromJObject coerce) | ||
|
||
(define print json-stringify) | ||
|
||
(define printIndented json-stringify) | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(library (JSON.Array foreign) | ||
(export singleton) | ||
(import (chezscheme) | ||
(prefix (purs runtime srfi :214) srfi:214:)) | ||
|
||
(define (singleton x) (srfi:214:flexvector x)) | ||
|
||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,3 +140,5 @@ foreign import _append | |
JArray | ||
JArray | ||
JArray | ||
|
||
foreign import isNull :: JSON -> Boolean |
Oops, something went wrong.