💭
Bool → checkbox
enum w/ ≤ 4 constructors → radio buttons
enum w > 4 constructors → pop-up menu
String → text field
Int/Float → text field with formatter, steppers
product → vertically laid out
sum → tabs
recursive → list view
Yeah, one thing that is tricky is that you can have multiple representations for this stuff, so you might want to use a non-canonical module system for it. And switching between views can be handy for different stuff.
Yeah, it occurred to me that if you give a type for the UI then you can synthesize that type, or simply populate it, with the typechecker verifying that it lines up appropriately.
newtypes would be another handy route for that.
I get that newtypes allow different UI variants, but what is that synthesizing and verifying about? That doesn't look like the kind of feature which requires the compiler's involvement, a typeclass would suffice:
class UI a where
ui :: ParentWidget -> IO (Getter a, Setter a)
This is me probably over-thinking stuff, and in the mode of a language designer - you could probably do something less fancy in Haskell if you just wanted to use deriving or something.