Skip to content

Commit

Permalink
Load and bring into scope the magic Cryptol Array module.
Browse files Browse the repository at this point in the history
Perhaps this should be configurable; or we should implement
the ability to load modules by name to avoid needing this
to be baked-in.
  • Loading branch information
robdockins committed Jul 25, 2022
1 parent 7572c95 commit 190423b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cryptol-saw-core/src/Verifier/SAW/CryptolEnv.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ import qualified Cryptol.ModuleSystem.Renamer as MR
import qualified Cryptol.Utils.Ident as C

import Cryptol.Utils.PP hiding ((</>))
import Cryptol.Utils.Ident (Ident, preludeName, preludeReferenceName
import Cryptol.Utils.Ident (Ident, preludeName, arrayName, preludeReferenceName
, packIdent, interactiveName, identText
, packModName, textToModName, modNameChunks
, prelPrim)
Expand Down Expand Up @@ -189,10 +189,12 @@ initCryptolEnv sc = do
let modEnv1 = modEnv0 { ME.meSearchPath = cryptolPaths ++
(instDir </> "lib") : ME.meSearchPath modEnv0 }

-- Load Cryptol prelude
-- Load Cryptol prelude and magic Array module
(_, modEnv2) <-
liftModuleM modEnv1 $
MB.loadModuleFrom False (MM.FromModule preludeName)
do _ <- MB.loadModuleFrom False (MM.FromModule preludeName)
_ <- MB.loadModuleFrom False (MM.FromModule arrayName)
return ()

-- Load Cryptol reference implementations
((_,refMod), modEnv) <-
Expand All @@ -213,6 +215,7 @@ initCryptolEnv sc = do
return CryptolEnv
{ eImports = [ (OnlyPublic, P.Import preludeName Nothing Nothing)
, (OnlyPublic, P.Import preludeReferenceName (Just preludeReferenceName) Nothing)
, (OnlyPublic, P.Import arrayName Nothing Nothing)
]
, eModuleEnv = modEnv
, eExtraNames = mempty
Expand Down

0 comments on commit 190423b

Please sign in to comment.