Lens' s a
: given a types
that always has ana
in it, aLens' s a
is a way of getting and setting thata
inside ofs
Prism' s a
: given a types
that might have ana
in it, aPrism' s a
is a way of extracting thea
if it exists, and being able to create ans
given ana
Traversal' s a
: target manya
s which may or may not exist inside of ans
Iso' s a
: says thats
anda
are different representations of the same type
AllLens
es areTraversal
s and allPrism
s are alsoTraversal
s. Not allTraversal
s areLens
es orPrism
s though. https://www.reddit.com/r/haskell/comments/9ded97/is_learning_how_to_use_the_lens_library_worth_it/e5hf9ai/
A prism is like a first-class pattern match
https://www.youtube.com/watch?v=GZPup5Iuaqw
チュートリアル
- Lenses: compositional data access and manipulation.
- Lensとは - Qiita
- Lensの仕組みがわかった - Qiita
- Haskell/Lenses and functional references
- Control.Lens.Tutorial
- lens over tea
- lens over tea #1: lenses 101, traversals 101, and some implementation details
- lens over tea #2: composition, laws, getters/actions/setters
- lens over tea #3: folds
- lens over tea #4: isomorphisms, some profunctors, lens families
- lens over tea #5: prisms
- lens over tea #6: Template Haskell
- lens over tea #7: indexed traversals
- 🎥 Lenses, Folds and Traversals: An Introduction to the Lens Library with Edward Kmett
- A Clear Intro to Lenses
- Lensで行こう!
- Lensで行こう!(2):Isoへの拡張
- Lens from Scratch
- Zippers and lenses
- LensでHaskellをもっと格好良く! 2013/3/31
- LensでHaskellをもっと格好良く! 2013/5/30
- Lenses from the ground up
- Explicit is better than implicit
- mchaver - Lens Tutorial - SimpleLens
- Why Lenses Work
- hablapps/DontFearTheProfunctorOptics: Don’t Fear the Profunctor Optics!
- lensの演算子と等価な関数の対応表 - Qiita
- あいや☆ぱぶりっしゅぶろぐ! - lens(のMonadState演算子など)で自己に言及したい時はidを使う
- Lenses embody Products, Prisms embody Sums · in Code
- Exercises for understanding lenses | William Yao
- Building Lenses
- Optics Cheatsheet
- Optics By Example by Chris Penner [Leanpub PDF/iPad/Kindle]
- Mutating Lenses | tarmean.github.io
ライブラリ
lens
- lens
- microlens
- lensパッケージのオプティクス(弱い順)
- Kinokkory/lens-japanese - ekmett/lens/wiki の日本語訳
- ChrisPenner/lens-errors: Handling errors which occur deep inside lens-chains
- ChrisPenner/lens-filesystem: Lens interface for your filesystem; still a bit experimental
- Declaration groups: where order of declarations suddenly matters in Haskell
optics
- Well-Typed - The Haskell Consultants: Announcing the optics library
- Oleg’s gists - Case study: migrating from lens to optics
prolens
generic-lens
- generic-lens | Generically derive traversals, lenses, and prisms.
- TemplateHaskell不要なレコードアクセサgeneric-lens🙄 - Qiita
Classy Optics
- lensのmakeClassyで型を合成する
- makeClassyを使って複数のオブジェクトで共通する函数をまとめる
- Next Level MTL - George Wilson - BFPG 2016-06
その他
- 高談活論: 双方向変換の原理と実践
- total-1.0.0: Exhaustive pattern matching using traversals, prisms, and lenses
- Quick and easy user-defined operators with Plated
- Free Lenses for Higher-Kinded Data :: Reasonably Polymorphic
- HKD: Less Terrible than You Might Expect :: Reasonably Polymorphic
- Well-Typed - The Haskell Consultants: Compositional zooming for StateT and ReaderT using lens
- A clear picture of lens laws —Functional Pearl—
- Lens into wrapped newtypes / Jappie
- Lens as a Divisibility Relation: Goofin’ Off With the Algebra of Types - Hey There Buddo!
- Optics + Regex: Greater than the sum of their parts
- Fibrations, Cleavages, and Lenses | Bartosz Milewski’s Programming Cafe
- Lenses for Tree Traversals
- Optics and Kleisli arrows
- Composable filters using Witherable optics
- [1805.06798] Generic Deriving of Generic Traversals
- Haskell for all: Optics are monoids
圏論
Profunctor Optics
- Profunctor Polymorphism
- Lenses: Yoneda with Adjunctions
- Profunctor Optics: The Categorical View | Bartosz Milewski’s Programming Cafe
- Oleg’s gists - Affine Traversal
- Oleg’s gists - Compiling lenses
- Oleg’s gists - Mutated lenses
- Oleg’s gists - Glassery
- Oleg’s gists - Indexed Profunctor optics
- Oleg’s gists - Functor Optics
- Oleg’s gists - Finding correct (lens) laws
- Oleg’s gists - Coindexed optics
- Lysxia - Monadic profunctors for bidirectional programming
- What You Needa Know about Yoneda
- Profunctor Optics and the Yoneda Lemma
- Algebraic lenses
- Intro to Kaleidoscopes: Optics for aggregating data through Applicatives