mirror of
https://codeberg.org/ProgramSnail/prog_synthesis.git
synced 2025-12-06 05:28:42 +00:00
empty list type check fix, add typecheck to forward step (no tests yet)
This commit is contained in:
parent
edc6c373b0
commit
753ca23cbc
2 changed files with 23 additions and 12 deletions
|
|
@ -10,7 +10,7 @@ import Data.Set (Set)
|
|||
import qualified Data.Map as Map
|
||||
import qualified Data.Set as Set
|
||||
import Data.List (inits)
|
||||
import Data.Maybe (fromMaybe, isJust, maybeToList)
|
||||
import Data.Maybe (fromMaybe, isJust, maybeToList, isNothing)
|
||||
|
||||
import Debug.Trace (trace)
|
||||
import TypeCheck
|
||||
|
|
@ -54,12 +54,14 @@ matchAnyOutputs outputs = do exprs <- gets syntExprs
|
|||
-- generate next step of exprs, remove copies
|
||||
forwardStep :: Expr -> [Expr] -> SyntState (Maybe Expr)
|
||||
forwardStep comp args = do let expr = fillHoles comp args
|
||||
outputs <- calcExprOutputs expr
|
||||
matchedExisting <- gets $ evalState (matchAnyOutputs outputs)
|
||||
-- TODO: all RecErrors example could be useful on future cases ?
|
||||
if any isFatalError outputs || all isRecError outputs || matchedExisting then return Nothing else do
|
||||
modify $ \st -> st { syntExprs = (expr, []) : syntExprs st}
|
||||
return $ Just expr
|
||||
typeConf <- gets $ oracleTypes . syntOracle
|
||||
if isNothing $ checkType typeConf expr then return Nothing else do
|
||||
outputs <- calcExprOutputs expr
|
||||
matchedExisting <- gets $ evalState (matchAnyOutputs outputs)
|
||||
-- TODO: all RecErrors example could be useful on future cases ?
|
||||
if any isFatalError outputs || all isRecError outputs || matchedExisting then return Nothing else do
|
||||
modify $ \st -> st { syntExprs = (expr, []) : syntExprs st}
|
||||
return $ Just expr
|
||||
|
||||
splitGoal :: Goal -> [Bool] -> Resolver
|
||||
splitGoal resolverGoal@(Goal outputs) selector | length outputs == length selector =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue