Confusing error when creating record-type which references a nullary type.
What's the message you're seeing? Context, this issue cropped up in this discussion, around a more complicated record type: https://github.com/unisonweb/unison/discussions/5669#
The minified structure is as follows:
-- nullary type
type V4 =
-- referred to in a wrapper type
type UserId = UserId V4
-- regular type can be defined
type ANonRecordType = ANonRecordType UserId Nat
-- creates a confusing error
type MyRecordType
= {
a : UserId,
b: Nat
}
The error produced sounds like a pattern match error:
Loading changes detected in ~/Unison/projectsCodebase/volturno.u.
This case would be ignored because it's already covered by the preceding case(s):
10 | a : UserId,
What would a better version look like?
I'm of two minds since the regular type definition doesn't create an error, perhaps the record type shouldn't.
This is a perfectly fine type definition, you just can't make an instance of it:
type StaringInto = StaringInto base.Void
But that might push the issue down to when the user wants to create an instance of their record type, which might be equally confounding.
Alternatively, maybe the error message could say something like
The record type you're trying to write depends upon a type that has no constructors. It contains functions that can never be run because an instance of the following type can never be created:
<name of nullary type here>
Environment (please complete the following information):
- Version: release/0.5.37-85-g142863dd1 (The types on hover version)
- OS/Architecture: macOS 14.7.3, apple silicon