finos/morphir-elm

Merge Record and ExtensibleRecord types in the IR

开放

#166 创建于 2020年9月30日

 (2 条评论) (0 个反应) (0 位负责人)Elm (69 个派生)auto 404
good first issuehelp wantedir-simplification

仓库指标

星标
 (51 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Currently there are two separate constructors for Record and ExtensibleRecord in the IR: https://github.com/finos/morphir-elm/blob/55f27570f971e8c4e12fe1a0346dffdce594869e/src/Morphir/IR/Type.elm#L89-L90

These correspond to the following Elm code (excluding the left-hand-side):

type alias MyRecord =
    { foo : String
    }

type alias MyExtensibleRecord e =
    { e
        | foo : String
    }

The structure and semantics of the two definitions are very similar and in most cases the code that operates on them will share most of the logic so merging them will make the IR smaller and easier to process. This is one way to represent both with a single constructor:

    | Record a (Maybe Name) (List (Field a)) 

Acceptance Criteria

贡献者指南