typelevel / cats

Lightweight, modular, and extensible library for functional programming.
https://typelevel.org/cats/
Other
5.25k stars 1.21k forks source link

Implement Zippers #1156

Open afiore opened 8 years ago

afiore commented 8 years ago

I have noticed that, while ScalaZ provides an implementation for Zippers, cats doesn't seem to have one yet. Would that be a useful addition to this project?, and if so, should we use the ScalaZ implementation as a reference?

According to the Haskell wiki, the concept was first formulated in a paper by Gerard Huet.

adelbertc commented 8 years ago

I've found the occasional use of zippers in the past. If we include this I would vote to have it in a separate project or a cats-zipper project.

kailuowang commented 8 years ago

@adelbertc did you consider using shapeless zipper?

PanAeon commented 7 years ago

@kailuowang Isn't shapeless zipper works only with HList like structures?

milessabin commented 7 years ago

@PanAeon shapeless's zipper works on arbitrary nested product types.

kailuowang commented 7 years ago

@PanAeon sorry, it slipped my mind to reply to you. Thank you @milessabin !

PanAeon commented 7 years ago

thanks, both of you! That's why I'm asking - zipper from ScalaZ works with Streams, which I believe are kind of union types. So it is still makes sense to implement generic zipper / list zipper for cats. (maybe in a separate lib)

kailuowang commented 7 years ago

again I vote for a separate lib.

djspiewak commented 7 years ago

Also voting for a separate library.

mpilquist commented 7 years ago

+1 for this existing in a separate library if the shapeless version isn't sufficient. Another +1 for basing it on a clean implementation instead of starting with the Scalaz version.