mirror of
https://codeberg.org/ProgramSnail/prog_synthesis.git
synced 2025-12-24 13:58:42 +00:00
type check preparation: add types to oracle
This commit is contained in:
parent
b7963e87a6
commit
edc6c373b0
8 changed files with 179 additions and 803 deletions
|
|
@ -7,7 +7,10 @@ import Control.Monad (foldM)
|
|||
|
||||
import Debug.Trace (trace)
|
||||
|
||||
type Oracle = [Value] -> Maybe Value
|
||||
type OracleFunc = [Value] -> Maybe Value
|
||||
|
||||
data Oracle = Oracle { oracleTypes :: TypeConf,
|
||||
oracleFunc :: OracleFunc }
|
||||
|
||||
data Conf = Conf {confInput :: [Value],
|
||||
confOracle :: Oracle,
|
||||
|
|
@ -96,7 +99,7 @@ eval conf (SelfE es) = do recInput <- foldM (\es e -> consValsM es (eval conf e)
|
|||
if not $ and $ zipWith structuralLess recInput (confInput conf)
|
||||
then RecError $ "self call on >= exprs, new=" ++ show recInput ++ " old=" ++ show (confInput conf)
|
||||
else do
|
||||
case confOracle conf recInput of
|
||||
case (oracleFunc $ confOracle conf) recInput of
|
||||
Just recOutput -> if recInput `elem` confExamples conf
|
||||
then return recOutput
|
||||
else NewExamples $ trace ("newExample: " ++ show [(recInput, recOutput)]) [(recInput, recOutput)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue