jsonlogic-0.1.0.0: JsonLogic Evaluation
Copyright(c) Marien Matser Gerard van Schie Jelle Teeuwissen 2022
LicenseMIT
Maintainerjelleteeuwissen@hotmail.nl
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

JsonLogic.Json

Description

 
Synopsis

Documentation

data Json Source #

Json is a collection of possible Json values.

Instances

Instances details
Eq Json Source # 
Instance details

Defined in JsonLogic.Json

Methods

(==) :: Json -> Json -> Bool #

(/=) :: Json -> Json -> Bool #

Read Json Source # 
Instance details

Defined in JsonLogic.Json

Show Json Source # 
Instance details

Defined in JsonLogic.Json

Methods

showsPrec :: Int -> Json -> ShowS #

show :: Json -> String #

showList :: [Json] -> ShowS #

type JsonObject = Map String Json Source #

A Json object is a map of string-Json pairs.

type Rule = Json Source #

A rule can be any kind of Json value, but objects and arrays will be evaluated.

type Data = Json Source #

Data can be any kind of Json value.

prettyShow :: Json -> String Source #

A pretty formatted show for the Json, with identation and depth Use putStr so the newline characters will be interpreted in console

>>> putStr $ prettyShow JsonNull
null
>>> putStr $ prettyShow $ JsonNumber 3.0
3.0
>>> prettyShow (JsonArray [JsonNumber 1, JsonNumber 2])
"[\n  1.0,\n  2.0\n]"
>>> putStr $ prettyShow (JsonArray [JsonNumber 1, JsonBool True])
[
  1.0,
  true
]

stringify :: Json -> String Source #

Convert Json to string, used in string operations See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString for more information.

isTruthy :: Json -> Bool Source #

Truthy test for Json See https://developer.mozilla.org/en-US/docs/Glossary/Truthy for more information.

isFalsy :: Json -> Bool Source #

The opposite of isTruthy