Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include REPL let bindings in the reference interpreter #1152

Merged
merged 2 commits into from
Apr 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docs/ProgrammingCryptol.pdf
Binary file not shown.
Binary file modified docs/Semantics.pdf
Binary file not shown.
6 changes: 3 additions & 3 deletions src/Cryptol/Eval/Reference.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ and type variables that are in scope at any point.
> instance Semigroup Env where
> l <> r = Env
> { envVars = envVars l <> envVars r
> , envTypes = envTypes l <> envTypes r
> , envTypes = envTypes l <> envTypes r
> }
>
> instance Monoid Env where
Expand Down Expand Up @@ -523,7 +523,7 @@ newtypes is thus basically just an identity function
that consumes and ignores its type arguments.

> evalNewtypeDecl :: Env -> Newtype -> Env
> evalNewtypeDecl env nt = bindVar (ntName nt, pure val) env
> evalNewtypeDecl env nt = bindVar (ntName nt, pure val) env
> where
> val = foldr tabs con (ntParams nt)
> con = VFun (\x -> x)
Expand Down Expand Up @@ -1732,7 +1732,7 @@ running the reference evaluator on an expression.
> evaluate expr minp = return (Right (val, modEnv), [])
> where
> modEnv = M.minpModuleEnv minp
> extDgs = concatMap mDecls (M.loadedModules modEnv)
> extDgs = concatMap mDecls (M.loadedModules modEnv) ++ M.deDecls (M.meDynEnv modEnv)
> nts = Map.elems (M.loadedNewtypes modEnv)
> env = foldl evalDeclGroup (foldl evalNewtypeDecl mempty nts) extDgs
> val = evalExpr env expr
3 changes: 3 additions & 0 deletions tests/issues/issue1133.icry
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let x = zero:[8]
x@0
:eval x@0
3 changes: 3 additions & 0 deletions tests/issues/issue1133.icry.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Loading module Cryptol
False
False