greatly simplify and improve type inferencing - suggestions broken
This commit is contained in:
parent
c3f7cea310
commit
c5c5def598
12 changed files with 1022 additions and 694 deletions
|
|
@ -1,14 +1,15 @@
|
|||
import { useContext } from "react";
|
||||
|
||||
import { eqType, getSymbol, reduceUnification } from "dope2";
|
||||
// import { eqType, getSymbol, reduceUnification } from "dope2";
|
||||
|
||||
import { ExprBlock, type ExprBlockState, type State2Props } from "./ExprBlock";
|
||||
import { EnvContext } from "./EnvContext";
|
||||
import { evalExprBlock, evalLambdaBlock, makeInnerEnv, makeTypeVar } from "./eval";
|
||||
// import { evalExprBlock, evalLambdaBlock, makeInnerEnv, makeTypeVar } from "./eval";
|
||||
|
||||
import "./LambdaBlock.css";
|
||||
import { Type } from "./Type";
|
||||
import { Input } from "./Input";
|
||||
import { inferTypeLambda } from "./infer_type";
|
||||
|
||||
export interface LambdaBlockState {
|
||||
kind: "lambda";
|
||||
|
|
@ -36,9 +37,13 @@ export function LambdaBlock({state, setState, score}: LambdaBlockProps) {
|
|||
expr: callback(state.expr),
|
||||
}));
|
||||
|
||||
const [lambdaResolved, _, innerEnv] = evalLambdaBlock(state.paramName, state.expr, env);
|
||||
const {paramType, innerEnv} = inferTypeLambda(state, env);
|
||||
|
||||
const inferredParamType = lambdaResolved.t.params[0](lambdaResolved.t);
|
||||
// const [lambdaResolved, _, innerEnv] = evalLambdaBlock(state.paramName, state.expr, env);
|
||||
|
||||
// const inferredParamType = lambdaResolved.t.params[0](lambdaResolved.t);
|
||||
|
||||
// const innerEnv = env; // todo: change this
|
||||
|
||||
return <span className="lambdaBlock">
|
||||
<span className="keyword">λ</span>
|
||||
|
|
@ -55,7 +60,7 @@ export function LambdaBlock({state, setState, score}: LambdaBlockProps) {
|
|||
/>
|
||||
</span>
|
||||
<div className="typeSignature">
|
||||
:: <Type type={inferredParamType} />
|
||||
:: <Type type={paramType} />
|
||||
</div>
|
||||
|
||||
<span className="keyword">:</span>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue