Skip to content

Allow referring to type synonym in functor instantiation #1968

@RyanGlScott

Description

@RyanGlScott

Surprisingly, one cannot write something like this using Cryptol's module system:

 module TypeAlias where
  interface submodule Interface where
    type Alias = Bool
    value: Alias

  submodule Functor where
    import interface submodule Interface

  submodule Instance = submodule Functor where
    value = False: Alias
Loading module TypeAlias
[error] at TypeAlias.cry:10:20--10:25
    Type not in scope: Alias

On the other hand, if you leave off the explicit type signature for value in Instance:

  submodule Instance = submodule Functor where
    value = False

Then Cryptol accepts it. This works around the issue, but it is not a very satisfying workaround. Some use cases for functor instantiations involve complex type definitions, where redefining the type alias is complicated and redundant.

It would be nice if Cryptol provided some way to write value = False: Alias.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestAsking for new or improved functionalityparameterized modulesRelated to Cryptol's parameterized modules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions