snoyberg / mono-traversable

Type classes for mapping, folding, and traversing monomorphic containers
155 stars 67 forks source link

RULES have problems substituting polymorphic sequence types #216

Closed BebeSparkelSparkel closed 8 months ago

BebeSparkelSparkel commented 1 year ago

I have been trying to get functions like Data.Sequences.stripPrefix to be substituted with the defined rules but it is finicky if used in a function with a polymorphic collection type. It requires persistent inlining of all the functions to the final type specification to not use the "default" implementation.

It seems that a super class would get rid of this problem and allow the more efficient definition to be used.

class (IsSequence seq, Eq (Element seq)) => EqElement seq
BebeSparkelSparkel commented 9 months ago

Any thoughts on this?

snoyberg commented 9 months ago

I'm overall -1. Rewrite rules have been notoriously difficult to get to fire reliably, and a breaking API change to account for that would be worth it IMO.

BebeSparkelSparkel commented 9 months ago

@snoyberg I'm not sure what "-1" means

snoyberg commented 8 months ago

Meaning: overall not in favor.

BebeSparkelSparkel commented 8 months ago

Thanks it seemed contrary to your second sentence.