diff --git a/src/App.css b/src/component/app/App.css similarity index 100% rename from src/App.css rename to src/component/app/App.css diff --git a/src/App.tsx b/src/component/app/App.tsx similarity index 97% rename from src/App.tsx rename to src/component/app/App.tsx index df1a6b8..88251e1 100644 --- a/src/App.tsx +++ b/src/component/app/App.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import './App.css'; -import { ExprBlock, type ExprBlockState } from './ExprBlock'; -import { GlobalContext } from './GlobalContext'; +import { ExprBlock, type ExprBlockState } from '../expr/ExprBlock'; +import { GlobalContext } from '../../context/GlobalContext'; import { biggerExample, emptySet, factorial, higherOrder, higherOrder2Params, inc, initialEditorState, lambda2Params, nonEmptyEditorState, pushBool, tripleFunctionCallEditorState } from "./configurations"; import { actionShortcuts } from './actions'; // import { scoreResolved, type ResolvedType } from './eval'; diff --git a/src/actions.ts b/src/component/app/actions.ts similarity index 100% rename from src/actions.ts rename to src/component/app/actions.ts diff --git a/src/configurations.ts b/src/component/app/configurations.ts similarity index 99% rename from src/configurations.ts rename to src/component/app/configurations.ts index a212165..4f958d2 100644 --- a/src/configurations.ts +++ b/src/component/app/configurations.ts @@ -1,4 +1,4 @@ -import type { ExprBlockState } from "./ExprBlock"; +import type { ExprBlockState } from "../expr/ExprBlock"; export const initialEditorState: ExprBlockState = { kind: "input", diff --git a/src/CallBlock.css b/src/component/expr/CallBlock.css similarity index 100% rename from src/CallBlock.css rename to src/component/expr/CallBlock.css diff --git a/src/CallBlock.tsx b/src/component/expr/CallBlock.tsx similarity index 93% rename from src/CallBlock.tsx rename to src/component/expr/CallBlock.tsx index 71072d6..42293d7 100644 --- a/src/CallBlock.tsx +++ b/src/component/expr/CallBlock.tsx @@ -1,16 +1,15 @@ import { useContext } from "react"; -import { EnvContext } from "./EnvContext"; +import { EnvContext } from "../../context/EnvContext"; // import { addFocusRightMost, evalCallBlock2, evalExprBlock, recomputeTypeVarsForEnv, scoreResolved, type Environment, type ResolvedType } from "./eval"; import { ExprBlock, type ExprBlockState, type SetStateFn, type State2Props } from "./ExprBlock"; -import { GlobalContext } from "./GlobalContext"; -import { Value } from "./Value"; +import { GlobalContext } from "../../context/GlobalContext"; -import { getActions } from "./actions"; +import { getActions } from "../app/actions"; import "./CallBlock.css"; -import { CallContext } from "./CallContext"; -import { inferType, inferTypeCall, type Environment } from "./infer_type"; -import { Type } from "./Type"; +import { CallContext } from "../../context/CallContext"; +import { inferTypeCall, type Environment } from "../../eval/infer_type"; +import { Type } from "../other/Type"; export interface CallBlockState { kind: "call"; diff --git a/src/ExprBlock.css b/src/component/expr/ExprBlock.css similarity index 100% rename from src/ExprBlock.css rename to src/component/expr/ExprBlock.css diff --git a/src/ExprBlock.tsx b/src/component/expr/ExprBlock.tsx similarity index 91% rename from src/ExprBlock.tsx rename to src/component/expr/ExprBlock.tsx index 21346be..f995d0b 100644 --- a/src/ExprBlock.tsx +++ b/src/component/expr/ExprBlock.tsx @@ -3,18 +3,16 @@ import { useContext } from "react"; import { getType } from "dope2"; import { CallBlock, type CallBlockProps, type CallBlockState } from "./CallBlock"; -import { EnvContext } from "./EnvContext"; -import { GlobalContext } from "./GlobalContext"; +import { EnvContext } from "../../context/EnvContext"; +import { GlobalContext } from "../../context/GlobalContext"; import { InputBlock, type InputBlockProps, type InputBlockState } from "./InputBlock"; import { LambdaBlock, type LambdaBlockProps, type LambdaBlockState } from "./LambdaBlock"; import { LetInBlock, type LetInBlockProps, type LetInBlockState } from "./LetInBlock"; -import { Type } from "./Type"; // import { evalExprBlock, type ResolvedType } from "./eval"; import "./ExprBlock.css"; -import { Input } from "./Input"; -import { getActions } from "./actions"; -import { inferType } from "./infer_type"; +import { Input } from "../other/Input"; +import { getActions } from "../app/actions"; export type ExprBlockState = InputBlockState diff --git a/src/InputBlock.css b/src/component/expr/InputBlock.css similarity index 100% rename from src/InputBlock.css rename to src/component/expr/InputBlock.css diff --git a/src/InputBlock.tsx b/src/component/expr/InputBlock.tsx similarity index 93% rename from src/InputBlock.tsx rename to src/component/expr/InputBlock.tsx index d54a689..e0ea906 100644 --- a/src/InputBlock.tsx +++ b/src/component/expr/InputBlock.tsx @@ -1,18 +1,18 @@ import { memo, useContext, useEffect, useMemo, useRef, useState } from "react"; -import { getType, prettyT, trie } from "dope2"; +import { trie } from "dope2"; -import { EnvContext } from "./EnvContext"; +import { EnvContext } from "../../context/EnvContext"; // import type { Environment, ResolvedType } from "./eval"; import "./InputBlock.css"; -import { Type } from "./Type"; +import { Type } from "../other/Type"; import type { ExprBlockState, State2Props } from "./ExprBlock"; // import { attemptParseLiteral } from "./eval"; -import { Input } from "./Input"; -import { CallContext } from "./CallContext"; -import { getActions } from "./actions"; -import { GlobalContext } from "./GlobalContext"; -import { inferTypeInput } from "./infer_type"; +import { Input } from "../other/Input"; +import { CallContext } from "../../context/CallContext"; +import { getActions } from "../app/actions"; +import { GlobalContext } from "../../context/GlobalContext"; +import { inferTypeInput } from "../../eval/infer_type"; interface Literal { kind: "literal"; diff --git a/src/LambdaBlock.css b/src/component/expr/LambdaBlock.css similarity index 100% rename from src/LambdaBlock.css rename to src/component/expr/LambdaBlock.css diff --git a/src/LambdaBlock.tsx b/src/component/expr/LambdaBlock.tsx similarity index 91% rename from src/LambdaBlock.tsx rename to src/component/expr/LambdaBlock.tsx index 2201dc8..8efa9f3 100644 --- a/src/LambdaBlock.tsx +++ b/src/component/expr/LambdaBlock.tsx @@ -3,13 +3,13 @@ import { useContext } from "react"; // import { eqType, getSymbol, reduceUnification } from "dope2"; import { ExprBlock, type ExprBlockState, type State2Props } from "./ExprBlock"; -import { EnvContext } from "./EnvContext"; +import { EnvContext } from "../../context/EnvContext"; // import { evalExprBlock, evalLambdaBlock, makeInnerEnv, makeTypeVar } from "./eval"; import "./LambdaBlock.css"; -import { Type } from "./Type"; -import { Input } from "./Input"; -import { inferTypeLambda } from "./infer_type"; +import { Type } from "../other/Type"; +import { Input } from "../other/Input"; +import { inferTypeLambda } from "../../eval/infer_type"; export interface LambdaBlockState { kind: "lambda"; diff --git a/src/LetInBlock.css b/src/component/expr/LetInBlock.css similarity index 100% rename from src/LetInBlock.css rename to src/component/expr/LetInBlock.css diff --git a/src/LetInBlock.tsx b/src/component/expr/LetInBlock.tsx similarity index 93% rename from src/LetInBlock.tsx rename to src/component/expr/LetInBlock.tsx index f1a2b35..7bd7969 100644 --- a/src/LetInBlock.tsx +++ b/src/component/expr/LetInBlock.tsx @@ -1,15 +1,15 @@ import { useContext } from "react"; import { ExprBlock, type ExprBlockState } from "./ExprBlock"; -import { EnvContext } from "./EnvContext"; +import { EnvContext } from "../../context/EnvContext"; // import { evalExprBlock, makeInnerEnv, scoreResolved, type ResolvedType } from "./eval"; import { type State2Props } from "./ExprBlock"; -import { GlobalContext } from "./GlobalContext"; +import { GlobalContext } from "../../context/GlobalContext"; import "./LetInBlock.css"; -import { Input } from "./Input"; -import { inferTypeLet } from "./infer_type"; -import { Type } from "./Type"; +import { Input } from "../other/Input"; +import { inferTypeLet } from "../../eval/infer_type"; +import { Type } from "../other/Type"; export interface LetInBlockState { kind: "let"; diff --git a/src/Input.tsx b/src/component/other/Input.tsx similarity index 100% rename from src/Input.tsx rename to src/component/other/Input.tsx diff --git a/src/Type.css b/src/component/other/Type.css similarity index 100% rename from src/Type.css rename to src/component/other/Type.css diff --git a/src/Type.tsx b/src/component/other/Type.tsx similarity index 100% rename from src/Type.tsx rename to src/component/other/Type.tsx diff --git a/src/Value.css b/src/component/other/Value.css similarity index 100% rename from src/Value.css rename to src/component/other/Value.css diff --git a/src/Value.tsx b/src/component/other/Value.tsx similarity index 100% rename from src/Value.tsx rename to src/component/other/Value.tsx diff --git a/src/CallContext.ts b/src/context/CallContext.ts similarity index 100% rename from src/CallContext.ts rename to src/context/CallContext.ts diff --git a/src/EnvContext.ts b/src/context/EnvContext.ts similarity index 100% rename from src/EnvContext.ts rename to src/context/EnvContext.ts diff --git a/src/GlobalContext.ts b/src/context/GlobalContext.ts similarity index 100% rename from src/GlobalContext.ts rename to src/context/GlobalContext.ts diff --git a/src/eval.ts b/src/eval/eval.ts similarity index 100% rename from src/eval.ts rename to src/eval/eval.ts diff --git a/src/infer_type.ts b/src/eval/infer_type.ts similarity index 93% rename from src/infer_type.ts rename to src/eval/infer_type.ts index 14eb31f..5ae322f 100644 --- a/src/infer_type.ts +++ b/src/eval/infer_type.ts @@ -1,10 +1,10 @@ import { Double, eqType, fnType, IncompatibleTypesError, Int, mergeSubstitutionsN, occurring, prettySS, recomputeTypeVars, substitute, trie, TYPE_VARS, UNBOUND_SYMBOLS, unify } from "dope2"; -import type { CallBlockState } from "./CallBlock"; -import type { ExprBlockState } from "./ExprBlock"; -import type { InputBlockState } from "./InputBlock"; -import type { LambdaBlockState } from "./LambdaBlock"; -import type { LetInBlockState } from "./LetInBlock"; +import type { CallBlockState } from "../component/expr/CallBlock"; +import type { ExprBlockState } from "../component/expr/ExprBlock"; +import type { InputBlockState } from "../component/expr/InputBlock"; +import type { LambdaBlockState } from "../component/expr/LambdaBlock"; +import type { LetInBlockState } from "../component/expr/LetInBlock"; export interface Environment { names: any; @@ -93,7 +93,7 @@ export function inferTypeCall(s: CallBlockState, env: Environment): TypeInfoCall const subs = unify( fnTypeInfo.type, fakeFnType); - console.log("subs:", prettySS(subs)); + // console.log("subs:", prettySS(subs)); let type, newEnv; if (subs.has(returnType!.symbol)) { type = subs.get(returnType!.symbol); @@ -136,8 +136,6 @@ export function inferTypeLet(s: LetInBlockState, env: Environment): TypeInfoLamb names: trie.insert(env.names)(s.name)({kind: "value", t: valTypeInfo.type}), typevars: env.typevars, }; - console.log(s.name); - console.log("innerEnv.names:", innerEnv.names); return { ...inferType(s.inner, innerEnv), paramType: valTypeInfo.type, diff --git a/src/main.tsx b/src/main.tsx index c1e5878..5f17329 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,6 +1,6 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' -import { App } from './App.tsx' +import { App } from './component/app/App.tsx' import './index.css' import '@fontsource-variable/inconsolata/standard.css';