Comments (9)
I'm somewhat torn about these.
Just writing down the list of issues and thoughts I had had about these before
The nice thing about the existing operators that we do have is that they mostly have a consistent set of semiotics, but that symbology doesn't transfer to these.
This also introduces a new extension into the mix. I don't think we had any type operators in lens before this. ;)
I had also consciously left off infix versions because they pessimized the use of the more correct 4 argument types for many lenses.
That and I was hoping that if I put it off long enough 7.6 would be current enough that I could use aliases that didn't start with :
, e.g.
type a <-> b = Simple Iso a b
But, all that said, it looks like the next platform is probably going to ship with 7.4.2, so that is a dead dream.
I can probably be talked into a subset of them. Let me chew on names for a bit. =/
The :->
operator is at least consistent with all the other lens libraries and might help people with the transition.
The Traversal operator there kind of gives me pause though. :=>
might be a better "heavy lens" visual for it.
Maybe if we just did Traversal
and Lens
for now?
Re: SimpleIndexedLens
that wouldn't work as an SimpleIndexedLens
and its ilk` takes 3 arguments.
from lens.
(and probably Iso
)
from lens.
We could probably do some kind of evil a:@Int-> b
for indexed lenses, using
infixr 0 :@
type family a :@ b
type instance a :@ (i -> c) = SimpleIndexedLens i a c
but it hardly seems worth it and doesn't generalize. ;)
from lens.
Closing this out as 'good enough', but feel free to re-open it.
from lens.
Yup. I picked operators that start with colon for backwards compatibility
sake. It's unfortunate that it'll be a while before we can assume ghc 7.6
as a bare minimum - it does kinda suck that we either choose operators now
that start with a colon or wait for the new type operators behavior to
become standard.
At once, I really like :=> for traversal, because it's just like lens :->
but with multiple paths. We wouldn't be able to use "->" and "=>" anyway,
for obvious reasons, so this could be a reason to justify the colon. On
the other hand, I can also see people being initially confused about ":=>"
due to its similarity to the builtin "=>".
So, my vote is for having two type operators - ":->" and ":=>"
On Tue, Sep 25, 2012 at 8:23 AM, Edward A. Kmett
[email protected]:
Closing this out as 'good enough', but feel free to re-open it.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-8858196.
from lens.
I added :->
, :=>
, :<->
and pushed out 3.0 (to get zippers into circulation) just a little bit ago.
from lens.
Great!
Thanks for adding those! I think they will make the Lens DSL better,
because I'd like to use the type signatures of the declarations to
determine whether the lens or iso transformation is used. This means I can
have the following:
type a :->: b = a -> b
type a :=>: b = a -> [b]
type a :<->: b = a -> b
Which allows the [d| |] quote to typecheck, while providing information to
TH that distinguishes between lenses and isos. I'm not sure if this is an
approach that's been used before - you can pass in arbitrary configuration
into TH - and make the types work out - by providing the appropriate type
synonyms. Could be an interesting thing to consider in general. It
resolves much of people's problems with using TH for DSLs (obscure errors).
-Michael
On Tue, Sep 25, 2012 at 10:35 AM, Edward A. Kmett
[email protected]:
I added :->, :=>, :<-> and pushed out 3.0 (to get zippers into
circulation) just a little bit ago.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/61#issuecomment-8863004.
from lens.
I'm not sure if it would be good to encourage people to mix the definitions of their lenses, isos, and traversals.
At once, it could make the API really small:
lenq :: DecsQ -> DecsQ
lense, isoe, traversale :: ExpQ -> ExpQ
from lens.
heh, lense
is cute.
from lens.
Related Issues (20)
- Does not compile on GHC 9.2.2 (pre-release): Module ‘Data.Semigroup’ does not export ‘getOption’ HOT 2
- Add O(1) `Iso'`s for sets with map representations HOT 2
- `Bizarre` as a superclass of `IndexedComonadStore`?
- `Index` TypeFamily for `Ixed`/`At` inconsistent with FunDeps for `*WithIndex` HOT 3
- Compatibility with transformers-0.6 and mtl-2.3 HOT 12
- FYI: all dependencies should be GHC-9.4 compatible now HOT 2
- creately.com diagram template broken, blocks #828 HOT 2
- Expand tuple accessors to support 26-item tuples
- Add `Zoom` for `Control.Monad.Trans.WriterT.CPS` HOT 1
- Missing combinators for creating and consuming Fold1, and IndexedFold1 's
- Add a strict over? HOT 1
- Are state modifications supposed to be so lazy? HOT 1
- Dead link in description HOT 1
- No accessors are generated when using `NoFieldSelectors` to remove prefixes. HOT 3
- Splitting Ixed/At/Contains into their own package HOT 2
- Build failure with GHC-9.6, mtl-2.3.1 but transformers-0.5 HOT 12
- Negative Index onto Text type results in returning first element HOT 4
- Separate Plated into own package HOT 1
- Enable makeWrapped to work with data family instances HOT 1
- Change the link in github HOT 2
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 lens.