Skip to content

*Top-level* Record definitions need accompanying type signatures #2112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jamesmckinna opened this issue Sep 28, 2023 · 2 comments
Closed

*Top-level* Record definitions need accompanying type signatures #2112

jamesmckinna opened this issue Sep 28, 2023 · 2 comments

Comments

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Sep 28, 2023

Working on #2111 exposes a previously uncaught error: under Data.Tree.AVL, a number of modules (attempt to) declare 'local' instances of StrictTotalOrder without declaring a suitable type signature for them, which worked perfectly fine as long as this record type was a leaf in the Algebra.Bundles hierarchy...

... but adding (Is)DenseLinearOrder as a sub(structure)/bundle of (Is)StrictTotalOrder has now broken that.

Remedy: identify all record definitions without a type signature, and supply it appropriately.
UPDATED: issue only applies to top-level definitions; within the scope of an enclosing record, the type of the field being defined as a sub-record ensures that a suitable type is being supplied to the typechecker.
UPDATED: I've attempted to identify any other instances in the library, but it seems just to have been these 'historical' examples. Suggest closing the issue now/for the time being.

@jamesmckinna jamesmckinna changed the title Record definitions need accomanying type signatures Record definitions need accompanying type signatures Sep 28, 2023
@MatthewDaggitt
Copy link
Contributor

Ooh interesting. Haven't come across that sort of bug before!

@jamesmckinna
Copy link
Contributor Author

jamesmckinna commented Sep 29, 2023

So the bug expressed itself in terms of unsolved Level meta variables... my diagnosis in terms of leaves in the hierarchy is post hoc inference, and there may be other possibilities, but inserting the type declaration certainly solves/d the instances that came up.

And yes, a weird one! Added label:bug because this is a 'latent' bug, and one to program defensively against.

@jamesmckinna jamesmckinna changed the title Record definitions need accompanying type signatures *Top-level* Record definitions need accompanying type signatures Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants