Open AshleyYakeley opened 1 year ago
Per #180:
datatype storable JSON of Null; Bool Boolean; String Text; Number Scientific; Array (List JSON); Object (List (Text *: JSON)); # constructor function sorts and reduces by key end; type storable TextJSON; subtype TextJSON <: Literal; # (dynamic subtype, text/json) subtype TextJSON <: Textual; subtype TextJSON <: Interpretation JSON; type storable CBORJSON; subtype CBORJSON <: Literal; # (dynamic subtype, application/cbor) subtype CBORJSON <: Interpretation JSON; decode.JSON: Text -> Maybe TextJSON textual: TextJSON -> Text prism1: Prism Text TextJSON textEncode.JSON: JSON -> TextJSON interpret: TextJSON -> JSON prism2: Thing TextJSON JSON
Alternative:
type storable JSON; # constructors as above subtype JSON <: Literal; # stored as CBOR asText.JSON: Prism Text JSON; asCBOR.JSON: Prism Blob JSON; fromMedia.JSON: Media -> Maybe JSON; toTextMedia.JSON: JSON -> Media; toCBORMedia.JSON: JSON -> Media;
Per #180:
Alternative: