mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Add Pure/Effectful content to checkmate
This commit is contained in:
parent
025600c6a7
commit
28f35edb2c
3 changed files with 39 additions and 4 deletions
|
@ -315,6 +315,7 @@
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
"arguments",
|
"arguments",
|
||||||
|
"fx",
|
||||||
"lambda_type",
|
"lambda_type",
|
||||||
"ret",
|
"ret",
|
||||||
"type"
|
"type"
|
||||||
|
@ -326,6 +327,9 @@
|
||||||
"$ref": "#/definitions/Variable"
|
"$ref": "#/definitions/Variable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"fx": {
|
||||||
|
"$ref": "#/definitions/Variable"
|
||||||
|
},
|
||||||
"lambda_type": {
|
"lambda_type": {
|
||||||
"$ref": "#/definitions/Variable"
|
"$ref": "#/definitions/Variable"
|
||||||
},
|
},
|
||||||
|
@ -528,6 +532,34 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Pure"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"type"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"Effectful"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
|
|
@ -77,8 +77,8 @@ impl AsSchema<Content> for subs::Content {
|
||||||
} => B::Recursive(opt_name.as_schema(subs), structure.as_schema(subs)),
|
} => B::Recursive(opt_name.as_schema(subs), structure.as_schema(subs)),
|
||||||
A::LambdaSet(lambda_set) => lambda_set.as_schema(subs),
|
A::LambdaSet(lambda_set) => lambda_set.as_schema(subs),
|
||||||
A::ErasedLambda => B::ErasedLambda(),
|
A::ErasedLambda => B::ErasedLambda(),
|
||||||
A::Pure => todo!("[purity-inference] checkmate"),
|
A::Pure => B::Pure(),
|
||||||
A::Effectful => todo!("[purity-inference] checkmate"),
|
A::Effectful => B::Effectful(),
|
||||||
A::Structure(flat_type) => flat_type.as_schema(subs),
|
A::Structure(flat_type) => flat_type.as_schema(subs),
|
||||||
A::Alias(name, type_vars, real_var, kind) => B::Alias(
|
A::Alias(name, type_vars, real_var, kind) => B::Alias(
|
||||||
name.as_schema(subs),
|
name.as_schema(subs),
|
||||||
|
@ -98,11 +98,11 @@ impl AsSchema<Content> for subs::FlatType {
|
||||||
subs::FlatType::Apply(symbol, variables) => {
|
subs::FlatType::Apply(symbol, variables) => {
|
||||||
Content::Apply(symbol.as_schema(subs), variables.as_schema(subs))
|
Content::Apply(symbol.as_schema(subs), variables.as_schema(subs))
|
||||||
}
|
}
|
||||||
subs::FlatType::Func(arguments, closure, ret, _fx) => Content::Function(
|
subs::FlatType::Func(arguments, closure, ret, fx) => Content::Function(
|
||||||
arguments.as_schema(subs),
|
arguments.as_schema(subs),
|
||||||
closure.as_schema(subs),
|
closure.as_schema(subs),
|
||||||
ret.as_schema(subs),
|
ret.as_schema(subs),
|
||||||
// [purity-inference] TODO: checkmate
|
fx.as_schema(subs),
|
||||||
),
|
),
|
||||||
subs::FlatType::Record(fields, ext) => {
|
subs::FlatType::Record(fields, ext) => {
|
||||||
Content::Record(fields.as_schema(subs), ext.as_schema(subs))
|
Content::Record(fields.as_schema(subs), ext.as_schema(subs))
|
||||||
|
|
|
@ -73,6 +73,7 @@ impl_content! {
|
||||||
arguments: Vec<Variable>,
|
arguments: Vec<Variable>,
|
||||||
lambda_type: Variable,
|
lambda_type: Variable,
|
||||||
ret: Variable,
|
ret: Variable,
|
||||||
|
fx: Variable,
|
||||||
},
|
},
|
||||||
Record {
|
Record {
|
||||||
fields: HashMap<String, RecordField>,
|
fields: HashMap<String, RecordField>,
|
||||||
|
@ -101,6 +102,8 @@ impl_content! {
|
||||||
RangedNumber {
|
RangedNumber {
|
||||||
range: NumericRange,
|
range: NumericRange,
|
||||||
},
|
},
|
||||||
|
Pure {},
|
||||||
|
Effectful {},
|
||||||
Error {},
|
Error {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue