Opened 3 years ago

Closed 3 years ago

#8543 closed task (duplicate)

`Coercible` ought to work for recursive newtypes

Reported by: nomeata Owned by: nomeata
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.3
Keywords: Cc: dimitris@…, sweirich@…, diatchki
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #8503 Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

The approach (developed by SPJ and me) is to

A) Add a feature to the constraint solver to prevent recursive dictionaries for specially marked instances (for now only used for Coercible). Rationale: Such dictionaries (which are fine for most classes like Show) would make coerce diverge. Implementation: Use the depth counter and do not use lower depths to solver constraints with a higher depth. This is of course a very conservative approximation, but should be sufficient.

B) Use the regular constraint depth bound to prevent looping at compile time. In order for that to be more useful, count constraint solving and type function resolving separately.

Change History (1)

comment:1 Changed 3 years ago by simonpj

Cc: dimitris@… sweirich@… diatchki added
Description: modified (diff)
Resolution: duplicate
Status: newclosed

I think it's better to keep this ticket with #8503, which has all the context. I've moved the comment there.


Note: See TracTickets for help on using tickets.