1

I'm trying to implement a generic procedure that uses merge with an abstract type, but it always fail with ❰merge❱ expects a record of handlers, even when the caller pass a record type:

let Keys
    : Type
    = < A | B >

let ConfigType
    : Type
    = { A : Text, B : Text }

let Renderer =
        λ(configType : Type)
      → λ(config : configType)
      → λ(value : Keys)
      → merge config value

in  Renderer ConfigType { A = "A", B = "B" } Keys.A

Is it possible to indicate that configType will be a record type so that this generic method can be interpreted?

tristanC
  • 35
  • 4
  • Practical use-case shown in this [change](https://github.com/TristanCacqueray/dhall-zuul/pull/1/files) as a follow-up to this [question](https://stackoverflow.com/questions/58782992/what-is-the-dhall-idiomatic-way-to-associate-different-schemas-to-union-values) – tristanC Nov 10 '19 at 13:41

1 Answers1

1

No, this is currently not possible within the language.

In the following GitHub issue we discussed adding a Row kind to the language to distinguish record types from other types:

https://github.com/dhall-lang/dhall-lang/issues/434

... but ultimately solved the original problem in a different manner.

Gabriella Gonzalez
  • 34,863
  • 3
  • 77
  • 135
  • Thanks for confirming, that's what I thought. In my use-case I only need to do 3 different merge, thus implementing a generic procedure isn't necessary. – tristanC Nov 11 '19 at 16:06