simplify suggestions ordering
This commit is contained in:
parent
fdbf43a4e9
commit
bb6e742f5f
8 changed files with 109 additions and 110 deletions
|
|
@ -4,7 +4,7 @@ import { eqType, getSymbol, reduceUnification } from "dope2";
|
|||
|
||||
import { ExprBlock, type ExprBlockState, type State2Props } from "./ExprBlock";
|
||||
import { EnvContext } from "./EnvContext";
|
||||
import { evalEditorBlock, makeInnerEnv, makeTypeVar } from "./eval";
|
||||
import { evalExprBlock, makeInnerEnv, makeTypeVar } from "./eval";
|
||||
|
||||
import "./LambdaBlock.css";
|
||||
import { Type } from "./Type";
|
||||
|
|
@ -17,14 +17,14 @@ export interface LambdaBlockState {
|
|||
expr: ExprBlockState;
|
||||
}
|
||||
|
||||
interface LambdaBlockProps<
|
||||
export interface LambdaBlockProps<
|
||||
FnState=ExprBlockState,
|
||||
InputState=ExprBlockState,
|
||||
> extends State2Props<LambdaBlockState,ExprBlockState> {
|
||||
}
|
||||
|
||||
|
||||
export function LambdaBlock({state, setState, suggestionPriority}: LambdaBlockProps) {
|
||||
export function LambdaBlock({state, setState, score}: LambdaBlockProps) {
|
||||
const env = useContext(EnvContext);
|
||||
|
||||
const setParamName = paramName => setState(state => ({
|
||||
|
|
@ -38,7 +38,7 @@ export function LambdaBlock({state, setState, suggestionPriority}: LambdaBlockPr
|
|||
|
||||
const [paramType, staticInnerEnv] = makeTypeVar(env, state.paramName);
|
||||
|
||||
const [exprResolved] = evalEditorBlock(state.expr, staticInnerEnv);
|
||||
const [exprResolved] = evalExprBlock(state.expr, staticInnerEnv);
|
||||
|
||||
const inferredParamType = reduceUnification(exprResolved.unification).get(getSymbol(paramType)) || paramType;
|
||||
|
||||
|
|
@ -76,9 +76,9 @@ export function LambdaBlock({state, setState, suggestionPriority}: LambdaBlockPr
|
|||
state={state.expr}
|
||||
setState={setExpr}
|
||||
onCancel={() => setState(state => state.expr)}
|
||||
suggestionPriority={(s) => {
|
||||
score={(s) => {
|
||||
// console.log('suggestionPriority of lambdaInner... just passing through');
|
||||
return suggestionPriority(s);
|
||||
return score(s);
|
||||
}}
|
||||
/>
|
||||
</EnvContext>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue