Nested types duplication


#1

I am working with some Dhall types like

let SimpleCollector : Type
  = < Regex : RegexCollector
    | Method : MethodCollector
    | Implements : ImplementsCollector
    | Extends : ExtendsCollector
    | Uses : UsesCollector
    | Inherits : InheritsCollector
    >
let BoolCollector : Type
  = { type: Text
    , must : List SimpleCollector
    , must_not : List SimpleCollector
    }
let Collector : Type
  = < Regex : RegexCollector
    | Method : MethodCollector
    | Implements : ImplementsCollector
    | Extends : ExtendsCollector
    | Uses : UsesCollector
    | Inherits : InheritsCollector
    | Bool : BoolCollector
    >

This creates a duplication between SimpleCollector and Collector constructors, which causes a bit of confusion.

Is it possible to avoid such duplication, maybe saying that Collector extends SimpleCollector with the BoolCollector case?


#2

It seems like you are looking for this proposal: https://github.com/dhall-lang/dhall-lang/issues/175 , but it hasn’t been standardized yet.


#3

thanks @tristanC, for the moment I’ll just keep them separate then