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

Importing instantiated submodule doesn't introduce members into scope. #1366

Closed
Tracked by #1363
rybla opened this issue Jun 15, 2022 · 2 comments
Closed
Tracked by #1363

Importing instantiated submodule doesn't introduce members into scope. #1366

rybla opened this issue Jun 15, 2022 · 2 comments
Labels
parameterized modules Related to Cryptol's parameterized modules

Comments

@rybla
Copy link
Collaborator

rybla commented Jun 15, 2022

#1363

When I run Lib2, I'm told Value not in scope: x. But it should be available from import submodule Lib1_Inst?

module Lib1 where
parameter
  type a : *
  x : a


module Lib2 where
parameter
  type b : *
  y : b

submodule Lib1_Inst = Lib1
  where
  type a = b
  x = y

import submodule Lib1_Inst
z : b
z = x
@rybla rybla added the parameterized modules Related to Cryptol's parameterized modules label Jun 15, 2022
@yav
Copy link
Member

yav commented Jun 15, 2022

Module Lib1 does not define anything, so when you import its instances Lib1_Inst you don't get anything in scope.

Perhaps the desugaring of Lib1 would help:

interface module S where
  type a : *
  x : a

module Lib1 where
  import interface S

Basically I think of module parameters as extra values that you have in scope, but they are not definitions in the module. of course, you could add extra definitions that are simply defined as the parameter, which would kind of mimic "exporting" a parameter.

@rybla
Copy link
Collaborator Author

rybla commented Jun 15, 2022

Ok, yeah I misunderstood how parameters work. They "disappear" when you instantiate the functor; they aren't additional definitions that are exported.

@rybla rybla closed this as completed Jun 15, 2022
@m-yac m-yac mentioned this issue Jul 14, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parameterized modules Related to Cryptol's parameterized modules
Projects
None yet
Development

No branches or pull requests

2 participants