Records with truly optional fields


I think you might have mixed Neuron and its type. From the error it looks like you gave Neuron the type { Type = ..., default = ... }. But Neuron should have the value { Type = ..., default = ... } and the type { Type : Type, default : ... } (note the difference between = and :.


FWIW, your solution is virtually equivalent to the one suggested in dhall-haskell issue #1521 and the problem is very similar as well.


It’s probably worth documenting somewhere then


@Nadrieril: I can try to write this up as a quick How-to guide or addition to the FAQ for the Dhall wiki


Keep in mind that by naively using // you will run into issues with nested merges, should you choose to later implement them.

It’ll be fine if all of your fields stay in the top level though.


in retrospective I wasn’t very clear when I wrote

so that you can merge the defaults in the application and allow the user to truly omit the optional fields

The only “downside” I see is that you must check the configuration with neuron and not with dhall itself but that’s probably a good thing since it might involve more than typechecking :smile: