Comments (6)
Optics hierarchy is closed in optics
. This a design choice (somewhat indirectly mentioned in https://hackage.haskell.org/package/optics-0.4.1/docs/Optics.html#g:4, opaque design leads to closed hierarchy). And in fact OpticKind
could be a data
(i.e. closed kind) IMO, but we decided to have OpticKind = Type
for now (#58), because GHC prints ugly ticks for promoted types. (We might revisit that once https://gitlab.haskell.org/ghc/ghc/-/issues/20531 is implemented, optics
being a motivation point).
from optics.
To be fair, Constraints
being open wouldn't change anything in the past because we relied on JoinKinds
being a closed type family. But now that it's a class, if the Constraints
and EliminationForms
are made open, then IIUC it would be possible for a third party to add a new optic kind
from optics.
The addition is not very compositional though. User A can add their optic easily, and User B can add theirs, but if C want to use both, they will need to make A and B to talk to each other.
And you cannot add something in between, like Traversal1.
from optics.
@phadej, why can't you add something in between? The diamond problem is ... annoying.
from optics.
why can't you add something in between?
You are right, maybe Traversal1
one can be added in, as we don't over-approximate JoinKinds
, i.e. it's a "Join" i.e. least upper bound of known optics. (I was thinking about lens
, where Prism
and Lens
composition is Traversal
, and not AffineTraversal
, as there isn't AffineTraversal
in lens
).
(EDIT: this is another example of non-compositionality, all additions have to preserve the "leastness" of upper bounds in JoinKinds
; have to consider the global structure to keep it sane)
from optics.
In principle, I think it should be possible to do much more with in-betweens than lens
can, through suitable fudging of Is
.
from optics.
Related Issues (20)
- Instances for types in `primitive` HOT 2
- Numeric state operators HOT 2
- Plated HOT 3
- GHC9.2.1 HOT 1
- Release 0.4.1
- Why does getOptic have a Profunctor constraint? HOT 3
- Error message for `JoinKinds` could mention m
- Tagging scheme HOT 1
- Build failure in optics-extra-0.4.2 with mtl-2.3 and transformers < 0.6 HOT 8
- Drop ticks in type level constructors HOT 1
- Label optics misbehavior when defined with phantom type HOT 5
- Missing INLINE pragma on castOptic? HOT 27
- Add a function to traverse the contents of a lens HOT 6
- Clarify makeFieldLabels prefix requirements
- over' and iover' pretend to work with incompatible optics
- Strictify traversals?
- Improve type errors
- Support GHC 9.6 HOT 5
- Tests failing on GHC 9.4 on current Hackage release (0.4.2) HOT 3
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 optics.