agda / agda-stdlib

The Agda standard library

Home Page:https://wiki.portal.chalmers.se/agda/Libraries/StandardLibrary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why is `Data.List.Relation.Binary.Subset.Setoid.Properties` not parametrized on the `Setoid` as a whole

andreasabel opened this issue · comments

Module Data.List.Relation.Binary.Subset.Setoid is parametrized on a Setoid, but its Properties module not:

module Data.List.Relation.Binary.Subset.Setoid.Properties where

Instead, each function is parametrized there individually, via anonymous modules.
Is there a reason why it is organized like this?

I would have expected to open the Properties module in the same way as its parent module.

This tends to be for historical reasons rather than any 'good' reason. Evolution of the library happens haphazardly sometimes (no matter how hard we try to review PRs).

In other words, I'd call this a plain bug awaiting a PR to fix it.

No, there's a good reason for all such Properties modules being designed this way. If you parameterise it by a single setoid, then you can't prove properties of functions that move between different types, e.g. map.

But as @omelkonian writes on #2389 , this is not the case for eg Data.List.Relation.Binary.Permutation.Setoid.Properties, leading to undesirable consequences... wrt map :-( so @JacquesCarette 's point about historical/legacy inconsistency stands.

Ditto. The proposed addition in #2393 ...?

No, there's a good reason for all such Properties modules being designed this way. If you parameterise it by a single setoid, then you can't prove properties of functions that move between different types, e.g. map.

Is this design principle documented anywhere?

But as @omelkonian #2389 (comment), this is not the case for eg Data.List.Relation.Binary.Permutation.Setoid.Properties, leading to undesirable consequences... wrt map :-(

Yes that should really be fixed.

Is this design principle documented anywhere?

No, sadly not 😓