a bit more progress
This commit is contained in:
parent
a9ae4f9888
commit
2b0d8bc2c6
8 changed files with 109 additions and 28 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import {getType, getInst, getSymbol, Double, Int, symbolFunction, symbolProduct, symbolSum, symbolDict, symbolSet, symbolList, eqType, match} from "dope2";
|
||||
import {getType, getInst, getSymbol, Double, Int, symbolFunction, symbolProduct, symbolSum, symbolDict, symbolSet, symbolList, eqType, match, getLeft, getRight} from "dope2";
|
||||
|
||||
import "./Value.css";
|
||||
|
||||
|
|
@ -20,6 +20,9 @@ export function Value({dynamic}) {
|
|||
// return <BinaryType type={type} cssClass="productType" infix="⨯" prefix="" suffix=""/>;
|
||||
case symbolSum:
|
||||
return <ValueSum val={inst} leftType={type.params[0](type)} rightType={type.params[1](type)}/>;
|
||||
case symbolProduct:
|
||||
return <ValueProduct val={inst} leftType={type.params[0](type)} rightType={type.params[1](type)}/>;
|
||||
|
||||
// case symbolDict:
|
||||
// return <BinaryType type={type} cssClass="dictType" infix="⇒" prefix="{" suffix="}"/>;
|
||||
// case symbolSet:
|
||||
|
|
@ -51,4 +54,7 @@ function ValueSum({val, leftType, rightType}) {
|
|||
return match(val)
|
||||
(l => <>L <Value dynamic={{i:l, t:leftType}}/></>)
|
||||
(r => <>R <Value dynamic={{i:r, t:rightType}}/></>);
|
||||
}
|
||||
function ValueProduct({val, leftType, rightType}) {
|
||||
return <>(<Value dynamic={{i:getLeft(val), t:leftType}}/>, <Value dynamic={{i:getRight(val), t:rightType}} />)</>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue