dhall-lang / dhall-haskell

Maintainable configuration files
https://dhall-lang.org/
BSD 3-Clause "New" or "Revised" License
908 stars 211 forks source link

add higher-kinded type support to TH #2506

Closed ndwarshuis closed 1 year ago

ndwarshuis commented 1 year ago

addresses other half of https://github.com/dhall-lang/dhall-haskell/issues/2475

Overview of changes to logic: rather than immediately parsing the dhall type into a union/single constructor, first recursively peel back any lambdas at the front of the dhall type and collect these in a bound variable list. Then when constructing the nested data type, add two paths for a) higher kinded haskell types (besides Maybe and List) and b) any of these bound variables from the front of the type.

The main gotcha is that this won't work with built-in From/ToDhall derivations as produced by GenerateOptions (or if this is possible I don't know how to do it). In any case the docs are updated to reflect this.