@Richard Feldman I was thinking an error message like from Jest or Git diff would be good. Something that shows you color coded differences in expected vs actual.
hm, that could result in very long error messages for big types
the idea behind omitting things that are the same in both is to try to make the error messages shorter
I think when you get a diff from Jest and Git diff it also omits everything that is the same. It only shows you what has been added, removed or changed.
Something like this @Ashley Davis ?
There is a problem with the record type:
{ row : {
+ height : Num *,
+ offsetY : Num *,
- galleryWidth : Int U32,
- removedItems : List {},
- targetRowHeight : Int U32,
+ width: Int U64 # added type mismatch for example
- width: Int U32
…
}, … }
That would be awesome!
It's so clear exactly what's wrong.
@Ian McLerran that looks very nice in terms of the diff itself, but what would the complete error message say? :thinking:
How about:
── TYPE MISMATCH in Layout.roc ─────────────────────────────────────────────────
This 2nd argument to == has an unexpected type:
71│> out == {
72│> row: {
73│> items: currentRowItems,
74│> offsetY: 0,
75│> height: 21,
76│> currentRowItems: [],
77│> width: 12u64,
78│> headings
79│> },
80│> removedItems,
81│> remainingItems: []
82│> }
The record type has the following mismatches:
{ row : {
+ height : Num *,
+ offsetY : Num *,
- galleryWidth : Int U32,
- removedItems : List {},
- targetRowHeight : Int U32,
+ width: Int U64 # added type mismatch for example
- width: Int U32
…
}, … }
Tip: Try adding the fields marked with a minus, and removing the fields marked with a plus.
If a field appears with both plus and minus, check that the types match.
how about this wording?
── TYPE MISMATCH in Layout.roc ─────────────────────────────────────────────────
This 2nd argument to == has an unexpected type:
71│> out == {
72│> row: {
73│> items: currentRowItems,
74│> offsetY: 0,
75│> height: 21,
76│> currentRowItems: [],
77│> width: 12u64,
78│> headings
79│> },
80│> removedItems,
81│> remainingItems: []
82│> }
The provided record has these differences compared to the expected one:
{ row : {
+ height : Num *,
+ offsetY : Num *,
- galleryWidth : Int U32,
- removedItems : List {},
- targetRowHeight : Int U32,
+ width: Int U64
- width: Int U32
…
}, … }
I like that. That makes it clear without the tip how to associate the + / - with the expected type.
I’d only inverse the diff to suggest to the user how to change the received type to make it expected. I mean, I feel it should be a patch to apply to received type rather than diff with the expected one.
Green lines for me look as something good and red are bad. So I’d expected red lines mean something redundant and green lines are something to be added
how about this?
── TYPE MISMATCH in Layout.roc ─────────────────────────────────────────────────
This 2nd argument to == has an unexpected type:
71│> out == {
72│> row: {
73│> items: currentRowItems,
74│> offsetY: 0,
75│> height: 21,
76│> currentRowItems: [],
77│> width: 12u64,
78│> headings
79│> },
80│> removedItems,
81│> remainingItems: []
82│> }
Compared to what I got, here's what I expected:
{ row : {
- height : Num *,
- offsetY : Num *,
+ galleryWidth : Int U32,
+ removedItems : List {},
+ targetRowHeight : Int U32,
- width: Int U64
+ width: Int U32
…
}, … }
https://github.com/roc-lang/roc/issues/6906
Issue raised to track this
Last updated: Jun 16 2026 at 16:19 UTC