How do they work? I'd like to write code like:
MyType: { disabled ? Bool }
my_list: List MyType
my_list = [{}, {disabled: Bool.true}]
List.map my_list |{disabled ?? False}|
#...
However, the compiler does not see {} and {disabled: Bool.true} as both conforming to MyType. The error message says "find out more at TODO"
That feature is actually being removed in the new compiler, so may not be worth worrying about.
I think that it should be this though:
MyType: { disabled ? Bool }
my_list: List MyType
my_list = [{}, {disabled: Bool.true}]
List.map my_list |{disabled ? Bool.False}|
#...
So in the new compiler, will there be any way to say that a record field is
optional?
As of current there is no planned feature to replace it.
builder pattern is a common alternative
ok, thanks!
I think the paradigm used for languages like Roc implies using some kind of an option type and a function that gets default value when it's not set
Last updated: Jan 12 2026 at 12:19 UTC