Comments (18)
We're importing just Data.Nat.Properties
as ℕₚ
, ℕᵖ
, ℕ
, Nat
, and ℕ-Prop
...
from agda-stdlib.
This is definitely mostly my fault, I've definitely shifted over the years. My current go-to style is to import Data.Nat.Properties
as simply as ℕ
, as the reason you need to disambiguate the Properties
files is to avoid clashes with other datatypes. So my proposal would be to:
- name the properties file
Data.X.Properties
after the name of the main datatype inData.X
.
from agda-stdlib.
I'd been groping towards @MatthewDaggitt 's proposal for a while, but not quite sure if one can simultaneously import Data.X.Base and Data.X.Properties both as X, but it seems as though you can...
Yup, there's no problem there.
That said, I would still prefer to import as literal X, and hence ASCII/UTF-8 as a (Unix) filename, rather than 'symbolic' X, ie Nat rather than ℕ, but it seems as though I'm in a minority on this one...?
Hmm so this would be naming if after the module name not the datatype name? Or do you mean the datatype name transcribed to ASCII, i.e. would Data.Foo.Properties
with a datatype called \.
in Data.Foo.Base
be imported as Dot
?
from agda-stdlib.
If we're naming the qualifier after the datatype, what should be the convention for datatypes with long names?
Do you have any examples? I'm not aware of any datatypes with ridiculously long names.
What about when we're importing two modules for datatypes with the same name, e.g., Data.Vec.Relation.Unary.All and Data.List.Relation.Unary.All?
I think these should be named after the same datatype as everything else, i.e. the main datatype in Data.X
. So these would be named Vec
and List
respectively.
We very rarely ever have the case that datatypes have the same name. We usually disambiguate them somehow, e.g. binary naturals, unnormalised rationals etc. so I don't think we'll run into that problem.
from agda-stdlib.
We have a long tradition of using Xₚ
for the qualified import of Data.X.Properties
.
from agda-stdlib.
This is one of the areas where I'd lean hard on 'convention' rather than making the style 'standard'. In other words, we won't get complete uniformity, but we'll get a lot closer.
For example, points 2-3 above de facto end up being ASCII, so if we remove the first point (because we don't want to change the tradition wrt Data.X.Properties
), it's still going to be mostly true.
from agda-stdlib.
Re: X_p and ASCII
There's still some discrepancy between Nat_p and \bN_p, and... so on.
And Fin never seems to be consistently named, Properties or otherwise...
from agda-stdlib.
I'm all for consistency. For sure we'd want to pick a single name for Data.Nat.Properties
in stdlib.
from agda-stdlib.
I'd been groping towards @MatthewDaggitt 's proposal for a while, but not quite sure if one can simultaneously import Data.X.Base
and Data.X.Properties
both as X
, but it seems as though you can...
That said, I would still prefer to import as literal X
, and hence ASCII/UTF-8 as a (Unix) filename, rather than 'symbolic' X
, ie Nat
rather than ℕ
, but it seems as though I'm in a minority on this one...?
from agda-stdlib.
Module name. Your thought experiment litmus test example would import as "Foo"... but thanks for the ingenuity of the challenge ;-)
from agda-stdlib.
Okay, so when you said
I'd been groping towards @MatthewDaggitt 's proposal for a while, but not quite sure if one can simultaneously import Data.X.Base and Data.X.Properties both as X, but it seems as though you can... That said, I would still prefer to import as literal X, and hence ASCII/UTF-8 as a (Unix) filename, rather than 'symbolic' X, ie Nat rather than ℕ, but it seems as though I'm in a minority on this one...?
you weren't supporting my proposal for naming it after the datatype (leaving aside ASCII/non-ASCII)?
My feeling is that we want the qualified names of the Base
modules to be as short as possible. When you have big long equations with lots of qualified operators, you want them to be short. So I would strongly be against importing the Base
names as Nat
rather than ℕ
. Given that, it would be weird to then call the Properties
modules Nat
rather than ℕ
...
from agda-stdlib.
Ok, I see your point. I had been trying to argue for ASCII throughout, and you for datatype name (throughout?, Properties
as well as Base
? I'm not thrilled about the subscript p, FWIW) but I don't want to make this a hill on which to die. Consistency, and understanding/documenting the convention, are much more important, IMHO.
That said, can/should/will we then import the PropositionalEquality
module(s) as ≡
... I hope so. P
and PropEq
etc. don't do it for me...
from agda-stdlib.
The subscript p should definitely go!
That said, can/should/will we then import the PropositionalEquality module(s) as ≡... I hope so. P and PropEq etc. don't do it for me...
Yes, I think so! I think that falls neatly under my proposed scheme of naming the qualifier after the datatype.
from agda-stdlib.
If we're naming the qualifier after the datatype, what should be the convention for datatypes with long names? What about when we're importing two modules for datatypes with the same name, e.g., Data.Vec.Relation.Unary.All
and Data.List.Relation.Unary.All
?
from agda-stdlib.
Do we have examples of this in the library, where we need to name those modules for qualified import
?
Nevertheless, the question stands, so I suppose we would need to agree a disambiguation scheme, eg in your example, to import as VecAll
and ListAll
? (again, using the datatype name as a root to the 'long' name...?)
from agda-stdlib.
Closed by #2270 ? Or worth keeping open as a reminder to enact the recommendations, both going forward, and when updating old modules...?
from agda-stdlib.
Yes to close, since the style guide has been updated. Opening a fresh issue with a list of the old modules that need to be updated would be a good idea.
from agda-stdlib.
The horror! The horror! What a list... and how to face tackling it... :-( will file an issue in some form or other eventually ;-)
from agda-stdlib.
Related Issues (20)
- List of wrinkles in `Data.List.Properties` HOT 7
- List of sub-optimal definitions in `Data.List.Base` HOT 25
- Add the `Setoid`al structure of a (free) `Monoid` on `List` HOT 1
- lib2.0 : `ℕᵇ `(binary) can be pure unlike `ℕ`. HOT 8
- To let or not to let HOT 3
- lemma for `map` for `⊆` as Subset
- Allow `.lagda` for library sources HOT 7
- `m+[n∸m]≡n` in the wrong section HOT 2
- Add bundled mono-/iso-{/epi-} morphisms
- Add bundles for lattice-like and module-like morphisms
- Document `variable` block indentation style HOT 5
- [DRY] what's the best way to `public`ly re-export properties/structure? HOT 5
- Use the Monoid structure of Endomorphisms to define powering HOT 1
- [DRY] More redundant `zero` fields in `Algebra.Structures`
- Why is `Data.List.Relation.Binary.Subset.Setoid.Properties` not parametrized on the `Setoid` as a whole HOT 5
- What's the 'right' notion of equality between functions? HOT 7
- [DRY] Refactor `Algebra.Solver.*Monoid` (or deprecate entirely?)
- Rename `WeaklyDecidable`? HOT 4
- Add `Algebra.Properties.IdempotentCommutativeMonoid`
- Naming of new functions `tail∘inits` and `tail∘tails` HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agda-stdlib.