I have kinda the inverse problem of makeHaskellTypeFromUnion and fields with sum types
[Context:
I am in a setting where I want configuration to reach my ghcjs frontend, which can‘t depend on dhall.
But I still want to share types between frontend and backend so I can‘t generate my Haskell types from dhall.]
Let’s say I have a Haskell Type
data A = A1 | A2 deriving (Eg, Show, Generic, FromDhall)
data B = B { a :: A} deriving (Eg, Show, Generic, FromDhall)
Now I can write a Dhall file using
pretty . expected $ auto @A and pretty . expected $ auto @B (I need to write e.g. the let A = myself of course).
But the generated Code for B will contain a < A1 | A2 > and not refer to A. Which makes the dhall file much less readable when the types get bigger.
Is there a way to work around this?