finos / finos/morphir

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

Open
#224 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
209
Forks
65
Avg merge
8h 55m
Merged PRs (30d)
126

Description

### Discussed in https://github.com/finos/morphir/discussions/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:

```elm
module Morphir.IR.Ref exposing (..)

type Ref
= ModuleLocalRef Name
| PackageLocalRef QName
| GlobalRef FQName
```

Then we can replace `FQName` in `Reference` in both places:

```elm
module Morphir.IR.Type exposing (..)

type Type a
= ...
| Reference a Ref (List (Type a))
| ...
```

```elm
module Morphir.IR.Value exposing (..)

type Value ta va
= ...
| Constructor va Ref
| Reference va Ref
| ...
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.