{-# LANGUAGE DeriveGeneric, DuplicateRecordFields, TupleSections #-}
module Language.EFLINT.JSON where
import Language.EFLINT.Spec hiding (FactSpec(actor))
import qualified Language.EFLINT.Spec as Spec
import Data.Aeson hiding (object)
import Data.Maybe
import Data.Char (toLower, isUpper, isSpace)
import qualified Data.Map as M
import GHC.Generics
decode_json_file :: String -> IO (Either String Spec)
decode_json_file :: String -> IO (Either String Spec)
decode_json_file String
f = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Model -> Spec
tModel forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. FromJSON a => String -> IO (Either String a)
eitherDecodeFileStrict String
f
tExpr :: Expression -> Term
tExpr :: Expression -> Term
tExpr Expression
e = case Expression
e of
RefExpr Variable
v -> Var -> Term
Ref (Variable -> Var
tVariable Variable
v)
MultiExpr Multi
m -> case (Multi -> String
expression :: Multi -> String) Multi
m of
String
"AND" -> forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Term -> Term -> Term
And (Bool -> Term
BoolLit Bool
True) (forall a b. (a -> b) -> [a] -> [b]
map Expression -> Term
tExpr (forall a. HasCallStack => Maybe a -> a
fromJust (Multi -> Maybe [Expression]
operands Multi
m)))
String
"OR" -> forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Term -> Term -> Term
Or (Bool -> Term
BoolLit Bool
False) (forall a b. (a -> b) -> [a] -> [b]
map Expression -> Term
tExpr (forall a. HasCallStack => Maybe a -> a
fromJust (Multi -> Maybe [Expression]
operands Multi
m)))
String
"NOT" -> Term -> Term
Not (Expression -> Term
tExpr (forall a. HasCallStack => Maybe a -> a
fromJust (Multi -> Maybe Expression
operand Multi
m)))
String
"LIST"-> Expression -> Term
tExpr (forall a. HasCallStack => Maybe a -> a
fromJust (Multi -> Maybe Expression
items Multi
m))
String
cons -> forall a. HasCallStack => String -> a
error (String
"JSON2SPEC: unknown expression type: " forall a. [a] -> [a] -> [a]
++ String
cons)
tAct :: Act -> (DomId, TypeSpec)
tAct :: Act -> (String, TypeSpec)
tAct Act
a = (Act -> String
act Act
a,) forall a b. (a -> b) -> a -> b
$ TypeSpec {
kind :: Kind
kind = ActSpec -> Kind
Spec.Act ActSpec
aspec
, domain :: Domain
domain = [Var] -> Domain
Products [Var]
args
, domain_constraint :: Term
domain_constraint = Bool -> Term
BoolLit Bool
True
, restriction :: Maybe Restriction
restriction = forall a. Maybe a
Nothing
, derivation :: [Derivation]
derivation = [Term -> Derivation
HoldsWhen Term
condition_term]
, closed :: Bool
closed = Bool
True
, conditions :: [Term]
conditions = []
}
where condition_term :: Term
condition_term = forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr Term -> Term -> Term
And (Bool -> Term
BoolLit Bool
True) forall a b. (a -> b) -> a -> b
$
[ Expression -> Term
tExpr (Act -> Expression
preconditions Act
a)
, Var -> Term
Ref (String -> Var
no_decoration (Act -> String
actor Act
a))
, Var -> Term
Ref (String -> Var
no_decoration (Act -> String
interested_party Act
a))] forall a. [a] -> [a] -> [a]
++
(forall a b. (a -> b) -> [a] -> [b]
map Var -> Term
Ref [Var]
objects)
args :: [Var]
args = [String -> Var
no_decoration (Act -> String
actor Act
a), String -> Var
no_decoration (Act -> String
interested_party Act
a)] forall a. [a] -> [a] -> [a]
++ [Var]
objects
aspec :: ActSpec
aspec = ActSpec { effects :: [Effect]
effects = forall a b. (a -> b) -> [a] -> [b]
map OptBinder -> Effect
mkT ((Act -> [OptBinder]
terminate :: Act -> [OptBinder]) Act
a)
forall a. [a] -> [a] -> [a]
++ forall a b. (a -> b) -> [a] -> [b]
map OptBinder -> Effect
mkC ((Act -> [OptBinder]
create :: Act -> [OptBinder]) Act
a)
, syncs :: [Sync]
syncs = []
, physical :: Bool
physical = Bool
False }
where mkT :: OptBinder -> Effect
mkT OptBinder
ob = case OptBinder
ob of ImplicitDV Expression
expr -> [Variable] -> Expression -> Effect
tAll [] Expression
expr
ExplicitDV Binder
b -> [Variable] -> Expression -> Effect
tAll (Binder -> [Variable]
vars Binder
b) (Binder -> Expression
binder_expression Binder
b)
where tAll :: [Variable] -> Expression -> Effect
tAll [Variable]
vs Expression
expr = [Var] -> Term -> Effect
TAll (forall a b. (a -> b) -> [a] -> [b]
map Variable -> Var
tVariable [Variable]
vs) (Expression -> Term
tExpr Expression
expr)
mkC :: OptBinder -> Effect
mkC OptBinder
ob = case OptBinder
ob of ImplicitDV Expression
expr -> [Variable] -> Expression -> Effect
cAll [] Expression
expr
ExplicitDV Binder
b -> [Variable] -> Expression -> Effect
cAll [] (Binder -> Expression
binder_expression Binder
b)
where cAll :: [Variable] -> Expression -> Effect
cAll [Variable]
vs Expression
expr = [Var] -> Term -> Effect
CAll (forall a b. (a -> b) -> [a] -> [b]
map Variable -> Var
tVariable [Variable]
vs) (Expression -> Term
tExpr Expression
expr)
objects :: [Var]
objects | forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
isSpace (Act -> String
object Act
a) = []
| Bool
otherwise = [String -> Var
no_decoration (Act -> String
object Act
a)]
tDuty :: Duty -> (DomId, TypeSpec)
tDuty :: Duty -> (String, TypeSpec)
tDuty Duty
d = (Duty -> String
duty Duty
d,) forall a b. (a -> b) -> a -> b
$ TypeSpec {
kind :: Kind
kind = DutySpec -> Kind
Spec.Duty DutySpec
dspec
, domain :: Domain
domain = [Var] -> Domain
Products forall a b. (a -> b) -> a -> b
$ [String -> Var
no_decoration (Duty -> String
duty_holder Duty
d)
,String -> Var
no_decoration (Duty -> String
claimant Duty
d)] forall a. [a] -> [a] -> [a]
++ [Var]
objects
, domain_constraint :: Term
domain_constraint = Bool -> Term
BoolLit Bool
True
, restriction :: Maybe Restriction
restriction = forall a. Maybe a
Nothing
, derivation :: [Derivation]
derivation = case (Duty -> Maybe Binder
derivation :: Duty -> Maybe Binder) Duty
d of
Maybe Binder
Nothing -> []
Just Binder
b -> [String -> [Variable] -> Expression -> Derivation
dv (Duty -> String
duty Duty
d) (Binder -> [Variable]
vars Binder
b) (Binder -> Expression
binder_expression Binder
b)]
, closed :: Bool
closed = Bool
True
, conditions :: [Term]
conditions = []
}
where dspec :: DutySpec
dspec = DutySpec {enforcing_acts :: [String]
enforcing_acts = forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (forall a. a -> [a] -> [a]
:[]) (Duty -> Maybe String
enforcing Duty
d)
,violated_when :: [Term]
violated_when = []
,terminating_acts :: [String]
terminating_acts = []
,creating_acts :: [String]
creating_acts = []}
objects :: [Var]
objects | forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all Char -> Bool
isSpace (Duty -> String
duty_components Duty
d) = []
| Bool
otherwise = [String -> Var
no_decoration (Duty -> String
duty_components Duty
d)]
tFact :: Fact -> (DomId, TypeSpec)
tFact :: Fact -> (String, TypeSpec)
tFact Fact
f = (Fact -> String
fact Fact
f,) forall a b. (a -> b) -> a -> b
$ TypeSpec {
kind :: Kind
kind = FactSpec -> Kind
Spec.Fact FactSpec
fspec
, domain :: Domain
domain = case (Fact -> Maybe Domain
domain :: Fact -> Maybe Language.EFLINT.JSON.Domain) Fact
f of
Maybe Domain
Nothing -> case Fact -> OptBinder
function Fact
f of
ImplicitDV (RefExpr (BaseVar String
"[]")) -> Domain
AnyString
OptBinder
_ -> [Var] -> Domain
Products []
Just Domain
dom -> Domain -> Domain
tDomain Domain
dom
, domain_constraint :: Term
domain_constraint = Bool -> Term
BoolLit Bool
True
, restriction :: Maybe Restriction
restriction = forall a. Maybe a
Nothing
, derivation :: [Derivation]
derivation = case Fact -> OptBinder
function Fact
f of
ImplicitDV Expression
expr -> case Expression
expr of
RefExpr (BaseVar String
"[]") -> []
RefExpr (BaseVar String
"<<>>") -> []
Expression
expr -> [String -> [Variable] -> Expression -> Derivation
dv (Fact -> String
fact Fact
f) [] Expression
expr]
ExplicitDV Binder
d -> [String -> [Variable] -> Expression -> Derivation
dv (Fact -> String
fact Fact
f) (Binder -> [Variable]
vars Binder
d) (Binder -> Expression
binder_expression Binder
d)]
, closed :: Bool
closed = Bool
False
, conditions :: [Term]
conditions = []
}
where fspec :: FactSpec
fspec = FactSpec { invariant :: Bool
invariant = Bool
False, actor :: Bool
Spec.actor = Bool
False }
dv :: String -> [Variable] -> Expression -> Spec.Derivation
dv :: String -> [Variable] -> Expression -> Derivation
dv String
cons [Variable]
vars Expression
expr = [Var] -> Term -> Derivation
Dv (forall a b. (a -> b) -> [a] -> [b]
map Variable -> Var
tVariable [Variable]
vars) (Term -> Term -> Term
When (String -> Arguments -> Term
App String
cons (forall a b. b -> Either a b
Right [])) (Expression -> Term
tExpr Expression
expr))
tDomain :: Language.EFLINT.JSON.Domain -> Spec.Domain
tDomain :: Domain -> Domain
tDomain Domain
d = case Domain -> String
type_constructor Domain
d of
String
"ANY-STRING" -> Domain
AnyString
String
"ANY-INT" -> Domain
AnyInt
String
"STRING" -> [String] -> Domain
Strings (forall a. HasCallStack => Maybe a -> a
fromJust (Domain -> Maybe [String]
strings Domain
d))
String
"INT" -> [Int] -> Domain
Ints (forall a. HasCallStack => Maybe a -> a
fromJust (Domain -> Maybe [Int]
ints Domain
d))
String
"PRODUCT" -> [Var] -> Domain
Products (forall a b. (a -> b) -> [a] -> [b]
map Variable -> Var
tVariable (forall a. HasCallStack => Maybe a -> a
fromJust (Domain -> Maybe [Variable]
arguments Domain
d)))
String
cons -> forall a. HasCallStack => String -> a
error (String
"unknown type-constructor: " forall a. [a] -> [a] -> [a]
++ String
cons)
tVariable :: Variable -> Spec.Var
tVariable :: Variable -> Var
tVariable (BaseVar String
var) = String -> String -> Var
Var String
var String
""
tVariable (DecVar (DecoratedVariable String
x String
d)) = String -> String -> Var
Var String
x String
d
tModel :: Model -> Spec
tModel :: Model -> Spec
tModel Model
m = Spec { decls :: Map String TypeSpec
decls = forall k a. Ord k => [(k, a)] -> Map k a
M.fromList forall a b. (a -> b) -> a -> b
$
forall a b. (a -> b) -> [a] -> [b]
map Act -> (String, TypeSpec)
tAct (Model -> [Act]
acts Model
m) forall a. [a] -> [a] -> [a]
++
forall a b. (a -> b) -> [a] -> [b]
map Duty -> (String, TypeSpec)
tDuty (Model -> [Duty]
duties Model
m) forall a. [a] -> [a] -> [a]
++
forall a b. (a -> b) -> [a] -> [b]
map Fact -> (String, TypeSpec)
tFact (Model -> [Fact]
facts Model
m)
, aliases :: Map String String
aliases = forall k a. Map k a
M.empty}
unhyphen :: String -> String
unhyphen :: String -> String
unhyphen = forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
op
where op :: Char -> Char
op Char
'-' = Char
'_'
op Char
c = Char
c
hyphen :: String -> String
hyphen :: String -> String
hyphen = forall a b. (a -> b) -> [a] -> [b]
map Char -> Char
op
where op :: Char -> Char
op Char
'_' = Char
'-'
op Char
c = Char
c
process_string :: String -> String
process_string :: String -> String
process_string = forall a. a -> a
id
replace :: Char -> String
replace :: Char -> String
replace Char
',' = String
""
replace Char
'-' = String
""
replace Char
c | Char -> Bool
isUpper Char
c = [Char -> Char
toLower Char
c]
replace Char
c = [Char
c]
customOptions :: Options
customOptions = Options
defaultOptions { fieldLabelModifier :: String -> String
fieldLabelModifier = String -> String
hyphen, sumEncoding :: SumEncoding
sumEncoding = SumEncoding
UntaggedValue}
type BaseVariable = String
data Variable = BaseVar BaseVariable
| DecVar DecoratedVariable
deriving (Int -> Variable -> String -> String
[Variable] -> String -> String
Variable -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Variable] -> String -> String
$cshowList :: [Variable] -> String -> String
show :: Variable -> String
$cshow :: Variable -> String
showsPrec :: Int -> Variable -> String -> String
$cshowsPrec :: Int -> Variable -> String -> String
Show, forall x. Rep Variable x -> Variable
forall x. Variable -> Rep Variable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Variable x -> Variable
$cfrom :: forall x. Variable -> Rep Variable x
Generic)
instance ToJSON Variable where
toJSON :: Variable -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Variable -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Variable where
parseJSON :: Value -> Parser Variable
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data DecoratedVariable = DecoratedVariable {
DecoratedVariable -> String
base :: BaseVariable
, DecoratedVariable -> String
modifier :: String
} deriving (Int -> DecoratedVariable -> String -> String
[DecoratedVariable] -> String -> String
DecoratedVariable -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [DecoratedVariable] -> String -> String
$cshowList :: [DecoratedVariable] -> String -> String
show :: DecoratedVariable -> String
$cshow :: DecoratedVariable -> String
showsPrec :: Int -> DecoratedVariable -> String -> String
$cshowsPrec :: Int -> DecoratedVariable -> String -> String
Show, forall x. Rep DecoratedVariable x -> DecoratedVariable
forall x. DecoratedVariable -> Rep DecoratedVariable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DecoratedVariable x -> DecoratedVariable
$cfrom :: forall x. DecoratedVariable -> Rep DecoratedVariable x
Generic)
instance ToJSON DecoratedVariable where
toJSON :: DecoratedVariable -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: DecoratedVariable -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON DecoratedVariable where
parseJSON :: Value -> Parser DecoratedVariable
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Model = Model {
Model -> [Act]
acts :: [Act]
, Model -> [Fact]
facts :: [Fact]
, Model -> [Duty]
duties :: [Duty]
} deriving (Int -> Model -> String -> String
[Model] -> String -> String
Model -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Model] -> String -> String
$cshowList :: [Model] -> String -> String
show :: Model -> String
$cshow :: Model -> String
showsPrec :: Int -> Model -> String -> String
$cshowsPrec :: Int -> Model -> String -> String
Show, forall x. Rep Model x -> Model
forall x. Model -> Rep Model x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Model x -> Model
$cfrom :: forall x. Model -> Rep Model x
Generic)
instance ToJSON Model where
toEncoding :: Model -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding (Options
defaultOptions { constructorTagModifier :: String -> String
constructorTagModifier = String -> String
unhyphen, sumEncoding :: SumEncoding
sumEncoding = SumEncoding
UntaggedValue} )
instance FromJSON Model where
data Act = Act {
Act -> String
act :: String
, Act -> String
actor :: String
, Act -> String
action :: String
, Act -> String
object :: String
, Act -> String
interested_party :: String
, Act -> Expression
preconditions :: Expression
, Act -> [OptBinder]
create :: [OptBinder]
, Act -> [OptBinder]
terminate :: [OptBinder]
, Act -> Maybe Binder
derivation :: Maybe Binder
, Act -> Maybe [Source]
sources :: Maybe [Source]
, Act -> Maybe String
explanation :: Maybe String
, Act -> Maybe String
version :: Maybe String
, Act -> Maybe References
reference :: Maybe References
, Act -> Maybe String
juriconnect :: Maybe String
, Act -> Maybe String
sourcetext :: Maybe String
} deriving (Int -> Act -> String -> String
[Act] -> String -> String
Act -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Act] -> String -> String
$cshowList :: [Act] -> String -> String
show :: Act -> String
$cshow :: Act -> String
showsPrec :: Int -> Act -> String -> String
$cshowsPrec :: Int -> Act -> String -> String
Show, forall x. Rep Act x -> Act
forall x. Act -> Rep Act x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Act x -> Act
$cfrom :: forall x. Act -> Rep Act x
Generic)
instance ToJSON Act where
toJSON :: Act -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Act -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Act where
parseJSON :: Value -> Parser Act
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Fact = Fact {
Fact -> String
fact :: String
, Fact -> OptBinder
function :: OptBinder
, Fact -> Maybe Domain
domain :: Maybe Language.EFLINT.JSON.Domain
, Fact -> Maybe [Source]
sources :: Maybe [Source]
, Fact -> Maybe String
explanation :: Maybe String
, Fact -> Maybe String
version :: Maybe String
, Fact -> Maybe References
reference :: Maybe References
, Fact -> Maybe String
juriconnect :: Maybe String
, Fact -> Maybe String
sourcetext :: Maybe String
} deriving (Int -> Fact -> String -> String
[Fact] -> String -> String
Fact -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Fact] -> String -> String
$cshowList :: [Fact] -> String -> String
show :: Fact -> String
$cshow :: Fact -> String
showsPrec :: Int -> Fact -> String -> String
$cshowsPrec :: Int -> Fact -> String -> String
Show, forall x. Rep Fact x -> Fact
forall x. Fact -> Rep Fact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Fact x -> Fact
$cfrom :: forall x. Fact -> Rep Fact x
Generic)
instance ToJSON Fact where
toJSON :: Fact -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Fact -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Fact where
parseJSON :: Value -> Parser Fact
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Domain = Domain {
Domain -> String
type_constructor :: String
, Domain -> Maybe [Variable]
arguments :: Maybe [Variable]
, Domain -> Maybe [String]
strings :: Maybe [String]
, Domain -> Maybe [Int]
ints :: Maybe [Int]
} deriving (Int -> Domain -> String -> String
[Domain] -> String -> String
Domain -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Domain] -> String -> String
$cshowList :: [Domain] -> String -> String
show :: Domain -> String
$cshow :: Domain -> String
showsPrec :: Int -> Domain -> String -> String
$cshowsPrec :: Int -> Domain -> String -> String
Show, forall x. Rep Domain x -> Domain
forall x. Domain -> Rep Domain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Domain x -> Domain
$cfrom :: forall x. Domain -> Rep Domain x
Generic)
instance ToJSON Language.EFLINT.JSON.Domain where
toJSON :: Domain -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Domain -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Language.EFLINT.JSON.Domain where
parseJSON :: Value -> Parser Domain
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Duty = Duty {
Duty -> String
duty :: String
, Duty -> String
duty_components :: String
, Duty -> String
duty_holder :: String
, Duty -> String
claimant :: String
, Duty -> String
create :: String
, Duty -> String
terminate :: String
, Duty -> Maybe String
enforcing :: Maybe String
, Duty -> Maybe Binder
derivation :: Maybe Binder
, Duty -> Maybe [Source]
sources :: Maybe [Source]
, Duty -> Maybe String
explanation :: Maybe String
, Duty -> Maybe String
version :: Maybe String
, Duty -> Maybe References
reference :: Maybe References
, Duty -> Maybe String
juriconnect :: Maybe String
, Duty -> Maybe String
sourcetext :: Maybe String
} deriving (Int -> Duty -> String -> String
[Duty] -> String -> String
Duty -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Duty] -> String -> String
$cshowList :: [Duty] -> String -> String
show :: Duty -> String
$cshow :: Duty -> String
showsPrec :: Int -> Duty -> String -> String
$cshowsPrec :: Int -> Duty -> String -> String
Show, forall x. Rep Duty x -> Duty
forall x. Duty -> Rep Duty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Duty x -> Duty
$cfrom :: forall x. Duty -> Rep Duty x
Generic)
instance ToJSON Duty where
toJSON :: Duty -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Duty -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Duty where
parseJSON :: Value -> Parser Duty
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data OptBinder = ExplicitDV Binder
| ImplicitDV Expression
deriving (Int -> OptBinder -> String -> String
[OptBinder] -> String -> String
OptBinder -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [OptBinder] -> String -> String
$cshowList :: [OptBinder] -> String -> String
show :: OptBinder -> String
$cshow :: OptBinder -> String
showsPrec :: Int -> OptBinder -> String -> String
$cshowsPrec :: Int -> OptBinder -> String -> String
Show, forall x. Rep OptBinder x -> OptBinder
forall x. OptBinder -> Rep OptBinder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OptBinder x -> OptBinder
$cfrom :: forall x. OptBinder -> Rep OptBinder x
Generic)
instance ToJSON OptBinder where
toJSON :: OptBinder -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: OptBinder -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON OptBinder where
parseJSON :: Value -> Parser OptBinder
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Binder = Binder {
Binder -> [Variable]
vars :: [Variable]
, Binder -> Expression
binder_expression :: Expression
} deriving (Int -> Binder -> String -> String
[Binder] -> String -> String
Binder -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Binder] -> String -> String
$cshowList :: [Binder] -> String -> String
show :: Binder -> String
$cshow :: Binder -> String
showsPrec :: Int -> Binder -> String -> String
$cshowsPrec :: Int -> Binder -> String -> String
Show, forall x. Rep Binder x -> Binder
forall x. Binder -> Rep Binder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Binder x -> Binder
$cfrom :: forall x. Binder -> Rep Binder x
Generic)
instance ToJSON Binder where
toJSON :: Binder -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Binder -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Binder where
parseJSON :: Value -> Parser Binder
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Source = Source {
Source -> String
validFrom :: String
, Source -> Maybe String
validTo :: Maybe String
, Source -> String
citation :: String
, Source -> String
juriconnect :: String
, Source -> String
text :: String
} deriving (Int -> Source -> String -> String
[Source] -> String -> String
Source -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Source] -> String -> String
$cshowList :: [Source] -> String -> String
show :: Source -> String
$cshow :: Source -> String
showsPrec :: Int -> Source -> String -> String
$cshowsPrec :: Int -> Source -> String -> String
Show, forall x. Rep Source x -> Source
forall x. Source -> Rep Source x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Source x -> Source
$cfrom :: forall x. Source -> Rep Source x
Generic)
instance ToJSON Source where
toJSON :: Source -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Source -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Source where
parseJSON :: Value -> Parser Source
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Expression = RefExpr Variable
| MultiExpr Multi
deriving (Int -> Expression -> String -> String
[Expression] -> String -> String
Expression -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Expression] -> String -> String
$cshowList :: [Expression] -> String -> String
show :: Expression -> String
$cshow :: Expression -> String
showsPrec :: Int -> Expression -> String -> String
$cshowsPrec :: Int -> Expression -> String -> String
Show, forall x. Rep Expression x -> Expression
forall x. Expression -> Rep Expression x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Expression x -> Expression
$cfrom :: forall x. Expression -> Rep Expression x
Generic)
instance ToJSON Expression where
toJSON :: Expression -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
toEncoding :: Expression -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
instance FromJSON Expression where
parseJSON :: Value -> Parser Expression
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions
data Multi = Multi {
Multi -> String
expression :: String
, Multi -> Maybe [Expression]
operands :: Maybe [Expression]
, Multi -> Maybe Expression
operand :: Maybe Expression
, Multi -> Maybe Expression
items :: Maybe Expression
} deriving (Int -> Multi -> String -> String
[Multi] -> String -> String
Multi -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [Multi] -> String -> String
$cshowList :: [Multi] -> String -> String
show :: Multi -> String
$cshow :: Multi -> String
showsPrec :: Int -> Multi -> String -> String
$cshowsPrec :: Int -> Multi -> String -> String
Show, forall x. Rep Multi x -> Multi
forall x. Multi -> Rep Multi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Multi x -> Multi
$cfrom :: forall x. Multi -> Rep Multi x
Generic)
instance ToJSON Multi where
instance FromJSON Multi where
data References = RSingle String
| RMulti [String]
deriving (Int -> References -> String -> String
[References] -> String -> String
References -> String
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [References] -> String -> String
$cshowList :: [References] -> String -> String
show :: References -> String
$cshow :: References -> String
showsPrec :: Int -> References -> String -> String
$cshowsPrec :: Int -> References -> String -> String
Show, forall x. Rep References x -> References
forall x. References -> Rep References x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep References x -> References
$cfrom :: forall x. References -> Rep References x
Generic)
instance ToJSON References where
toEncoding :: References -> Encoding
toEncoding = forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
customOptions
toJSON :: References -> Value
toJSON = forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
customOptions
instance FromJSON References where
parseJSON :: Value -> Parser References
parseJSON = forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
customOptions