Skip to content

Named and nameless types #5258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ericson2314 opened this issue Apr 12, 2018 · 8 comments
Open

Named and nameless types #5258

Ericson2314 opened this issue Apr 12, 2018 · 8 comments

Comments

@Ericson2314
Copy link
Collaborator

Ericson2314 commented Apr 12, 2018

We have a general principle in software engineering that things shouldn't know their own names. In the the DB case, that means talking about rows without their "surrogate key" with trick's like Persistent's Entity.

I think we could benefit from something similar in Cabal. Take for example, components, under the assumption I've finally finished my #5100 separating GDP from PD :D. We replace

data Library = { libraryName = .., ... }

with

data Library = ...
type NamedLibrary = (UnqualComponent, Library)

(or some strictly fancier trick) and so on.

A GDP could have quite invalid structure, so it should stay the same using NamedLibrary where Library used before, but a PD should ensure that names are not reassigned to components and instead have a Map UnqualComponent Library with a convenience for NamedLibrary.

This and similar tricks would allow us to enforce a bunch of invariants that are already made true in transformations like GDP -> PD but then only assumed with partial code rather than enforced.

CC @phadej

@Ericson2314 Ericson2314 changed the title Named and nameless types. Named and nameless types Apr 12, 2018
@Ericson2314 Ericson2314 self-assigned this Apr 12, 2018
@23Skidoo
Copy link
Member

23Skidoo commented Jun 8, 2018

The idea sounds sensible to me.

@Ericson2314 Ericson2314 added this to the 3.0 milestone Aug 20, 2018
@Ericson2314
Copy link
Collaborator Author

Ericson2314 commented Aug 20, 2018

Relatedly, I'd like to parse with [(UnqualComponent, CondTree Libray)], and then convert to Map UnqualComponent (CondTree Libray). This mirrors what we could do with my unmerged LibDependency and @fgaz's Dependency, in that that is also grouping by package name.

@phadej
Copy link
Collaborator

phadej commented Jun 10, 2019

@Ericson2314 what's status with this. Is this post-3.0 now?

@Ericson2314
Copy link
Collaborator Author

@phadej Yeah I haven't started on it. Should I try to bang it out quick? :D

@23Skidoo
Copy link
Member

Probably no

@Ericson2314
Copy link
Collaborator Author

That's what I figured. My only concern for this and a few other things is what the situation wrt breaking changes will be after 3.

@23Skidoo
Copy link
Member

We can have breaking changes in the next major release (3.2).

@Ericson2314
Copy link
Collaborator Author

OK great!

@23Skidoo 23Skidoo modified the milestones: 3.0, 3.0.1.0 Oct 16, 2019
@phadej phadej modified the milestones: 3.0.1.0, 3.2, 3.4 Nov 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants