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

Allow local references in addition to fully qualified ones in types and values #224

Open
AttilaMihaly opened this issue Jan 11, 2024 Discussed in #220 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@AttilaMihaly
Copy link
Member

Discussed in #220

Multiple community members brought up the wish to handle smaller portions of the IR as independent units instead of always working with an entire distribution. While the IR is very composable and you can independently define individual types or functions one specific design choice makes that less feasible:

The fact that we use fully qualified names in every reference (types, values, constructors) means that even when you are looking at a single definition you still need to be aware of the whole IR structure when you are trying to resolve a reference even if it is local.

To fix this we can introduce a new type:

module Morphir.IR.Ref exposing (..)

type Ref
    = ModuleLocalRef Name
    | PackageLocalRef QName
    | GlobalRef FQName

Then we can replace FQName in Reference in both places:

module Morphir.IR.Type exposing (..)

type Type a
    = ...
    | Reference a Ref (List (Type a))
    | ...
module Morphir.IR.Value exposing (..)

type Value ta va
    = ...
    | Constructor va Ref
    | Reference va Ref
    | ...
@AttilaMihaly AttilaMihaly added the enhancement New feature or request label Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant