Open lastland opened 3 years ago
Comment by nomeata Wednesday Oct 17, 2018 at 08:38 GMT
The problem is that it is not always correct. You can have
instance Semigroup a where (<>) = mappend -- this is actually the default definition
instance Monoid a where mappend = …
So if you add a default order, you have to provide a clever way of allowing the user to disable them. (Just adding the conflicting orders to the set of oderings will cause cycles.) Doable, but unfortunately pretty complicate, also to explain to users.
Comment by antalsz Wednesday Oct 17, 2018 at 18:05 GMT
Damn, that's true >_<.
That opens up the option for more complex heuristics (e.g., "if the definition of mappend
is <>
, do this order; if the other way around, do that order"), but those are more of a pain.
The superclass constraint issue is always a necessary order, at least.
Issue by antalsz Wednesday Oct 17, 2018 at 07:51 GMT Originally opened as https://github.com/antalsz/hs-to-coq/issues/111
It might be nice to impose "default order" constraints, such as
T
, putSemigroup
beforemappend
(i.e.,Semigroup__T
beforeMonoid__T_mappend
)T
, putEq_
beforeOrd
(i.e.,Eq___T
beforeOrd__T
)(For the
Eq_
/Ord
one, we might be able to autogenerate this from the superclass constraints).